From 7a66224d9a301a1292576c7f133febcac2bb6415 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 25 Jan 2018 21:28:03 -0500 Subject: [PATCH] A64: Implement EOR3 and BCAX --- src/CMakeLists.txt | 1 + src/frontend/A64/decoder/a64.inc | 4 +-- .../impl/simd_crypto_four_register.cpp | 33 +++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 src/frontend/A64/translate/impl/simd_crypto_four_register.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a0c21af8..b358319f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -97,6 +97,7 @@ add_library(dynarmic frontend/A64/translate/impl/move_wide.cpp frontend/A64/translate/impl/simd_aes.cpp frontend/A64/translate/impl/simd_copy.cpp + frontend/A64/translate/impl/simd_crypto_four_register.cpp frontend/A64/translate/impl/simd_modified_immediate.cpp frontend/A64/translate/impl/simd_permute.cpp frontend/A64/translate/impl/simd_scalar_pairwise.cpp diff --git a/src/frontend/A64/decoder/a64.inc b/src/frontend/A64/decoder/a64.inc index ca2125be..6eb38953 100644 --- a/src/frontend/A64/decoder/a64.inc +++ b/src/frontend/A64/decoder/a64.inc @@ -865,8 +865,8 @@ INST(USHLL, "USHLL, USHLL2", "0Q101 //INST(SM4EKEY, "SM4EKEY", "11001110011mmmmm110010nnnnnddddd") // Data Processing - FP and SIMD - Cryptographic four register -//INST(EOR3, "EOR3", "11001110000mmmmm0aaaaannnnnddddd") -//INST(BCAX, "BCAX", "11001110001mmmmm0aaaaannnnnddddd") +INST(EOR3, "EOR3", "11001110000mmmmm0aaaaannnnnddddd") +INST(BCAX, "BCAX", "11001110001mmmmm0aaaaannnnnddddd") //INST(SM3SS1, "SM3SS1", "11001110010mmmmm0aaaaannnnnddddd") // Data Processing - FP and SIMD - SHA512 two register diff --git a/src/frontend/A64/translate/impl/simd_crypto_four_register.cpp b/src/frontend/A64/translate/impl/simd_crypto_four_register.cpp new file mode 100644 index 00000000..bdfb1787 --- /dev/null +++ b/src/frontend/A64/translate/impl/simd_crypto_four_register.cpp @@ -0,0 +1,33 @@ +/* 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::EOR3(Vec Vm, Vec Va, Vec Vn, Vec Vd) { + const IR::U128 a = ir.GetQ(Va); + const IR::U128 m = ir.GetQ(Vm); + const IR::U128 n = ir.GetQ(Vn); + + const IR::U128 result = ir.VectorEor(ir.VectorEor(n, m), a); + + ir.SetQ(Vd, result); + return true; +} + +bool TranslatorVisitor::BCAX(Vec Vm, Vec Va, Vec Vn, Vec Vd) { + const IR::U128 a = ir.GetQ(Va); + const IR::U128 m = ir.GetQ(Vm); + const IR::U128 n = ir.GetQ(Vn); + + const IR::U128 result = ir.VectorEor(n, ir.VectorAnd(m, ir.VectorNot(a))); + + ir.SetQ(Vd, result); + return true; +} + +} // namespace Dynarmic::A64