A64: Implement UQSHL (immediate)'s scalar variant
Like SQSHL's immediate scalar variant, we can also implement UQSHL's immediate scalar variant in terms of the vector variant for the time being.
This commit is contained in:
parent
e1b4ff1068
commit
b1b4487e4d
2 changed files with 13 additions and 4 deletions
|
@ -524,7 +524,7 @@ INST(URSRA_1, "URSRA", "01111
|
||||||
INST(SRI_1, "SRI", "011111110IIIIiii010001nnnnnddddd")
|
INST(SRI_1, "SRI", "011111110IIIIiii010001nnnnnddddd")
|
||||||
INST(SLI_1, "SLI", "011111110IIIIiii010101nnnnnddddd")
|
INST(SLI_1, "SLI", "011111110IIIIiii010101nnnnnddddd")
|
||||||
//INST(SQSHLU_1, "SQSHLU", "011111110IIIIiii011001nnnnnddddd")
|
//INST(SQSHLU_1, "SQSHLU", "011111110IIIIiii011001nnnnnddddd")
|
||||||
//INST(UQSHL_imm_1, "UQSHL (immediate)", "011111110IIIIiii011101nnnnnddddd")
|
INST(UQSHL_imm_1, "UQSHL (immediate)", "011111110IIIIiii011101nnnnnddddd")
|
||||||
INST(SQSHRUN_1, "SQSHRUN, SQSHRUN2", "011111110IIIIiii100001nnnnnddddd")
|
INST(SQSHRUN_1, "SQSHRUN, SQSHRUN2", "011111110IIIIiii100001nnnnnddddd")
|
||||||
//INST(SQRSHRUN_1, "SQRSHRUN, SQRSHRUN2", "011111110IIIIiii100011nnnnnddddd")
|
//INST(SQRSHRUN_1, "SQRSHRUN, SQRSHRUN2", "011111110IIIIiii100011nnnnnddddd")
|
||||||
INST(UQSHRN_1, "UQSHRN, UQSHRN2", "011111110IIIIiii100101nnnnnddddd")
|
INST(UQSHRN_1, "UQSHRN, UQSHRN2", "011111110IIIIiii100101nnnnnddddd")
|
||||||
|
|
|
@ -30,7 +30,7 @@ enum class FloatConversionDirection {
|
||||||
FloatToFixed,
|
FloatToFixed,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool SaturatingShiftLeft(TranslatorVisitor& v, Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd) {
|
bool SaturatingShiftLeft(TranslatorVisitor& v, Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd, Signedness sign) {
|
||||||
if (immh == 0b0000) {
|
if (immh == 0b0000) {
|
||||||
return v.UnallocatedEncoding();
|
return v.UnallocatedEncoding();
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,12 @@ bool SaturatingShiftLeft(TranslatorVisitor& v, Imm<4> immh, Imm<3> immb, Vec Vn,
|
||||||
|
|
||||||
const IR::U128 operand = v.ir.ZeroExtendToQuad(v.V_scalar(esize, Vn));
|
const IR::U128 operand = v.ir.ZeroExtendToQuad(v.V_scalar(esize, Vn));
|
||||||
const IR::U128 shift = v.ir.ZeroExtendToQuad(v.I(esize, shift_amount));
|
const IR::U128 shift = v.ir.ZeroExtendToQuad(v.I(esize, shift_amount));
|
||||||
const IR::U128 result = v.ir.VectorSignedSaturatedShiftLeft(esize, operand, shift);
|
const IR::U128 result = [&v, esize, operand, shift, sign] {
|
||||||
|
if (sign == Signedness::Signed) {
|
||||||
|
return v.ir.VectorSignedSaturatedShiftLeft(esize, operand, shift);
|
||||||
|
}
|
||||||
|
return v.ir.VectorUnsignedSaturatedShiftLeft(esize, operand, shift);
|
||||||
|
}();
|
||||||
|
|
||||||
v.ir.SetQ(Vd, result);
|
v.ir.SetQ(Vd, result);
|
||||||
return true;
|
return true;
|
||||||
|
@ -270,7 +275,7 @@ bool TranslatorVisitor::SRI_1(Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::SQSHL_imm_1(Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd) {
|
bool TranslatorVisitor::SQSHL_imm_1(Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd) {
|
||||||
return SaturatingShiftLeft(*this, immh, immb, Vn, Vd);
|
return SaturatingShiftLeft(*this, immh, immb, Vn, Vd, Signedness::Signed);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::SQSHRN_1(Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd) {
|
bool TranslatorVisitor::SQSHRN_1(Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd) {
|
||||||
|
@ -312,6 +317,10 @@ bool TranslatorVisitor::SHL_1(Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TranslatorVisitor::UQSHL_imm_1(Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd) {
|
||||||
|
return SaturatingShiftLeft(*this, immh, immb, Vn, Vd, Signedness::Unsigned);
|
||||||
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::UQSHRN_1(Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd) {
|
bool TranslatorVisitor::UQSHRN_1(Imm<4> immh, Imm<3> immb, Vec Vn, Vec Vd) {
|
||||||
return ShiftRightNarrowing(*this, immh, immb, Vn, Vd, Narrowing::SaturateToUnsigned, Signedness::Unsigned);
|
return ShiftRightNarrowing(*this, immh, immb, Vn, Vd, Narrowing::SaturateToUnsigned, Signedness::Unsigned);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue