A64: Implement FNEG (vector)

This commit is contained in:
Lioncash 2018-04-23 11:51:37 -04:00 committed by MerryMage
parent ba1cc6366d
commit 41f4717f2b
2 changed files with 18 additions and 1 deletions

View file

@ -640,7 +640,7 @@ INST(NEG_2, "NEG (vector)", "0Q101
INST(NOT, "NOT", "0Q10111000100000010110nnnnnddddd")
INST(RBIT_asimd, "RBIT (vector)", "0Q10111001100000010110nnnnnddddd")
//INST(FNEG_1, "FNEG (vector)", "0Q10111011111000111110nnnnnddddd")
//INST(FNEG_2, "FNEG (vector)", "0Q1011101z100000111110nnnnnddddd")
INST(FNEG_2, "FNEG (vector)", "0Q1011101z100000111110nnnnnddddd")
//INST(FRINTI_1, "FRINTI (vector)", "0Q10111011111001100110nnnnnddddd")
//INST(FRINTI_2, "FRINTI (vector)", "0Q1011101z100001100110nnnnnddddd")
//INST(FCMGE_zero_3, "FCMGE (zero)", "0Q10111011111000110010nnnnnddddd")

View file

@ -114,6 +114,23 @@ bool TranslatorVisitor::XTN(bool Q, Imm<2> size, Vec Vn, Vec Vd) {
return true;
}
bool TranslatorVisitor::FNEG_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 = esize == 64 ? 0x8000000000000000 : 0x8000000080000000;
const IR::U128 operand = V(datasize, Vn);
const IR::U128 mask = ir.VectorBroadcast(esize, I(esize, mask_value));
const IR::U128 result = ir.VectorEor(operand, mask);
V(datasize, Vd, result);
return true;
}
bool TranslatorVisitor::NEG_2(bool Q, Imm<2> size, Vec Vn, Vec Vd) {
if (size == 0b11 && !Q) {
return ReservedValue();