From bd2b4158504ba7b9b1da1f9d482e296eb605635b Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sun, 18 Feb 2018 23:55:38 +0000 Subject: [PATCH] A64: Implement ADDP (scalar) --- src/CMakeLists.txt | 1 + src/frontend/A64/decoder/a64.inc | 2 +- .../translate/impl/simd_scalar_pairwise.cpp | 25 +++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/frontend/A64/translate/impl/simd_scalar_pairwise.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c195f972..909dd394 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -98,6 +98,7 @@ add_library(dynarmic frontend/A64/translate/impl/simd_copy.cpp frontend/A64/translate/impl/simd_modified_immediate.cpp frontend/A64/translate/impl/simd_permute.cpp + frontend/A64/translate/impl/simd_scalar_pairwise.cpp frontend/A64/translate/impl/simd_scalar_three_same.cpp frontend/A64/translate/impl/simd_shift_by_immediate.cpp frontend/A64/translate/impl/simd_three_same.cpp diff --git a/src/frontend/A64/decoder/a64.inc b/src/frontend/A64/decoder/a64.inc index 90b60489..e280b88f 100644 --- a/src/frontend/A64/decoder/a64.inc +++ b/src/frontend/A64/decoder/a64.inc @@ -422,7 +422,7 @@ INST(DUP_elt_1, "DUP (element)", "01011 //INST(FCVTXN_1, "FCVTXN, FCVTXN2", "011111100z100001011010nnnnnddddd") // Data Processing - FP and SIMD - SIMD Scalar pairwise -//INST(ADDP_pair, "ADDP (scalar)", "01011110zz110001101110nnnnnddddd") +INST(ADDP_pair, "ADDP (scalar)", "01011110zz110001101110nnnnnddddd") //INST(FMAXNMP_pair_1, "FMAXNMP (scalar)", "0101111000110000110010nnnnnddddd") //INST(FMAXNMP_pair_2, "FMAXNMP (scalar)", "011111100z110000110010nnnnnddddd") //INST(FADDP_pair_1, "FADDP (scalar)", "0101111000110000110110nnnnnddddd") diff --git a/src/frontend/A64/translate/impl/simd_scalar_pairwise.cpp b/src/frontend/A64/translate/impl/simd_scalar_pairwise.cpp new file mode 100644 index 00000000..aa7dae0d --- /dev/null +++ b/src/frontend/A64/translate/impl/simd_scalar_pairwise.cpp @@ -0,0 +1,25 @@ +/* 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 { +namespace A64 { + +bool TranslatorVisitor::ADDP_pair(Imm<2> size, Vec Vn, Vec Vd) { + if (size != 0b11) { + return ReservedValue(); + } + + const IR::U64 operand1 = ir.VectorGetElement(64, V(128, Vn), 0); + const IR::U64 operand2 = ir.VectorGetElement(64, V(128, Vn), 1); + const IR::U128 result = ir.ZeroExtendToQuad(ir.Add(operand1, operand2)); + V(128, Vd, result); + return true; +} + +} // namespace A64 +} // namespace Dynarmic