From bdcea0b0dcd6a029325200381093ea94872efcbf Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 2 Mar 2019 21:12:09 -0500 Subject: [PATCH] A64: Implement scalar double/single precision FMULX (by element) --- src/frontend/A64/decoder/a64.inc | 2 +- .../translate/impl/simd_scalar_x_indexed_element.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/frontend/A64/decoder/a64.inc b/src/frontend/A64/decoder/a64.inc index 9400bdf0..0afe6027 100644 --- a/src/frontend/A64/decoder/a64.inc +++ b/src/frontend/A64/decoder/a64.inc @@ -551,7 +551,7 @@ INST(FMUL_elt_2, "FMUL (by element)", "01011 //INST(SQRDMLAH_elt_1, "SQRDMLAH (by element)", "01111111zzLMmmmm1101H0nnnnnddddd") //INST(SQRDMLSH_elt_1, "SQRDMLSH (by element)", "01111111zzLMmmmm1111H0nnnnnddddd") //INST(FMULX_elt_1, "FMULX (by element)", "0111111100LMmmmm1001H0nnnnnddddd") -//INST(FMULX_elt_2, "FMULX (by element)", "011111111zLMmmmm1001H0nnnnnddddd") +INST(FMULX_elt_2, "FMULX (by element)", "011111111zLMmmmm1001H0nnnnnddddd") // Data Processing - FP and SIMD - SIMD Table Lookup INST(TBL, "TBL", "0Q001110000mmmmm0LL000nnnnnddddd") diff --git a/src/frontend/A64/translate/impl/simd_scalar_x_indexed_element.cpp b/src/frontend/A64/translate/impl/simd_scalar_x_indexed_element.cpp index d89df47c..fd799eec 100644 --- a/src/frontend/A64/translate/impl/simd_scalar_x_indexed_element.cpp +++ b/src/frontend/A64/translate/impl/simd_scalar_x_indexed_element.cpp @@ -12,7 +12,8 @@ namespace { enum class ExtraBehavior { None, Accumulate, - Subtract + Subtract, + MultiplyExtended, }; bool MultiplyByElement(TranslatorVisitor& v, bool sz, Imm<1> L, Imm<1> M, Imm<4> Vmlo, Imm<1> H, @@ -34,6 +35,10 @@ bool MultiplyByElement(TranslatorVisitor& v, bool sz, Imm<1> L, Imm<1> M, Imm<4> return v.ir.FPMul(operand1, element, true); } + if (extra_behavior == ExtraBehavior::MultiplyExtended) { + return v.ir.FPMulX(operand1, element); + } + if (extra_behavior == ExtraBehavior::Subtract) { operand1 = v.ir.FPNeg(operand1); } @@ -59,6 +64,10 @@ bool TranslatorVisitor::FMUL_elt_2(bool sz, Imm<1> L, Imm<1> M, Imm<4> Vmlo, Imm return MultiplyByElement(*this, sz, L, M, Vmlo, H, Vn, Vd, ExtraBehavior::None); } +bool TranslatorVisitor::FMULX_elt_2(bool sz, Imm<1> L, Imm<1> M, Imm<4> Vmlo, Imm<1> H, Vec Vn, Vec Vd) { + return MultiplyByElement(*this, sz, L, M, Vmlo, H, Vn, Vd, ExtraBehavior::MultiplyExtended); +} + bool TranslatorVisitor::SQDMULH_elt_1(Imm<2> size, Imm<1> L, Imm<1> M, Imm<4> Vmlo, Imm<1> H, Vec Vn, Vec Vd) { if (size == 0b00 || size == 0b11) { return UnallocatedEncoding();