From 9e75d08860d2f3c05c83b7120acbe93679408cae Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 8 Jun 2018 20:44:52 -0400 Subject: [PATCH] A64: Implement FABD's scalar single/double precision variant --- src/frontend/A64/decoder/a64.inc | 2 +- .../A64/translate/impl/simd_scalar_three_same.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/frontend/A64/decoder/a64.inc b/src/frontend/A64/decoder/a64.inc index 213b95fd..841e81dd 100644 --- a/src/frontend/A64/decoder/a64.inc +++ b/src/frontend/A64/decoder/a64.inc @@ -351,7 +351,7 @@ INST(DUP_elt_1, "DUP (element)", "01011 //INST(FACGE_1, "FACGE", "01111110010mmmmm001011nnnnnddddd") //INST(FACGE_2, "FACGE", "011111100z1mmmmm111011nnnnnddddd") //INST(FABD_1, "FABD", "01111110110mmmmm000101nnnnnddddd") -//INST(FABD_2, "FABD", "011111101z1mmmmm110101nnnnnddddd") +INST(FABD_2, "FABD", "011111101z1mmmmm110101nnnnnddddd") //INST(FCMGT_reg_1, "FCMGT (register)", "01111110110mmmmm001001nnnnnddddd") //INST(FCMGT_reg_2, "FCMGT (register)", "011111101z1mmmmm111001nnnnnddddd") //INST(FACGT_1, "FACGT", "01111110110mmmmm001011nnnnnddddd") diff --git a/src/frontend/A64/translate/impl/simd_scalar_three_same.cpp b/src/frontend/A64/translate/impl/simd_scalar_three_same.cpp index cfa7b91e..d85e8150 100644 --- a/src/frontend/A64/translate/impl/simd_scalar_three_same.cpp +++ b/src/frontend/A64/translate/impl/simd_scalar_three_same.cpp @@ -130,6 +130,18 @@ bool TranslatorVisitor::CMTST_1(Imm<2> size, Vec Vm, Vec Vn, Vec Vd) { return true; } +bool TranslatorVisitor::FABD_2(bool sz, Vec Vm, Vec Vn, Vec Vd) { + const size_t esize = sz ? 64 : 32; + + const IR::U128 operand1 = V(esize, Vn); + const IR::U128 operand2 = V(esize, Vm); + const IR::U128 difference = ir.FPVectorAbsoluteDifference(esize, operand1, operand2); + const IR::U128 result = ir.VectorZeroUpper(difference); + + V(128, Vd, result); + return true; +} + bool TranslatorVisitor::SSHL_1(Imm<2> size, Vec Vm, Vec Vn, Vec Vd) { if (size != 0b11) { return ReservedValue();