diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ab4f275b..6a7c0b77 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -62,6 +62,7 @@ add_library(dynarmic frontend/A64/translate/impl/branch.cpp frontend/A64/translate/impl/data_processing_addsub.cpp frontend/A64/translate/impl/data_processing_bitfield.cpp + frontend/A64/translate/impl/data_processing_conditional_select.cpp frontend/A64/translate/impl/data_processing_logical.cpp frontend/A64/translate/impl/data_processing_pcrel.cpp frontend/A64/translate/impl/exception_generating.cpp diff --git a/src/frontend/A64/decoder/a64.inc b/src/frontend/A64/decoder/a64.inc index c3eeae37..f2580158 100644 --- a/src/frontend/A64/decoder/a64.inc +++ b/src/frontend/A64/decoder/a64.inc @@ -331,7 +331,7 @@ INST(SBCS, "SBCS", "z1111 //INST(CCMP_imm, "CCMP (immediate)", "z1111010010iiiiicccc10nnnnn0ffff") // Data Processing - Register - Conditional select -//INST(CSEL, "CSEL", "z0011010100mmmmmcccc00nnnnnddddd") +INST(CSEL, "CSEL", "z0011010100mmmmmcccc00nnnnnddddd") //INST(CSINC, "CSINC", "z0011010100mmmmmcccc01nnnnnddddd") //INST(CSINV, "CSINV", "z1011010100mmmmmcccc00nnnnnddddd") //INST(CSNEG, "CSNEG", "z1011010100mmmmmcccc01nnnnnddddd") diff --git a/src/frontend/A64/translate/impl/data_processing_conditional_select.cpp b/src/frontend/A64/translate/impl/data_processing_conditional_select.cpp new file mode 100644 index 00000000..9179ea58 --- /dev/null +++ b/src/frontend/A64/translate/impl/data_processing_conditional_select.cpp @@ -0,0 +1,26 @@ +/* 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::CSEL(bool sf, Reg Rm, Cond cond, Reg Rn, Reg Rd) { + size_t datasize = sf ? 64 : 32; + + IR::U32U64 operand1 = X(datasize, Rn); + IR::U32U64 operand2 = X(datasize, Rm); + + IR::U32U64 result = ir.ConditionalSelect(cond, operand1, operand2); + + X(datasize, Rd, result); + + return true; +} + +} // namespace A64 +} // namespace Dynarmic