A64: Implement the vector version of FCVTXN

This commit is contained in:
Lioncash 2019-03-04 11:25:19 -05:00 committed by MerryMage
parent 4339a8fff6
commit d3515279df
3 changed files with 22 additions and 2 deletions

View file

@ -666,7 +666,7 @@ INST(NEG_2, "NEG (vector)", "0Q101
INST(SQXTUN_2, "SQXTUN, SQXTUN2", "0Q101110zz100001001010nnnnnddddd")
INST(SHLL, "SHLL, SHLL2", "0Q101110zz100001001110nnnnnddddd")
INST(UQXTN_2, "UQXTN, UQXTN2", "0Q101110zz100001010010nnnnnddddd")
//INST(FCVTXN_2, "FCVTXN, FCVTXN2", "0Q1011100z100001011010nnnnnddddd")
INST(FCVTXN_2, "FCVTXN, FCVTXN2", "0Q1011100z100001011010nnnnnddddd")
//INST(FRINTA_1, "FRINTA (vector)", "0Q10111001111001100010nnnnnddddd")
INST(FRINTA_2, "FRINTA (vector)", "0Q1011100z100001100010nnnnnddddd")
//INST(FRINTX_1, "FRINTX (vector)", "0Q10111001111001100110nnnnnddddd")

View file

@ -748,7 +748,7 @@ struct TranslatorVisitor final {
bool NEG_2(bool Q, Imm<2> size, Vec Vn, Vec Vd);
bool SQXTUN_2(bool Q, Imm<2> size, Vec Vn, Vec Vd);
bool UQXTN_2(bool Q, Imm<2> size, Vec Vn, Vec Vd);
bool FCVTXN_2(bool Q, bool sz, Vec Vn, Reg Rd);
bool FCVTXN_2(bool Q, bool sz, Vec Vn, Vec Vd);
bool FRINTN_1(bool Q, Vec Vn, Vec Vd);
bool FRINTN_2(bool Q, bool sz, Vec Vn, Vec Vd);
bool FRINTM_1(bool Q, Vec Vn, Vec Vd);

View file

@ -397,6 +397,26 @@ bool TranslatorVisitor::FCVTPS_4(bool Q, bool sz, Vec Vn, Vec Vd) {
return FloatConvertToInteger(*this, Q, sz, Vn, Vd, Signedness::Signed, FP::RoundingMode::TowardsPlusInfinity);
}
bool TranslatorVisitor::FCVTXN_2(bool Q, bool sz, Vec Vn, Vec Vd) {
if (!sz) {
return UnallocatedEncoding();
}
const size_t part = Q ? 1 : 0;
const auto operand = ir.GetQ(Vn);
auto result = ir.ZeroVector();
for (size_t e = 0; e < 2; ++e) {
const IR::U64 element = ir.VectorGetElement(64, operand, e);
const IR::U32 converted = ir.FPDoubleToSingle(element, FP::RoundingMode::ToOdd);
result = ir.VectorSetElement(32, result, e, converted);
}
Vpart(64, Vd, part, result);
return true;
}
bool TranslatorVisitor::FCVTZS_int_4(bool Q, bool sz, Vec Vn, Vec Vd) {
return FloatConvertToInteger(*this, Q, sz, Vn, Vd, Signedness::Signed, FP::RoundingMode::TowardsZero);
}