From 3576c02d918c973a1acae9c3841a9063af407599 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 15 May 2018 10:50:28 -0400 Subject: [PATCH] A64: Implement SMLSL{2} --- src/frontend/A64/decoder/a64.inc | 2 +- .../A64/translate/impl/simd_three_different.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/frontend/A64/decoder/a64.inc b/src/frontend/A64/decoder/a64.inc index 93fcae32..65f4751f 100644 --- a/src/frontend/A64/decoder/a64.inc +++ b/src/frontend/A64/decoder/a64.inc @@ -685,7 +685,7 @@ INST(SABAL, "SABAL, SABAL2", "0Q001 INST(SUBHN, "SUBHN, SUBHN2", "0Q001110zz1mmmmm011000nnnnnddddd") INST(SABDL, "SABDL, SABDL2", "0Q001110zz1mmmmm011100nnnnnddddd") INST(SMLAL_vec, "SMLAL, SMLAL2 (vector)", "0Q001110zz1mmmmm100000nnnnnddddd") -//INST(SMLSL_vec, "SMLSL, SMLSL2 (vector)", "0Q001110zz1mmmmm101000nnnnnddddd") +INST(SMLSL_vec, "SMLSL, SMLSL2 (vector)", "0Q001110zz1mmmmm101000nnnnnddddd") INST(SMULL_vec, "SMULL, SMULL2 (vector)", "0Q001110zz1mmmmm110000nnnnnddddd") //INST(PMULL, "PMULL, PMULL2", "0Q001110zz1mmmmm111000nnnnnddddd") INST(UADDL, "UADDL, UADDL2", "0Q101110zz1mmmmm000000nnnnnddddd") diff --git a/src/frontend/A64/translate/impl/simd_three_different.cpp b/src/frontend/A64/translate/impl/simd_three_different.cpp index 2fbe6f93..51a35323 100644 --- a/src/frontend/A64/translate/impl/simd_three_different.cpp +++ b/src/frontend/A64/translate/impl/simd_three_different.cpp @@ -39,6 +39,7 @@ void AbsoluteDifferenceLong(TranslatorVisitor& v, bool Q, Imm<2> size, Vec Vm, V enum class MultiplyLongBehavior { None, Accumulate, + Subtract }; void MultiplyLong(TranslatorVisitor& v, bool Q, Imm<2> size, Vec Vm, Vec Vn, Vec Vd, @@ -55,6 +56,9 @@ void MultiplyLong(TranslatorVisitor& v, bool Q, Imm<2> size, Vec Vm, Vec Vn, Vec if (behavior == MultiplyLongBehavior::Accumulate) { const IR::U128 addend = v.V(doubled_datasize, Vd); result = v.ir.VectorAdd(doubled_esize, addend, result); + } else if (behavior == MultiplyLongBehavior::Subtract) { + const IR::U128 minuend = v.V(doubled_datasize, Vd); + result = v.ir.VectorSub(doubled_esize, minuend, result); } v.V(doubled_datasize, Vd, result); @@ -120,6 +124,15 @@ bool TranslatorVisitor::SMLAL_vec(bool Q, Imm<2> size, Vec Vm, Vec Vn, Vec Vd) { return true; } +bool TranslatorVisitor::SMLSL_vec(bool Q, Imm<2> size, Vec Vm, Vec Vn, Vec Vd) { + if (size == 0b11) { + return ReservedValue(); + } + + MultiplyLong(*this, Q, size, Vm, Vn, Vd, MultiplyLongBehavior::Subtract); + return true; +} + bool TranslatorVisitor::SMULL_vec(bool Q, Imm<2> size, Vec Vm, Vec Vn, Vec Vd) { if (size == 0b11) { return ReservedValue();