A64: Implement FCVTL{2}

This commit is contained in:
Lioncash 2018-08-13 22:41:06 -04:00 committed by MerryMage
parent 7eb6be7a6a
commit 4c3d7c5a8d
2 changed files with 20 additions and 1 deletions

View file

@ -581,7 +581,7 @@ INST(ABS_2, "ABS", "0Q001
INST(XTN, "XTN, XTN2", "0Q001110zz100001001010nnnnnddddd")
INST(SQXTN_2, "SQXTN, SQXTN2", "0Q001110zz100001010010nnnnnddddd")
//INST(FCVTN, "FCVTN, FCVTN2", "0Q0011100z100001011010nnnnnddddd")
//INST(FCVTL, "FCVTL, FCVTL2", "0Q0011100z100001011110nnnnnddddd")
INST(FCVTL, "FCVTL, FCVTL2", "0Q0011100z100001011110nnnnnddddd")
//INST(FRINTN_1, "FRINTN (vector)", "0Q00111001111001100010nnnnnddddd")
INST(FRINTN_2, "FRINTN (vector)", "0Q0011100z100001100010nnnnnddddd")
//INST(FRINTM_1, "FRINTM (vector)", "0Q00111001111001100110nnnnnddddd")

View file

@ -267,6 +267,25 @@ bool TranslatorVisitor::FCMLT_4(bool Q, bool sz, Vec Vn, Vec Vd) {
return FPCompareAgainstZero(*this, Q, sz, Vn, Vd, ComparisonType::LT);
}
bool TranslatorVisitor::FCVTL(bool Q, bool sz, Vec Vn, Vec Vd) {
// Half-precision not handled directly.
if (!sz) {
return InterpretThisInstruction();
}
const IR::U128 part = Vpart(64, Vn, Q);
IR::U128 result = ir.ZeroVector();
for (size_t i = 0; i < 2; i++) {
const IR::U64 element = ir.FPSingleToDouble(ir.VectorGetElement(32, part, i), true);
result = ir.VectorSetElement(64, result, i, element);
}
V(128, Vd, result);
return true;
}
bool TranslatorVisitor::FCVTNS_4(bool Q, bool sz, Vec Vn, Vec Vd) {
return FloatConvertToInteger(*this, Q, sz, Vn, Vd, Signedness::Signed, FP::RoundingMode::ToNearest_TieEven);
}