From a179e2f2bb74e386c353ee2f6af3302e75075c3c Mon Sep 17 00:00:00 2001 From: Merry Date: Sat, 11 Feb 2023 12:09:56 +0000 Subject: [PATCH] A64: Remove more instances of use of VectorMultiply64 --- .../translate/impl/simd_three_different.cpp | 21 +++++++------------ .../impl/simd_vector_x_indexed_element.cpp | 16 ++++---------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/src/dynarmic/frontend/A64/translate/impl/simd_three_different.cpp b/src/dynarmic/frontend/A64/translate/impl/simd_three_different.cpp index 2de931ed..8cc677b6 100644 --- a/src/dynarmic/frontend/A64/translate/impl/simd_three_different.cpp +++ b/src/dynarmic/frontend/A64/translate/impl/simd_three_different.cpp @@ -55,21 +55,14 @@ bool MultiplyLong(TranslatorVisitor& v, bool Q, Imm<2> size, Vec Vm, Vec Vn, Vec const size_t datasize = 64; const size_t doubled_datasize = datasize * 2; - const auto get_operands = [&] { - const auto p1 = v.Vpart(datasize, Vn, Q); - const auto p2 = v.Vpart(datasize, Vm, Q); + IR::U128 result = [&] { + const auto reg_n = v.Vpart(datasize, Vn, Q); + const auto reg_m = v.Vpart(datasize, Vm, Q); - if (sign == Signedness::Signed) { - return std::make_pair(v.ir.VectorSignExtend(esize, p1), - v.ir.VectorSignExtend(esize, p2)); - } - - return std::make_pair(v.ir.VectorZeroExtend(esize, p1), - v.ir.VectorZeroExtend(esize, p2)); - }; - - const auto [operand1, operand2] = get_operands(); - IR::U128 result = v.ir.VectorMultiply(doubled_esize, operand1, operand2); + return sign == Signedness::Signed + ? v.ir.VectorMultiplySignedWiden(esize, reg_n, reg_m) + : v.ir.VectorMultiplyUnsignedWiden(esize, reg_n, reg_m); + }(); if (behavior == MultiplyLongBehavior::Accumulate) { const IR::U128 addend = v.V(doubled_datasize, Vd); diff --git a/src/dynarmic/frontend/A64/translate/impl/simd_vector_x_indexed_element.cpp b/src/dynarmic/frontend/A64/translate/impl/simd_vector_x_indexed_element.cpp index 7f0625e8..07234fc6 100644 --- a/src/dynarmic/frontend/A64/translate/impl/simd_vector_x_indexed_element.cpp +++ b/src/dynarmic/frontend/A64/translate/impl/simd_vector_x_indexed_element.cpp @@ -166,23 +166,15 @@ bool MultiplyLong(TranslatorVisitor& v, bool Q, Imm<2> size, Imm<1> L, Imm<1> M, const size_t datasize = 64; const auto [index, Vm] = Combine(size, H, L, M, Vmlo); - const auto extend_operands = [&](const IR::U128& lhs, const IR::U128& rhs) { - if (sign == Signedness::Signed) { - return std::make_pair(v.ir.VectorSignExtend(esize, lhs), - v.ir.VectorSignExtend(esize, rhs)); - } - - return std::make_pair(v.ir.VectorZeroExtend(esize, lhs), - v.ir.VectorZeroExtend(esize, rhs)); - }; - const IR::U128 operand1 = v.Vpart(datasize, Vn, Q); const IR::U128 operand2 = v.V(idxsize, Vm); const IR::U128 index_vector = v.ir.VectorBroadcastElement(esize, operand2, index); const IR::U128 result = [&] { - const auto [extended_op1, extended_index] = extend_operands(operand1, index_vector); - const IR::U128 product = v.ir.VectorMultiply(2 * esize, extended_op1, extended_index); + const IR::U128 product = sign == Signedness::Signed + ? v.ir.VectorMultiplySignedWiden(esize, operand1, index_vector) + : v.ir.VectorMultiplyUnsignedWiden(esize, operand1, index_vector); + if (extra_behavior == ExtraBehavior::None) { return product; }