A64: Implement FABS' half-precision variant

This commit is contained in:
Lioncash 2018-05-11 11:09:25 -04:00 committed by MerryMage
parent 6e5750e4ec
commit 9736e2cce2
2 changed files with 12 additions and 1 deletions

View file

@ -600,7 +600,7 @@ INST(SCVTF_int_4, "SCVTF (vector, integer)", "0Q001
//INST(FCMEQ_zero_4, "FCMEQ (zero)", "0Q0011101z100000110110nnnnnddddd")
//INST(FCMLT_3, "FCMLT (zero)", "0Q00111011111000111010nnnnnddddd")
//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(FRINTP_1, "FRINTP (vector)", "0Q00111011111001100010nnnnnddddd")
//INST(FRINTP_2, "FRINTP (vector)", "0Q0011101z100001100010nnnnnddddd")

View file

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