diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher/VEXTables.h b/FEXCore/Source/Interface/Core/OpcodeDispatcher/VEXTables.h index 5a34327f0a..14606221df 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher/VEXTables.h +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher/VEXTables.h @@ -3,32 +3,24 @@ #include "Interface/Core/OpcodeDispatcher.h" namespace FEXCore::IR { -consteval inline void VEXTable_Install(auto& FinalTable) { #define OPD(map_select, pp, opcode) (((map_select - 1) << 10) | (pp << 8) | (opcode)) - constexpr std::tuple Table[] = { - {OPD(2, 0b00, 0xF2), 1, &OpDispatchBuilder::ANDNBMIOp}, {OPD(2, 0b00, 0xF5), 1, &OpDispatchBuilder::BZHI}, - {OPD(2, 0b10, 0xF5), 1, &OpDispatchBuilder::PEXT}, {OPD(2, 0b11, 0xF5), 1, &OpDispatchBuilder::PDEP}, - {OPD(2, 0b11, 0xF6), 1, &OpDispatchBuilder::MULX}, {OPD(2, 0b00, 0xF7), 1, &OpDispatchBuilder::BEXTRBMIOp}, - {OPD(2, 0b01, 0xF7), 1, &OpDispatchBuilder::BMI2Shift}, {OPD(2, 0b10, 0xF7), 1, &OpDispatchBuilder::BMI2Shift}, - {OPD(2, 0b11, 0xF7), 1, &OpDispatchBuilder::BMI2Shift}, +constexpr std::tuple OpDispatch_VEXTable[] = { + {OPD(2, 0b00, 0xF2), 1, &OpDispatchBuilder::ANDNBMIOp}, {OPD(2, 0b00, 0xF5), 1, &OpDispatchBuilder::BZHI}, + {OPD(2, 0b10, 0xF5), 1, &OpDispatchBuilder::PEXT}, {OPD(2, 0b11, 0xF5), 1, &OpDispatchBuilder::PDEP}, + {OPD(2, 0b11, 0xF6), 1, &OpDispatchBuilder::MULX}, {OPD(2, 0b00, 0xF7), 1, &OpDispatchBuilder::BEXTRBMIOp}, + {OPD(2, 0b01, 0xF7), 1, &OpDispatchBuilder::BMI2Shift}, {OPD(2, 0b10, 0xF7), 1, &OpDispatchBuilder::BMI2Shift}, + {OPD(2, 0b11, 0xF7), 1, &OpDispatchBuilder::BMI2Shift}, - {OPD(3, 0b11, 0xF0), 1, &OpDispatchBuilder::RORX}, - }; + {OPD(3, 0b11, 0xF0), 1, &OpDispatchBuilder::RORX}, +}; #undef OPD - InstallToTable(FinalTable, Table); -} - -consteval inline void VEXGroupTable_Install(auto& FinalTable) { #define OPD(group, pp, opcode) (((group - X86Tables::InstType::TYPE_VEX_GROUP_12) << 4) | (pp << 3) | (opcode)) - constexpr std::tuple Table[] = { - {OPD(X86Tables::InstType::TYPE_VEX_GROUP_17, 0, 0b001), 1, &OpDispatchBuilder::BLSRBMIOp}, - {OPD(X86Tables::InstType::TYPE_VEX_GROUP_17, 0, 0b010), 1, &OpDispatchBuilder::BLSMSKBMIOp}, - {OPD(X86Tables::InstType::TYPE_VEX_GROUP_17, 0, 0b011), 1, &OpDispatchBuilder::BLSIBMIOp}, - }; +constexpr std::tuple OpDispatch_VEXGroupTable[] = { + {OPD(X86Tables::InstType::TYPE_VEX_GROUP_17, 0, 0b001), 1, &OpDispatchBuilder::BLSRBMIOp}, + {OPD(X86Tables::InstType::TYPE_VEX_GROUP_17, 0, 0b010), 1, &OpDispatchBuilder::BLSMSKBMIOp}, + {OPD(X86Tables::InstType::TYPE_VEX_GROUP_17, 0, 0b011), 1, &OpDispatchBuilder::BLSIBMIOp}, +}; #undef OPD - InstallToTable(FinalTable, Table); -} - } // namespace FEXCore::IR diff --git a/FEXCore/Source/Interface/Core/X86Tables/VEXTables.cpp b/FEXCore/Source/Interface/Core/X86Tables/VEXTables.cpp index c7246216a4..e31817c330 100644 --- a/FEXCore/Source/Interface/Core/X86Tables/VEXTables.cpp +++ b/FEXCore/Source/Interface/Core/X86Tables/VEXTables.cpp @@ -491,7 +491,7 @@ std::array VEXTableOps = []() consteval { GenerateTable(&Table.at(0), VEXTable, std::size(VEXTable)); - FEXCore::IR::VEXTable_Install(Table); + IR::InstallToTable(Table, IR::OpDispatch_VEXTable); return Table; }(); @@ -524,7 +524,7 @@ std::array VEXTableGroupOps = []() conste GenerateTable(&Table.at(0), VEXGroupTable, std::size(VEXGroupTable)); - FEXCore::IR::VEXGroupTable_Install(Table); + IR::InstallToTable(Table, IR::OpDispatch_VEXGroupTable); return Table; }(); }