A64: Implement SHRN/SHRN2
This commit is contained in:
parent
80e005e5b5
commit
937990fd2a
2 changed files with 24 additions and 1 deletions
|
@ -795,7 +795,7 @@ INST(SSRA_2, "SSRA", "0Q001
|
|||
//INST(SRSRA_2, "SRSRA", "0Q0011110IIIIiii001101nnnnnddddd")
|
||||
INST(SHL_2, "SHL", "0Q0011110IIIIiii010101nnnnnddddd")
|
||||
//INST(SQSHL_imm_2, "SQSHL (immediate)", "0Q0011110IIIIiii011101nnnnnddddd")
|
||||
//INST(SHRN, "SHRN, SHRN2", "0Q0011110IIIIiii100001nnnnnddddd")
|
||||
INST(SHRN, "SHRN, SHRN2", "0Q0011110IIIIiii100001nnnnnddddd")
|
||||
//INST(RSHRN, "RSHRN, RSHRN2", "0Q0011110IIIIiii100011nnnnnddddd")
|
||||
//INST(SQSHRN_2, "SQSHRN, SQSHRN2", "0Q0011110IIIIiii100101nnnnnddddd")
|
||||
//INST(SQRSHRN_2, "SQRSHRN, SQRSHRN2", "0Q0011110IIIIiii100111nnnnnddddd")
|
||||
|
|
|
@ -68,6 +68,29 @@ bool TranslatorVisitor::SHL_2(bool Q, Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool TranslatorVisitor::SHRN(bool Q, Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd) {
|
||||
if (immh == 0b0000) {
|
||||
return DecodeError();
|
||||
}
|
||||
|
||||
if (immh.Bit<3>()) {
|
||||
return ReservedValue();
|
||||
}
|
||||
|
||||
const size_t esize = 8 << Common::HighestSetBit(immh.ZeroExtend());
|
||||
const size_t source_esize = 2 * esize;
|
||||
const size_t part = Q ? 1 : 0;
|
||||
|
||||
const u8 shift_amount = static_cast<u8>(source_esize - concatenate(immh, immb).ZeroExtend());
|
||||
|
||||
const IR::U128 operand = ir.GetQ(Vn);
|
||||
const IR::U128 result = ir.VectorNarrow(source_esize,
|
||||
ir.VectorLogicalShiftRight(source_esize, operand, shift_amount));
|
||||
|
||||
Vpart(64, Vd, part, result);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TranslatorVisitor::SSHLL(bool Q, Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd) {
|
||||
if (immh == 0b0000) {
|
||||
return DecodeError();
|
||||
|
|
Loading…
Reference in a new issue