A64: Implement SIMD instruction SSHR, vector variant

This commit is contained in:
MerryMage 2018-02-10 23:28:05 +00:00
parent 715ae1c229
commit f58aba9871
2 changed files with 20 additions and 1 deletions

View file

@ -778,7 +778,7 @@ INST(MOVI, "MOVI, MVNI, ORR, BIC (vector, immediate)", "0Qo01
//INST(FMOV_2, "FMOV (vector, immediate)", "0Q00111100000abc111111defghddddd") //INST(FMOV_2, "FMOV (vector, immediate)", "0Q00111100000abc111111defghddddd")
// Data Processing - FP and SIMD - SIMD Shift by immediate // Data Processing - FP and SIMD - SIMD Shift by immediate
//INST(SSHR_2, "SSHR", "0Q0011110IIIIiii000001nnnnnddddd") INST(SSHR_2, "SSHR", "0Q0011110IIIIiii000001nnnnnddddd")
//INST(SSRA_2, "SSRA", "0Q0011110IIIIiii000101nnnnnddddd") //INST(SSRA_2, "SSRA", "0Q0011110IIIIiii000101nnnnnddddd")
//INST(SRSHR_2, "SRSHR", "0Q0011110IIIIiii001001nnnnnddddd") //INST(SRSHR_2, "SRSHR", "0Q0011110IIIIiii001001nnnnnddddd")
//INST(SRSRA_2, "SRSRA", "0Q0011110IIIIiii001101nnnnnddddd") //INST(SRSRA_2, "SRSRA", "0Q0011110IIIIiii001101nnnnnddddd")

View file

@ -9,6 +9,25 @@
namespace Dynarmic::A64 { namespace Dynarmic::A64 {
bool TranslatorVisitor::SSHR_2(bool Q, Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd) {
if (immh == 0b0000) {
return DecodeError();
}
if (immh.Bit<3>() && !Q) {
return ReservedValue();
}
const size_t esize = 8 << Common::HighestSetBit(immh.ZeroExtend());
const size_t datasize = Q ? 128 : 64;
const u8 shift_amount = static_cast<u8>(2 * esize) - concatenate(immh, immb).ZeroExtend<u8>();
const IR::U128 operand = V(datasize, Vn);
const IR::U128 result = ir.VectorArithmeticShiftRight(esize, operand, shift_amount);
V(datasize, Vd, result);
return true;
}
bool TranslatorVisitor::SHL_2(bool Q, Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd) { bool TranslatorVisitor::SHL_2(bool Q, Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd) {
if (immh == 0b0000) { if (immh == 0b0000) {
return DecodeError(); return DecodeError();