From db958061a3d19b8f1e060263f72a91deba176bef Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sun, 4 Feb 2018 13:43:47 +0000 Subject: [PATCH] A64: Implement FABS --- src/frontend/A64/decoder/a64.inc | 2 +- .../floating_point_data_processing_one_register.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 31281442..6a59c4cb 100644 --- a/src/frontend/A64/decoder/a64.inc +++ b/src/frontend/A64/decoder/a64.inc @@ -908,7 +908,7 @@ INST(FCVTZU_float_int, "FCVTZU (scalar, integer)", "z0011 // Data Processing - FP and SIMD - Floating point data processing //INST(FMOV_float, "FMOV (register)", "00011110yy100000010000nnnnnddddd") -//INST(FABS_float, "FABS (scalar)", "00011110yy100000110000nnnnnddddd") +INST(FABS_float, "FABS (scalar)", "00011110yy100000110000nnnnnddddd") //INST(FNEG_float, "FNEG (scalar)", "00011110yy100001010000nnnnnddddd") //INST(FSQRT_float, "FSQRT (scalar)", "00011110yy100001110000nnnnnddddd") INST(FCVT_float, "FCVT", "00011110yy10001oo10000nnnnnddddd") diff --git a/src/frontend/A64/translate/impl/floating_point_data_processing_one_register.cpp b/src/frontend/A64/translate/impl/floating_point_data_processing_one_register.cpp index 8066aa29..d91709d6 100644 --- a/src/frontend/A64/translate/impl/floating_point_data_processing_one_register.cpp +++ b/src/frontend/A64/translate/impl/floating_point_data_processing_one_register.cpp @@ -22,6 +22,18 @@ static boost::optional GetDataSize(Imm<2> type) { return boost::none; } +bool TranslatorVisitor::FABS_float(Imm<2> type, Vec Vn, Vec Vd) { + boost::optional datasize = GetDataSize(type); + if (!datasize || *datasize == 16) { + return UnallocatedEncoding(); + } + + const IR::U32U64 operand = V_scalar(*datasize, Vn); + const IR::U32U64 result = ir.FPAbs(operand); + V_scalar(*datasize, Vd, result); + return true; +} + bool TranslatorVisitor::FMOV_float_imm(Imm<2> type, Imm<8> imm8, Vec Vd) { boost::optional datasize = GetDataSize(type); if (!datasize) {