From 4491746eaef000421cdd2b89770ffd8b2e69a034 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sun, 4 Feb 2018 13:44:33 +0000 Subject: [PATCH] A64: Implement FNEG --- 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 6a59c4cb..a0025cc6 100644 --- a/src/frontend/A64/decoder/a64.inc +++ b/src/frontend/A64/decoder/a64.inc @@ -909,7 +909,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(FNEG_float, "FNEG (scalar)", "00011110yy100001010000nnnnnddddd") +INST(FNEG_float, "FNEG (scalar)", "00011110yy100001010000nnnnnddddd") //INST(FSQRT_float, "FSQRT (scalar)", "00011110yy100001110000nnnnnddddd") INST(FCVT_float, "FCVT", "00011110yy10001oo10000nnnnnddddd") //INST(FRINTN_float, "FRINTN (scalar)", "00011110yy100100010000nnnnnddddd") 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 d91709d6..22033120 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 @@ -34,6 +34,18 @@ bool TranslatorVisitor::FABS_float(Imm<2> type, Vec Vn, Vec Vd) { return true; } +bool TranslatorVisitor::FNEG_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.FPNeg(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) {