From a785d4fa6615dce1dd5ef04ead743f926fdcaf42 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Mon, 5 Feb 2018 12:25:53 +0000 Subject: [PATCH] A64: Implement FCCMPE --- src/frontend/A64/decoder/a64.inc | 2 +- .../impl/floating_point_conditional_compare.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/frontend/A64/decoder/a64.inc b/src/frontend/A64/decoder/a64.inc index c3b76900..8bca9482 100644 --- a/src/frontend/A64/decoder/a64.inc +++ b/src/frontend/A64/decoder/a64.inc @@ -913,7 +913,7 @@ INST(FMOV_float_imm, "FMOV (scalar, immediate)", "00011 // Data Processing - FP and SIMD - Floating point conditional compare INST(FCCMP_float, "FCCMP", "00011110yy1mmmmmcccc01nnnnn0ffff") -//INST(FCCMPE_float, "FCCMPE", "00011110yy1mmmmmcccc01nnnnn1ffff") +INST(FCCMPE_float, "FCCMPE", "00011110yy1mmmmmcccc01nnnnn1ffff") // Data Processing - FP and SIMD - Floating point data processing two register INST(FMUL_float, "FMUL (scalar)", "00011110yy1mmmmm000010nnnnnddddd") diff --git a/src/frontend/A64/translate/impl/floating_point_conditional_compare.cpp b/src/frontend/A64/translate/impl/floating_point_conditional_compare.cpp index dbe710ed..24d420de 100644 --- a/src/frontend/A64/translate/impl/floating_point_conditional_compare.cpp +++ b/src/frontend/A64/translate/impl/floating_point_conditional_compare.cpp @@ -38,4 +38,20 @@ bool TranslatorVisitor::FCCMP_float(Imm<2> type, Vec Vm, Cond cond, Vec Vn, Imm< return true; } +bool TranslatorVisitor::FCCMPE_float(Imm<2> type, Vec Vm, Cond cond, Vec Vn, Imm<4> nzcv) { + const auto datasize = GetDataSize(type); + if (!datasize || *datasize == 16) { + return UnallocatedEncoding(); + } + const u32 flags = nzcv.ZeroExtend() << 28; + + const IR::U32U64 operand1 = V_scalar(*datasize, Vn); + const IR::U32U64 operand2 = V_scalar(*datasize, Vm); + + const IR::NZCV then_flags = ir.FPCompare(operand1, operand2, true, true); + const IR::NZCV else_flags = ir.NZCVFromPackedFlags(ir.Imm32(flags)); + ir.SetNZCV(ir.ConditionalSelect(cond, then_flags, else_flags)); + return true; +} + } // namespace Dynarmic::A64