A64: Implement FABS' single and double precision variant

This commit is contained in:
Lioncash 2018-05-11 10:55:41 -04:00 committed by MerryMage
parent 7bce8d8757
commit 6e5750e4ec
2 changed files with 18 additions and 1 deletions

View file

@ -601,7 +601,7 @@ INST(SCVTF_int_4, "SCVTF (vector, integer)", "0Q001
//INST(FCMLT_3, "FCMLT (zero)", "0Q00111011111000111010nnnnnddddd") //INST(FCMLT_3, "FCMLT (zero)", "0Q00111011111000111010nnnnnddddd")
//INST(FCMLT_4, "FCMLT (zero)", "0Q0011101z100000111010nnnnnddddd") //INST(FCMLT_4, "FCMLT (zero)", "0Q0011101z100000111010nnnnnddddd")
//INST(FABS_1, "FABS (vector)", "0Q00111011111000111110nnnnnddddd") //INST(FABS_1, "FABS (vector)", "0Q00111011111000111110nnnnnddddd")
//INST(FABS_2, "FABS (vector)", "0Q0011101z100000111110nnnnnddddd") INST(FABS_2, "FABS (vector)", "0Q0011101z100000111110nnnnnddddd")
//INST(FRINTP_1, "FRINTP (vector)", "0Q00111011111001100010nnnnnddddd") //INST(FRINTP_1, "FRINTP (vector)", "0Q00111011111001100010nnnnnddddd")
//INST(FRINTP_2, "FRINTP (vector)", "0Q0011101z100001100010nnnnnddddd") //INST(FRINTP_2, "FRINTP (vector)", "0Q0011101z100001100010nnnnnddddd")
//INST(FRINTZ_1, "FRINTZ (vector)", "0Q00111011111001100110nnnnnddddd") //INST(FRINTZ_1, "FRINTZ (vector)", "0Q00111011111001100110nnnnnddddd")

View file

@ -114,6 +114,23 @@ bool TranslatorVisitor::XTN(bool Q, Imm<2> size, Vec Vn, Vec Vd) {
return true; return true;
} }
bool TranslatorVisitor::FABS_2(bool Q, bool sz, Vec Vn, Vec Vd) {
if (sz && !Q) {
return ReservedValue();
}
const size_t datasize = Q ? 128 : 64;
const size_t esize = sz ? 64 : 32;
const size_t mask_value = sz ? 0x7FFFFFFFFFFFFFFF : 0x7FFFFFFF;
const IR::U128 operand = V(datasize, Vn);
const IR::U128 mask = ir.VectorBroadcast(esize, I(esize, mask_value));
const IR::U128 result = ir.VectorAnd(operand, mask);
V(datasize, Vd, result);
return true;
}
bool TranslatorVisitor::FNEG_1(bool Q, Vec Vn, Vec Vd) { bool TranslatorVisitor::FNEG_1(bool Q, Vec Vn, Vec Vd) {
const size_t datasize = Q ? 128 : 64; const size_t datasize = Q ? 128 : 64;