From cda75e207985ca921a6bd1814d62e7d3a76c4641 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 27 Apr 2018 08:33:11 -0400 Subject: [PATCH] A64: Implement CMTST's scalar variant --- src/frontend/A64/decoder/a64.inc | 2 +- .../A64/translate/impl/simd_scalar_three_same.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/frontend/A64/decoder/a64.inc b/src/frontend/A64/decoder/a64.inc index e2f18c44..0e776fb9 100644 --- a/src/frontend/A64/decoder/a64.inc +++ b/src/frontend/A64/decoder/a64.inc @@ -452,7 +452,7 @@ INST(CMGE_reg_1, "CMGE (register)", "01011 //INST(SRSHL_1, "SRSHL", "01011110zz1mmmmm010101nnnnnddddd") //INST(SQRSHL_1, "SQRSHL", "01011110zz1mmmmm010111nnnnnddddd") INST(ADD_1, "ADD (vector)", "01011110zz1mmmmm100001nnnnnddddd") -//INST(CMTST_1, "CMTST", "01011110zz1mmmmm100011nnnnnddddd") +INST(CMTST_1, "CMTST", "01011110zz1mmmmm100011nnnnnddddd") //INST(SQDMULH_vec_1, "SQDMULH (vector)", "01011110zz1mmmmm101101nnnnnddddd") //INST(UQADD_1, "UQADD", "01111110zz1mmmmm000011nnnnnddddd") //INST(UQSUB_1, "UQSUB", "01111110zz1mmmmm001011nnnnnddddd") diff --git a/src/frontend/A64/translate/impl/simd_scalar_three_same.cpp b/src/frontend/A64/translate/impl/simd_scalar_three_same.cpp index 7a132c0c..187a2c3f 100644 --- a/src/frontend/A64/translate/impl/simd_scalar_three_same.cpp +++ b/src/frontend/A64/translate/impl/simd_scalar_three_same.cpp @@ -116,6 +116,20 @@ bool TranslatorVisitor::CMHS_1(Imm<2> size, Vec Vm, Vec Vn, Vec Vd) { return ScalarCompare(*this, size, Vm, Vn, Vd, ComparisonType::HS, ComparisonVariant::Register); } +bool TranslatorVisitor::CMTST_1(Imm<2> size, Vec Vm, Vec Vn, Vec Vd) { + if (size != 0b11) { + return ReservedValue(); + } + + const IR::U128 operand1 = V(64, Vn); + const IR::U128 operand2 = V(64, Vm); + const IR::U128 anded = ir.VectorAnd(operand1, operand2); + const IR::U128 result = ir.VectorNot(ir.VectorEqual(64, anded, ir.ZeroVector())); + + V(64, Vd, result); + return true; +} + bool TranslatorVisitor::SUB_1(Imm<2> size, Vec Vm, Vec Vn, Vec Vd) { if (size != 0b11) { return ReservedValue();