diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3f4d5820..19857141 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -152,6 +152,7 @@ add_library(dynarmic frontend/A64/translate/impl/simd_scalar_shift_by_immediate.cpp frontend/A64/translate/impl/simd_scalar_three_same.cpp frontend/A64/translate/impl/simd_scalar_two_register_misc.cpp + frontend/A64/translate/impl/simd_scalar_x_indexed_element.cpp frontend/A64/translate/impl/simd_sha.cpp frontend/A64/translate/impl/simd_sha512.cpp frontend/A64/translate/impl/simd_shift_by_immediate.cpp diff --git a/src/frontend/A64/decoder/a64.inc b/src/frontend/A64/decoder/a64.inc index 27f6db1d..1c7ac048 100644 --- a/src/frontend/A64/decoder/a64.inc +++ b/src/frontend/A64/decoder/a64.inc @@ -504,7 +504,7 @@ INST(FCVTZU_fix_1, "FCVTZU (vector, fixed-point)", "01111 //INST(FMLS_elt_1, "FMLS (by element)", "0101111100LMmmmm0101H0nnnnnddddd") //INST(FMLS_elt_2, "FMLS (by element)", "010111111zLMmmmm0101H0nnnnnddddd") //INST(FMUL_elt_1, "FMUL (by element)", "0101111100LMmmmm1001H0nnnnnddddd") -//INST(FMUL_elt_2, "FMUL (by element)", "010111111zLMmmmm1001H0nnnnnddddd") +INST(FMUL_elt_2, "FMUL (by element)", "010111111zLMmmmm1001H0nnnnnddddd") //INST(SQRDMLAH_elt_1, "SQRDMLAH (by element)", "01111111zzLMmmmm1101H0nnnnnddddd") //INST(SQRDMLSH_elt_1, "SQRDMLSH (by element)", "01111111zzLMmmmm1111H0nnnnnddddd") //INST(FMULX_elt_1, "FMULX (by element)", "0111111100LMmmmm1001H0nnnnnddddd") diff --git a/src/frontend/A64/translate/impl/impl.h b/src/frontend/A64/translate/impl/impl.h index 776493af..642ba544 100644 --- a/src/frontend/A64/translate/impl/impl.h +++ b/src/frontend/A64/translate/impl/impl.h @@ -666,8 +666,8 @@ struct TranslatorVisitor final { bool FMLA_elt_2(bool sz, bool L, bool M, Vec Vm, bool H, Vec Vn, Vec Vd); bool FMLS_elt_1(bool L, bool M, Vec Vm, bool H, Vec Vn, Vec Vd); bool FMLS_elt_2(bool sz, bool L, bool M, Vec Vm, bool H, Vec Vn, Vec Vd); - bool FMUL_elt_1(bool L, bool M, Vec Vm, bool H, Vec Vn, Vec Vd); - bool FMUL_elt_2(bool sz, bool L, bool M, Vec Vm, bool H, Vec Vn, Vec Vd); + bool FMUL_elt_1(Imm<1> L, Imm<1> M, Imm<4> Vmlo, Imm<1> H, Vec Vn, Vec Vd); + bool FMUL_elt_2(bool sz, Imm<1> L, Imm<1> M, Imm<4> Vmlo, Imm<1> H, Vec Vn, Vec Vd); bool SQRDMLAH_elt_1(Imm<2> size, bool L, bool M, Vec Vm, bool H, Vec Vn, Vec Vd); bool SQRDMLSH_elt_1(Imm<2> size, bool L, bool M, Vec Vm, bool H, Vec Vn, Vec Vd); bool FMULX_elt_1(bool L, bool M, Vec Vm, bool H, Vec Vn, Vec Vd); 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 new file mode 100644 index 00000000..6a88127c --- /dev/null +++ b/src/frontend/A64/translate/impl/simd_scalar_x_indexed_element.cpp @@ -0,0 +1,29 @@ +/* This file is part of the dynarmic project. + * Copyright (c) 2018 MerryMage + * This software may be used and distributed according to the terms of the GNU + * General Public License version 2 or any later version. + */ + +#include "frontend/A64/translate/impl/impl.h" + +namespace Dynarmic::A64 { + +bool TranslatorVisitor::FMUL_elt_2(bool sz, Imm<1> L, Imm<1> M, Imm<4> Vmlo, Imm<1> H, Vec Vn, Vec Vd) { + if (sz && L == 1) { + return UnallocatedEncoding(); + } + + const size_t idxdsize = H == 1 ? 128 : 64; + const size_t index = sz ? H.ZeroExtend() : concatenate(H, L).ZeroExtend(); + const Vec Vm = concatenate(M, Vmlo).ZeroExtend(); + const size_t esize = sz ? 64 : 32; + + const IR::U32U64 operand = V_scalar(esize, Vn); + const IR::U32U64 element = ir.VectorGetElement(esize, V(idxdsize, Vm), index); + const IR::U32U64 result = ir.FPMul(operand, element, true); + + V_scalar(esize, Vd, result); + return true; +} + +} // namespace Dynarmic::A64