diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp b/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp index 705d24764..4467eabeb 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp @@ -5042,11 +5042,11 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(1, 0b00, 0x13), 1, &OpDispatchBuilder::VMOVLPOp}, {OPD(1, 0b01, 0x13), 1, &OpDispatchBuilder::VMOVLPOp}, - {OPD(1, 0b00, 0x14), 1, &OpDispatchBuilder::VPUNPCKLOp<4>}, - {OPD(1, 0b01, 0x14), 1, &OpDispatchBuilder::VPUNPCKLOp<8>}, + {OPD(1, 0b00, 0x14), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPUNPCKLOp, 4>}, + {OPD(1, 0b01, 0x14), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPUNPCKLOp, 8>}, - {OPD(1, 0b00, 0x15), 1, &OpDispatchBuilder::VPUNPCKHOp<4>}, - {OPD(1, 0b01, 0x15), 1, &OpDispatchBuilder::VPUNPCKHOp<8>}, + {OPD(1, 0b00, 0x15), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPUNPCKHOp, 4>}, + {OPD(1, 0b01, 0x15), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPUNPCKHOp, 8>}, {OPD(1, 0b00, 0x16), 1, &OpDispatchBuilder::VMOVHPOp}, {OPD(1, 0b01, 0x16), 1, &OpDispatchBuilder::VMOVHPOp}, @@ -5076,8 +5076,8 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(1, 0b00, 0x2F), 1, &OpDispatchBuilder::UCOMISxOp<4>}, {OPD(1, 0b01, 0x2F), 1, &OpDispatchBuilder::UCOMISxOp<8>}, - {OPD(1, 0b00, 0x50), 1, &OpDispatchBuilder::MOVMSKOp<4>}, - {OPD(1, 0b01, 0x50), 1, &OpDispatchBuilder::MOVMSKOp<8>}, + {OPD(1, 0b00, 0x50), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::MOVMSKOp, 4>}, + {OPD(1, 0b01, 0x50), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::MOVMSKOp, 8>}, {OPD(1, 0b00, 0x51), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorUnaryOp, IR::OP_VFSQRT, 4>}, {OPD(1, 0b01, 0x51), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorUnaryOp, IR::OP_VFSQRT, 8>}, @@ -5141,28 +5141,28 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(1, 0b10, 0x5F), 1, &OpDispatchBuilder::AVXVectorScalarInsertALUOp}, {OPD(1, 0b11, 0x5F), 1, &OpDispatchBuilder::AVXVectorScalarInsertALUOp}, - {OPD(1, 0b01, 0x60), 1, &OpDispatchBuilder::VPUNPCKLOp<1>}, - {OPD(1, 0b01, 0x61), 1, &OpDispatchBuilder::VPUNPCKLOp<2>}, - {OPD(1, 0b01, 0x62), 1, &OpDispatchBuilder::VPUNPCKLOp<4>}, - {OPD(1, 0b01, 0x63), 1, &OpDispatchBuilder::VPACKSSOp<2>}, + {OPD(1, 0b01, 0x60), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPUNPCKLOp, 1>}, + {OPD(1, 0b01, 0x61), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPUNPCKLOp, 2>}, + {OPD(1, 0b01, 0x62), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPUNPCKLOp, 4>}, + {OPD(1, 0b01, 0x63), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPACKSSOp, 2>}, {OPD(1, 0b01, 0x64), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorALUOp, IR::OP_VCMPGT, 1>}, {OPD(1, 0b01, 0x65), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorALUOp, IR::OP_VCMPGT, 2>}, {OPD(1, 0b01, 0x66), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorALUOp, IR::OP_VCMPGT, 4>}, - {OPD(1, 0b01, 0x67), 1, &OpDispatchBuilder::VPACKUSOp<2>}, - {OPD(1, 0b01, 0x68), 1, &OpDispatchBuilder::VPUNPCKHOp<1>}, - {OPD(1, 0b01, 0x69), 1, &OpDispatchBuilder::VPUNPCKHOp<2>}, - {OPD(1, 0b01, 0x6A), 1, &OpDispatchBuilder::VPUNPCKHOp<4>}, - {OPD(1, 0b01, 0x6B), 1, &OpDispatchBuilder::VPACKSSOp<4>}, - {OPD(1, 0b01, 0x6C), 1, &OpDispatchBuilder::VPUNPCKLOp<8>}, - {OPD(1, 0b01, 0x6D), 1, &OpDispatchBuilder::VPUNPCKHOp<8>}, + {OPD(1, 0b01, 0x67), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPACKUSOp, 2>}, + {OPD(1, 0b01, 0x68), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPUNPCKHOp, 1>}, + {OPD(1, 0b01, 0x69), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPUNPCKHOp, 2>}, + {OPD(1, 0b01, 0x6A), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPUNPCKHOp, 4>}, + {OPD(1, 0b01, 0x6B), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPACKSSOp, 4>}, + {OPD(1, 0b01, 0x6C), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPUNPCKLOp, 8>}, + {OPD(1, 0b01, 0x6D), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPUNPCKHOp, 8>}, {OPD(1, 0b01, 0x6E), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::MOVBetweenGPR_FPR, OpDispatchBuilder::VectorOpType::AVX>}, {OPD(1, 0b01, 0x6F), 1, &OpDispatchBuilder::VMOVAPS_VMOVAPDOp}, {OPD(1, 0b10, 0x6F), 1, &OpDispatchBuilder::VMOVUPS_VMOVUPDOp}, - {OPD(1, 0b01, 0x70), 1, &OpDispatchBuilder::VPSHUFWOp<4, true>}, - {OPD(1, 0b10, 0x70), 1, &OpDispatchBuilder::VPSHUFWOp<2, false>}, - {OPD(1, 0b11, 0x70), 1, &OpDispatchBuilder::VPSHUFWOp<2, true>}, + {OPD(1, 0b01, 0x70), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSHUFWOp, 4, true>}, + {OPD(1, 0b10, 0x70), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSHUFWOp, 2, false>}, + {OPD(1, 0b11, 0x70), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSHUFWOp, 2, true>}, {OPD(1, 0b01, 0x74), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorALUOp, IR::OP_VCMPEQ, 1>}, {OPD(1, 0b01, 0x75), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorALUOp, IR::OP_VCMPEQ, 2>}, @@ -5172,8 +5172,8 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(1, 0b01, 0x7C), 1, &OpDispatchBuilder::VHADDPOp}, {OPD(1, 0b11, 0x7C), 1, &OpDispatchBuilder::VHADDPOp}, - {OPD(1, 0b01, 0x7D), 1, &OpDispatchBuilder::VHSUBPOp<8>}, - {OPD(1, 0b11, 0x7D), 1, &OpDispatchBuilder::VHSUBPOp<4>}, + {OPD(1, 0b01, 0x7D), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VHSUBPOp, 8>}, + {OPD(1, 0b11, 0x7D), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VHSUBPOp, 4>}, {OPD(1, 0b01, 0x7E), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::MOVBetweenGPR_FPR, OpDispatchBuilder::VectorOpType::AVX>}, {OPD(1, 0b10, 0x7E), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::MOVQOp, OpDispatchBuilder::VectorOpType::AVX>}, @@ -5187,17 +5187,17 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(1, 0b11, 0xC2), 1, &OpDispatchBuilder::AVXInsertScalarFCMPOp<8>}, {OPD(1, 0b01, 0xC4), 1, &OpDispatchBuilder::VPINSRWOp}, - {OPD(1, 0b01, 0xC5), 1, &OpDispatchBuilder::PExtrOp<2>}, + {OPD(1, 0b01, 0xC5), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PExtrOp, 2>}, - {OPD(1, 0b00, 0xC6), 1, &OpDispatchBuilder::VSHUFOp<4>}, - {OPD(1, 0b01, 0xC6), 1, &OpDispatchBuilder::VSHUFOp<8>}, + {OPD(1, 0b00, 0xC6), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VSHUFOp, 4>}, + {OPD(1, 0b01, 0xC6), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VSHUFOp, 8>}, {OPD(1, 0b01, 0xD0), 1, &OpDispatchBuilder::VADDSUBPOp<8>}, {OPD(1, 0b11, 0xD0), 1, &OpDispatchBuilder::VADDSUBPOp<4>}, - {OPD(1, 0b01, 0xD1), 1, &OpDispatchBuilder::VPSRLDOp<2>}, - {OPD(1, 0b01, 0xD2), 1, &OpDispatchBuilder::VPSRLDOp<4>}, - {OPD(1, 0b01, 0xD3), 1, &OpDispatchBuilder::VPSRLDOp<8>}, + {OPD(1, 0b01, 0xD1), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSRLDOp, 2>}, + {OPD(1, 0b01, 0xD2), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSRLDOp, 4>}, + {OPD(1, 0b01, 0xD3), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSRLDOp, 8>}, {OPD(1, 0b01, 0xD4), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorALUOp, IR::OP_VADD, 8>}, {OPD(1, 0b01, 0xD5), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorALUOp, IR::OP_VMUL, 2>}, {OPD(1, 0b01, 0xD6), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::MOVQOp, OpDispatchBuilder::VectorOpType::AVX>}, @@ -5213,8 +5213,8 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(1, 0b01, 0xDF), 1, &OpDispatchBuilder::VANDNOp}, {OPD(1, 0b01, 0xE0), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorALUOp, IR::OP_VURAVG, 1>}, - {OPD(1, 0b01, 0xE1), 1, &OpDispatchBuilder::VPSRAOp<2>}, - {OPD(1, 0b01, 0xE2), 1, &OpDispatchBuilder::VPSRAOp<4>}, + {OPD(1, 0b01, 0xE1), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSRAOp, 2>}, + {OPD(1, 0b01, 0xE2), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSRAOp, 4>}, {OPD(1, 0b01, 0xE3), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorALUOp, IR::OP_VURAVG, 2>}, {OPD(1, 0b01, 0xE4), 1, &OpDispatchBuilder::VPMULHWOp}, {OPD(1, 0b01, 0xE5), 1, &OpDispatchBuilder::VPMULHWOp}, @@ -5235,9 +5235,9 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(1, 0b01, 0xEF), 1, &OpDispatchBuilder::AVXVectorXOROp}, {OPD(1, 0b11, 0xF0), 1, &OpDispatchBuilder::MOVVectorUnalignedOp}, - {OPD(1, 0b01, 0xF1), 1, &OpDispatchBuilder::VPSLLOp<2>}, - {OPD(1, 0b01, 0xF2), 1, &OpDispatchBuilder::VPSLLOp<4>}, - {OPD(1, 0b01, 0xF3), 1, &OpDispatchBuilder::VPSLLOp<8>}, + {OPD(1, 0b01, 0xF1), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSLLOp, 2>}, + {OPD(1, 0b01, 0xF2), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSLLOp, 4>}, + {OPD(1, 0b01, 0xF3), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSLLOp, 8>}, {OPD(1, 0b01, 0xF4), 1, &OpDispatchBuilder::VPMULLOp<4, false>}, {OPD(1, 0b01, 0xF5), 1, &OpDispatchBuilder::VPMADDWDOp}, {OPD(1, 0b01, 0xF6), 1, &OpDispatchBuilder::VPSADBWOp}, @@ -5257,8 +5257,8 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(2, 0b01, 0x03), 1, &OpDispatchBuilder::VPHADDSWOp}, {OPD(2, 0b01, 0x04), 1, &OpDispatchBuilder::VPMADDUBSWOp}, - {OPD(2, 0b01, 0x05), 1, &OpDispatchBuilder::VPHSUBOp<2>}, - {OPD(2, 0b01, 0x06), 1, &OpDispatchBuilder::VPHSUBOp<4>}, + {OPD(2, 0b01, 0x05), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPHSUBOp, 2>}, + {OPD(2, 0b01, 0x06), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPHSUBOp, 4>}, {OPD(2, 0b01, 0x07), 1, &OpDispatchBuilder::VPHSUBSWOp}, {OPD(2, 0b01, 0x08), 1, &OpDispatchBuilder::VPSIGN<1>}, @@ -5273,9 +5273,9 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(2, 0b01, 0x13), 1, &OpDispatchBuilder::VCVTPH2PSOp}, {OPD(2, 0b01, 0x16), 1, &OpDispatchBuilder::VPERMDOp}, {OPD(2, 0b01, 0x17), 1, &OpDispatchBuilder::PTestOp}, - {OPD(2, 0b01, 0x18), 1, &OpDispatchBuilder::VBROADCASTOp<4>}, - {OPD(2, 0b01, 0x19), 1, &OpDispatchBuilder::VBROADCASTOp<8>}, - {OPD(2, 0b01, 0x1A), 1, &OpDispatchBuilder::VBROADCASTOp<16>}, + {OPD(2, 0b01, 0x18), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VBROADCASTOp, 4>}, + {OPD(2, 0b01, 0x19), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VBROADCASTOp, 8>}, + {OPD(2, 0b01, 0x1A), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VBROADCASTOp, 16>}, {OPD(2, 0b01, 0x1C), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorUnaryOp, IR::OP_VABS, 1>}, {OPD(2, 0b01, 0x1D), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorUnaryOp, IR::OP_VABS, 2>}, {OPD(2, 0b01, 0x1E), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorUnaryOp, IR::OP_VABS, 4>}, @@ -5290,7 +5290,7 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(2, 0b01, 0x28), 1, &OpDispatchBuilder::VPMULLOp<4, true>}, {OPD(2, 0b01, 0x29), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorALUOp, IR::OP_VCMPEQ, 8>}, {OPD(2, 0b01, 0x2A), 1, &OpDispatchBuilder::MOVVectorNTOp}, - {OPD(2, 0b01, 0x2B), 1, &OpDispatchBuilder::VPACKUSOp<4>}, + {OPD(2, 0b01, 0x2B), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPACKUSOp, 4>}, {OPD(2, 0b01, 0x2C), 1, &OpDispatchBuilder::VMASKMOVOp<4, false>}, {OPD(2, 0b01, 0x2D), 1, &OpDispatchBuilder::VMASKMOVOp<8, false>}, {OPD(2, 0b01, 0x2E), 1, &OpDispatchBuilder::VMASKMOVOp<4, true>}, @@ -5320,12 +5320,12 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(2, 0b01, 0x46), 1, &OpDispatchBuilder::VPSRAVDOp}, {OPD(2, 0b01, 0x47), 1, &OpDispatchBuilder::VPSLLVOp}, - {OPD(2, 0b01, 0x58), 1, &OpDispatchBuilder::VBROADCASTOp<4>}, - {OPD(2, 0b01, 0x59), 1, &OpDispatchBuilder::VBROADCASTOp<8>}, - {OPD(2, 0b01, 0x5A), 1, &OpDispatchBuilder::VBROADCASTOp<16>}, + {OPD(2, 0b01, 0x58), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VBROADCASTOp, 4>}, + {OPD(2, 0b01, 0x59), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VBROADCASTOp, 8>}, + {OPD(2, 0b01, 0x5A), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VBROADCASTOp, 16>}, - {OPD(2, 0b01, 0x78), 1, &OpDispatchBuilder::VBROADCASTOp<1>}, - {OPD(2, 0b01, 0x79), 1, &OpDispatchBuilder::VBROADCASTOp<2>}, + {OPD(2, 0b01, 0x78), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VBROADCASTOp, 1>}, + {OPD(2, 0b01, 0x79), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VBROADCASTOp, 2>}, {OPD(2, 0b01, 0x8C), 1, &OpDispatchBuilder::VPMASKMOVOp}, {OPD(2, 0b01, 0x8E), 1, &OpDispatchBuilder::VPMASKMOVOp}, @@ -5380,8 +5380,8 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(3, 0b01, 0x00), 1, &OpDispatchBuilder::VPERMQOp}, {OPD(3, 0b01, 0x01), 1, &OpDispatchBuilder::VPERMQOp}, {OPD(3, 0b01, 0x02), 1, &OpDispatchBuilder::VPBLENDDOp}, - {OPD(3, 0b01, 0x04), 1, &OpDispatchBuilder::VPERMILImmOp<4>}, - {OPD(3, 0b01, 0x05), 1, &OpDispatchBuilder::VPERMILImmOp<8>}, + {OPD(3, 0b01, 0x04), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPERMILImmOp, 4>}, + {OPD(3, 0b01, 0x05), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPERMILImmOp, 8>}, {OPD(3, 0b01, 0x06), 1, &OpDispatchBuilder::VPERM2Op}, {OPD(3, 0b01, 0x08), 1, &OpDispatchBuilder::AVXVectorRound<4>}, {OPD(3, 0b01, 0x09), 1, &OpDispatchBuilder::AVXVectorRound<8>}, @@ -5392,10 +5392,10 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(3, 0b01, 0x0E), 1, &OpDispatchBuilder::VPBLENDWOp}, {OPD(3, 0b01, 0x0F), 1, &OpDispatchBuilder::VPALIGNROp}, - {OPD(3, 0b01, 0x14), 1, &OpDispatchBuilder::PExtrOp<1>}, - {OPD(3, 0b01, 0x15), 1, &OpDispatchBuilder::PExtrOp<2>}, - {OPD(3, 0b01, 0x16), 1, &OpDispatchBuilder::PExtrOp<4>}, - {OPD(3, 0b01, 0x17), 1, &OpDispatchBuilder::PExtrOp<4>}, + {OPD(3, 0b01, 0x14), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PExtrOp, 1>}, + {OPD(3, 0b01, 0x15), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PExtrOp, 2>}, + {OPD(3, 0b01, 0x16), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PExtrOp, 4>}, + {OPD(3, 0b01, 0x17), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PExtrOp, 4>}, {OPD(3, 0b01, 0x18), 1, &OpDispatchBuilder::VINSERTOp}, {OPD(3, 0b01, 0x19), 1, &OpDispatchBuilder::VEXTRACT128Op}, @@ -5413,9 +5413,9 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(3, 0b01, 0x46), 1, &OpDispatchBuilder::VPERM2Op}, - {OPD(3, 0b01, 0x4A), 1, &OpDispatchBuilder::AVXVectorVariableBlend<4>}, - {OPD(3, 0b01, 0x4B), 1, &OpDispatchBuilder::AVXVectorVariableBlend<8>}, - {OPD(3, 0b01, 0x4C), 1, &OpDispatchBuilder::AVXVectorVariableBlend<1>}, + {OPD(3, 0b01, 0x4A), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorVariableBlend, 4>}, + {OPD(3, 0b01, 0x4B), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorVariableBlend, 8>}, + {OPD(3, 0b01, 0x4C), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorVariableBlend, 1>}, {OPD(3, 0b01, 0x60), 1, &OpDispatchBuilder::VPCMPESTRMOp}, {OPD(3, 0b01, 0x61), 1, &OpDispatchBuilder::VPCMPESTRIOp}, @@ -5428,17 +5428,17 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { #define OPD(group, pp, opcode) (((group - X86Tables::TYPE_VEX_GROUP_12) << 4) | (pp << 3) | (opcode)) static constexpr std::tuple VEXTableGroupOps[] { - {OPD(X86Tables::TYPE_VEX_GROUP_12, 1, 0b010), 1, &OpDispatchBuilder::VPSRLIOp<2>}, - {OPD(X86Tables::TYPE_VEX_GROUP_12, 1, 0b110), 1, &OpDispatchBuilder::VPSLLIOp<2>}, - {OPD(X86Tables::TYPE_VEX_GROUP_12, 1, 0b100), 1, &OpDispatchBuilder::VPSRAIOp<2>}, + {OPD(X86Tables::TYPE_VEX_GROUP_12, 1, 0b010), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSRLIOp, 2>}, + {OPD(X86Tables::TYPE_VEX_GROUP_12, 1, 0b110), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSLLIOp, 2>}, + {OPD(X86Tables::TYPE_VEX_GROUP_12, 1, 0b100), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSRAIOp, 2>}, - {OPD(X86Tables::TYPE_VEX_GROUP_13, 1, 0b010), 1, &OpDispatchBuilder::VPSRLIOp<4>}, - {OPD(X86Tables::TYPE_VEX_GROUP_13, 1, 0b110), 1, &OpDispatchBuilder::VPSLLIOp<4>}, - {OPD(X86Tables::TYPE_VEX_GROUP_13, 1, 0b100), 1, &OpDispatchBuilder::VPSRAIOp<4>}, + {OPD(X86Tables::TYPE_VEX_GROUP_13, 1, 0b010), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSRLIOp, 4>}, + {OPD(X86Tables::TYPE_VEX_GROUP_13, 1, 0b110), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSLLIOp, 4>}, + {OPD(X86Tables::TYPE_VEX_GROUP_13, 1, 0b100), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSRAIOp, 4>}, - {OPD(X86Tables::TYPE_VEX_GROUP_14, 1, 0b010), 1, &OpDispatchBuilder::VPSRLIOp<8>}, + {OPD(X86Tables::TYPE_VEX_GROUP_14, 1, 0b010), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSRLIOp, 8>}, {OPD(X86Tables::TYPE_VEX_GROUP_14, 1, 0b011), 1, &OpDispatchBuilder::VPSRLDQOp}, - {OPD(X86Tables::TYPE_VEX_GROUP_14, 1, 0b110), 1, &OpDispatchBuilder::VPSLLIOp<8>}, + {OPD(X86Tables::TYPE_VEX_GROUP_14, 1, 0b110), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPSLLIOp, 8>}, {OPD(X86Tables::TYPE_VEX_GROUP_14, 1, 0b111), 1, &OpDispatchBuilder::VPSLLDQOp}, {OPD(X86Tables::TYPE_VEX_GROUP_15, 0, 0b010), 1, &OpDispatchBuilder::LDMXCSR}, @@ -5640,14 +5640,14 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {0xC0, 2, &OpDispatchBuilder::XADDOp}, {0xC3, 1, &OpDispatchBuilder::MOVGPRNTOp}, {0xC4, 1, &OpDispatchBuilder::PINSROp<2>}, - {0xC5, 1, &OpDispatchBuilder::PExtrOp<2>}, + {0xC5, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PExtrOp, 2>}, {0xC8, 8, &OpDispatchBuilder::BSWAPOp}, // SSE {0x10, 2, &OpDispatchBuilder::MOVVectorUnalignedOp}, {0x12, 2, &OpDispatchBuilder::MOVLPOp}, - {0x14, 1, &OpDispatchBuilder::PUNPCKLOp<4>}, - {0x15, 1, &OpDispatchBuilder::PUNPCKHOp<4>}, + {0x14, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKLOp, 4>}, + {0x15, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKHOp, 4>}, {0x16, 2, &OpDispatchBuilder::MOVHPDOp}, {0x28, 2, &OpDispatchBuilder::MOVVectorAlignedOp}, {0x2A, 1, &OpDispatchBuilder::InsertMMX_To_XMM_Vector_CVT_Int_To_Float}, @@ -5655,7 +5655,7 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {0x2C, 1, &OpDispatchBuilder::XMM_To_MMX_Vector_CVT_Float_To_Int<4, false, false>}, {0x2D, 1, &OpDispatchBuilder::XMM_To_MMX_Vector_CVT_Float_To_Int<4, false, true>}, {0x2E, 2, &OpDispatchBuilder::UCOMISxOp<4>}, - {0x50, 1, &OpDispatchBuilder::MOVMSKOp<4>}, + {0x50, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::MOVMSKOp, 4>}, {0x51, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorUnaryOp, IR::OP_VFSQRT, 4>}, {0x52, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorUnaryOp, IR::OP_VFRSQRT, 4>}, {0x53, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorUnaryOp, IR::OP_VFRECP, 4>}, @@ -5671,17 +5671,17 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {0x5D, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VFMIN, 4>}, {0x5E, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VFDIV, 4>}, {0x5F, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VFMAX, 4>}, - {0x60, 1, &OpDispatchBuilder::PUNPCKLOp<1>}, - {0x61, 1, &OpDispatchBuilder::PUNPCKLOp<2>}, - {0x62, 1, &OpDispatchBuilder::PUNPCKLOp<4>}, + {0x60, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKLOp, 1>}, + {0x61, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKLOp, 2>}, + {0x62, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKLOp, 4>}, {0x63, 1, &OpDispatchBuilder::PACKSSOp<2>}, {0x64, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VCMPGT, 1>}, {0x65, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VCMPGT, 2>}, {0x66, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VCMPGT, 4>}, {0x67, 1, &OpDispatchBuilder::PACKUSOp<2>}, - {0x68, 1, &OpDispatchBuilder::PUNPCKHOp<1>}, - {0x69, 1, &OpDispatchBuilder::PUNPCKHOp<2>}, - {0x6A, 1, &OpDispatchBuilder::PUNPCKHOp<4>}, + {0x68, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKHOp, 1>}, + {0x69, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKHOp, 2>}, + {0x6A, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKHOp, 4>}, {0x6B, 1, &OpDispatchBuilder::PACKSSOp<4>}, {0x70, 1, &OpDispatchBuilder::PSHUFW8ByteOp}, @@ -5691,11 +5691,11 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {0x77, 1, &OpDispatchBuilder::X87EMMS}, {0xC2, 1, &OpDispatchBuilder::VFCMPOp<4>}, - {0xC6, 1, &OpDispatchBuilder::SHUFOp<4>}, + {0xC6, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::SHUFOp, 4>}, - {0xD1, 1, &OpDispatchBuilder::PSRLDOp<2>}, - {0xD2, 1, &OpDispatchBuilder::PSRLDOp<4>}, - {0xD3, 1, &OpDispatchBuilder::PSRLDOp<8>}, + {0xD1, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRLDOp, 2>}, + {0xD2, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRLDOp, 4>}, + {0xD3, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRLDOp, 8>}, {0xD4, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VADD, 8>}, {0xD5, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VMUL, 2>}, {0xD7, 1, &OpDispatchBuilder::MOVMSKOpOne}, // PMOVMSKB @@ -5708,8 +5708,8 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {0xDE, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VUMAX, 1>}, {0xDF, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUROp, IR::OP_VANDN, 8>}, {0xE0, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VURAVG, 1>}, - {0xE1, 1, &OpDispatchBuilder::PSRAOp<2>}, - {0xE2, 1, &OpDispatchBuilder::PSRAOp<4>}, + {0xE1, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRAOp, 2>}, + {0xE2, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRAOp, 4>}, {0xE3, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VURAVG, 2>}, {0xE4, 1, &OpDispatchBuilder::PMULHW}, {0xE5, 1, &OpDispatchBuilder::PMULHW}, @@ -5723,9 +5723,9 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {0xEE, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VSMAX, 2>}, {0xEF, 1, &OpDispatchBuilder::VectorXOROp}, - {0xF1, 1, &OpDispatchBuilder::PSLL<2>}, - {0xF2, 1, &OpDispatchBuilder::PSLL<4>}, - {0xF3, 1, &OpDispatchBuilder::PSLL<8>}, + {0xF1, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSLL, 2>}, + {0xF2, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSLL, 4>}, + {0xF3, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSLL, 8>}, {0xF4, 1, &OpDispatchBuilder::PMULLOp<4, false>}, {0xF5, 1, &OpDispatchBuilder::PMADDWD}, {0xF6, 1, &OpDispatchBuilder::PSADBW}, @@ -5893,7 +5893,7 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {0x5E, 1, &OpDispatchBuilder::VectorScalarInsertALUOp}, {0x5F, 1, &OpDispatchBuilder::VectorScalarInsertALUOp}, {0x6F, 1, &OpDispatchBuilder::MOVVectorUnalignedOp}, - {0x70, 1, &OpDispatchBuilder::PSHUFWOp}, + {0x70, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSHUFWOp, false>}, {0x7E, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::MOVQOp, OpDispatchBuilder::VectorOpType::SSE>}, {0x7F, 1, &OpDispatchBuilder::MOVVectorUnalignedOp}, {0xB8, 1, &OpDispatchBuilder::PopcountOp}, @@ -5921,7 +5921,7 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {0x5D, 1, &OpDispatchBuilder::VectorScalarInsertALUOp}, {0x5E, 1, &OpDispatchBuilder::VectorScalarInsertALUOp}, {0x5F, 1, &OpDispatchBuilder::VectorScalarInsertALUOp}, - {0x70, 1, &OpDispatchBuilder::PSHUFWOp}, + {0x70, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSHUFWOp, true>}, {0x7C, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VFADDP, 4>}, {0x7D, 1, &OpDispatchBuilder::HSUBP<4>}, {0xD0, 1, &OpDispatchBuilder::ADDSUBPOp<4>}, @@ -5934,8 +5934,8 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { constexpr std::tuple OpSizeModOpTable[] = { {0x10, 2, &OpDispatchBuilder::MOVVectorUnalignedOp}, {0x12, 2, &OpDispatchBuilder::MOVLPOp}, - {0x14, 1, &OpDispatchBuilder::PUNPCKLOp<8>}, - {0x15, 1, &OpDispatchBuilder::PUNPCKHOp<8>}, + {0x14, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKLOp, 8>}, + {0x15, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKHOp, 8>}, {0x16, 2, &OpDispatchBuilder::MOVHPDOp}, {0x19, 7, &OpDispatchBuilder::NOPOp}, {0x28, 2, &OpDispatchBuilder::MOVVectorAlignedOp}, @@ -5946,7 +5946,7 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {0x2E, 2, &OpDispatchBuilder::UCOMISxOp<8>}, {0x40, 16, &OpDispatchBuilder::CMOVOp}, - {0x50, 1, &OpDispatchBuilder::MOVMSKOp<8>}, + {0x50, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::MOVMSKOp, 8>}, {0x51, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorUnaryOp, IR::OP_VFSQRT, 8>}, {0x54, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VAND, 16>}, {0x55, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUROp, IR::OP_VANDN, 8>}, @@ -5960,20 +5960,20 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {0x5D, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VFMIN, 8>}, {0x5E, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VFDIV, 8>}, {0x5F, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VFMAX, 8>}, - {0x60, 1, &OpDispatchBuilder::PUNPCKLOp<1>}, - {0x61, 1, &OpDispatchBuilder::PUNPCKLOp<2>}, - {0x62, 1, &OpDispatchBuilder::PUNPCKLOp<4>}, + {0x60, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKLOp, 1>}, + {0x61, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKLOp, 2>}, + {0x62, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKLOp, 4>}, {0x63, 1, &OpDispatchBuilder::PACKSSOp<2>}, {0x64, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VCMPGT, 1>}, {0x65, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VCMPGT, 2>}, {0x66, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VCMPGT, 4>}, {0x67, 1, &OpDispatchBuilder::PACKUSOp<2>}, - {0x68, 1, &OpDispatchBuilder::PUNPCKHOp<1>}, - {0x69, 1, &OpDispatchBuilder::PUNPCKHOp<2>}, - {0x6A, 1, &OpDispatchBuilder::PUNPCKHOp<4>}, + {0x68, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKHOp, 1>}, + {0x69, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKHOp, 2>}, + {0x6A, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKHOp, 4>}, {0x6B, 1, &OpDispatchBuilder::PACKSSOp<4>}, - {0x6C, 1, &OpDispatchBuilder::PUNPCKLOp<8>}, - {0x6D, 1, &OpDispatchBuilder::PUNPCKHOp<8>}, + {0x6C, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKLOp, 8>}, + {0x6D, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PUNPCKHOp, 8>}, {0x6E, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::MOVBetweenGPR_FPR, OpDispatchBuilder::VectorOpType::SSE>}, {0x6F, 1, &OpDispatchBuilder::MOVVectorAlignedOp}, {0x70, 1, &OpDispatchBuilder::PSHUFDOp}, @@ -5988,13 +5988,13 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {0x7F, 1, &OpDispatchBuilder::MOVVectorAlignedOp}, {0xC2, 1, &OpDispatchBuilder::VFCMPOp<8>}, {0xC4, 1, &OpDispatchBuilder::PINSROp<2>}, - {0xC5, 1, &OpDispatchBuilder::PExtrOp<2>}, - {0xC6, 1, &OpDispatchBuilder::SHUFOp<8>}, + {0xC5, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PExtrOp, 2>}, + {0xC6, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::SHUFOp, 8>}, {0xD0, 1, &OpDispatchBuilder::ADDSUBPOp<8>}, - {0xD1, 1, &OpDispatchBuilder::PSRLDOp<2>}, - {0xD2, 1, &OpDispatchBuilder::PSRLDOp<4>}, - {0xD3, 1, &OpDispatchBuilder::PSRLDOp<8>}, + {0xD1, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRLDOp, 2>}, + {0xD2, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRLDOp, 4>}, + {0xD3, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRLDOp, 8>}, {0xD4, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VADD, 8>}, {0xD5, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VMUL, 2>}, {0xD6, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::MOVQOp, OpDispatchBuilder::VectorOpType::SSE>}, @@ -6008,8 +6008,8 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {0xDE, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VUMAX, 1>}, {0xDF, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUROp, IR::OP_VANDN, 8>}, {0xE0, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VURAVG, 1>}, - {0xE1, 1, &OpDispatchBuilder::PSRAOp<2>}, - {0xE2, 1, &OpDispatchBuilder::PSRAOp<4>}, + {0xE1, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRAOp, 2>}, + {0xE2, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRAOp, 4>}, {0xE3, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VURAVG, 2>}, {0xE4, 1, &OpDispatchBuilder::PMULHW}, {0xE5, 1, &OpDispatchBuilder::PMULHW}, @@ -6024,9 +6024,9 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {0xEE, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VSMAX, 2>}, {0xEF, 1, &OpDispatchBuilder::VectorXOROp}, - {0xF1, 1, &OpDispatchBuilder::PSLL<2>}, - {0xF2, 1, &OpDispatchBuilder::PSLL<4>}, - {0xF3, 1, &OpDispatchBuilder::PSLL<8>}, + {0xF1, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSLL, 2>}, + {0xF2, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSLL, 4>}, + {0xF3, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSLL, 8>}, {0xF4, 1, &OpDispatchBuilder::PMULLOp<4, false>}, {0xF5, 1, &OpDispatchBuilder::PMADDWD}, {0xF6, 1, &OpDispatchBuilder::PSADBW}, @@ -6103,30 +6103,30 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {OPD(FEXCore::X86Tables::TYPE_GROUP_9, PF_F3, 7), 1, &OpDispatchBuilder::RDPIDOp}, // GROUP 12 - {OPD(FEXCore::X86Tables::TYPE_GROUP_12, PF_NONE, 2), 1, &OpDispatchBuilder::PSRLI<2>}, - {OPD(FEXCore::X86Tables::TYPE_GROUP_12, PF_NONE, 4), 1, &OpDispatchBuilder::PSRAIOp<2>}, - {OPD(FEXCore::X86Tables::TYPE_GROUP_12, PF_NONE, 6), 1, &OpDispatchBuilder::PSLLI<2>}, + {OPD(FEXCore::X86Tables::TYPE_GROUP_12, PF_NONE, 2), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRLI, 2>}, + {OPD(FEXCore::X86Tables::TYPE_GROUP_12, PF_NONE, 4), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRAIOp, 2>}, + {OPD(FEXCore::X86Tables::TYPE_GROUP_12, PF_NONE, 6), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSLLI, 2>}, - {OPD(FEXCore::X86Tables::TYPE_GROUP_12, PF_66, 2), 1, &OpDispatchBuilder::PSRLI<2>}, - {OPD(FEXCore::X86Tables::TYPE_GROUP_12, PF_66, 4), 1, &OpDispatchBuilder::PSRAIOp<2>}, - {OPD(FEXCore::X86Tables::TYPE_GROUP_12, PF_66, 6), 1, &OpDispatchBuilder::PSLLI<2>}, + {OPD(FEXCore::X86Tables::TYPE_GROUP_12, PF_66, 2), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRLI, 2>}, + {OPD(FEXCore::X86Tables::TYPE_GROUP_12, PF_66, 4), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRAIOp, 2>}, + {OPD(FEXCore::X86Tables::TYPE_GROUP_12, PF_66, 6), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSLLI, 2>}, // GROUP 13 - {OPD(FEXCore::X86Tables::TYPE_GROUP_13, PF_NONE, 2), 1, &OpDispatchBuilder::PSRLI<4>}, - {OPD(FEXCore::X86Tables::TYPE_GROUP_13, PF_NONE, 4), 1, &OpDispatchBuilder::PSRAIOp<4>}, - {OPD(FEXCore::X86Tables::TYPE_GROUP_13, PF_NONE, 6), 1, &OpDispatchBuilder::PSLLI<4>}, + {OPD(FEXCore::X86Tables::TYPE_GROUP_13, PF_NONE, 2), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRLI, 4>}, + {OPD(FEXCore::X86Tables::TYPE_GROUP_13, PF_NONE, 4), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRAIOp, 4>}, + {OPD(FEXCore::X86Tables::TYPE_GROUP_13, PF_NONE, 6), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSLLI, 4>}, - {OPD(FEXCore::X86Tables::TYPE_GROUP_13, PF_66, 2), 1, &OpDispatchBuilder::PSRLI<4>}, - {OPD(FEXCore::X86Tables::TYPE_GROUP_13, PF_66, 4), 1, &OpDispatchBuilder::PSRAIOp<4>}, - {OPD(FEXCore::X86Tables::TYPE_GROUP_13, PF_66, 6), 1, &OpDispatchBuilder::PSLLI<4>}, + {OPD(FEXCore::X86Tables::TYPE_GROUP_13, PF_66, 2), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRLI, 4>}, + {OPD(FEXCore::X86Tables::TYPE_GROUP_13, PF_66, 4), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRAIOp, 4>}, + {OPD(FEXCore::X86Tables::TYPE_GROUP_13, PF_66, 6), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSLLI, 4>}, // GROUP 14 - {OPD(FEXCore::X86Tables::TYPE_GROUP_14, PF_NONE, 2), 1, &OpDispatchBuilder::PSRLI<8>}, - {OPD(FEXCore::X86Tables::TYPE_GROUP_14, PF_NONE, 6), 1, &OpDispatchBuilder::PSLLI<8>}, + {OPD(FEXCore::X86Tables::TYPE_GROUP_14, PF_NONE, 2), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRLI, 8>}, + {OPD(FEXCore::X86Tables::TYPE_GROUP_14, PF_NONE, 6), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSLLI, 8>}, - {OPD(FEXCore::X86Tables::TYPE_GROUP_14, PF_66, 2), 1, &OpDispatchBuilder::PSRLI<8>}, + {OPD(FEXCore::X86Tables::TYPE_GROUP_14, PF_66, 2), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSRLI, 8>}, {OPD(FEXCore::X86Tables::TYPE_GROUP_14, PF_66, 3), 1, &OpDispatchBuilder::PSRLDQ}, - {OPD(FEXCore::X86Tables::TYPE_GROUP_14, PF_66, 6), 1, &OpDispatchBuilder::PSLLI<8>}, + {OPD(FEXCore::X86Tables::TYPE_GROUP_14, PF_66, 6), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSLLI, 8>}, {OPD(FEXCore::X86Tables::TYPE_GROUP_14, PF_66, 7), 1, &OpDispatchBuilder::PSLLDQ}, // GROUP 15 @@ -6703,9 +6703,9 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {OPD(PF_38_66, 0x0A), 1, &OpDispatchBuilder::PSIGN<4>}, {OPD(PF_38_NONE, 0x0B), 1, &OpDispatchBuilder::PMULHRSW}, {OPD(PF_38_66, 0x0B), 1, &OpDispatchBuilder::PMULHRSW}, - {OPD(PF_38_66, 0x10), 1, &OpDispatchBuilder::VectorVariableBlend<1>}, - {OPD(PF_38_66, 0x14), 1, &OpDispatchBuilder::VectorVariableBlend<4>}, - {OPD(PF_38_66, 0x15), 1, &OpDispatchBuilder::VectorVariableBlend<8>}, + {OPD(PF_38_66, 0x10), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorVariableBlend, 1>}, + {OPD(PF_38_66, 0x14), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorVariableBlend, 4>}, + {OPD(PF_38_66, 0x15), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorVariableBlend, 8>}, {OPD(PF_38_66, 0x17), 1, &OpDispatchBuilder::PTestOp}, {OPD(PF_38_NONE, 0x1C), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorUnaryOp, IR::OP_VABS, 1>}, {OPD(PF_38_66, 0x1C), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorUnaryOp, IR::OP_VABS, 1>}, @@ -6766,11 +6766,11 @@ void InstallOpcodeHandlers(Context::OperatingMode Mode) { {OPD(0, PF_3A_66, 0x0F), 1, &OpDispatchBuilder::PAlignrOp}, {OPD(1, PF_3A_66, 0x0F), 1, &OpDispatchBuilder::PAlignrOp}, - {OPD(0, PF_3A_66, 0x14), 1, &OpDispatchBuilder::PExtrOp<1>}, - {OPD(0, PF_3A_66, 0x15), 1, &OpDispatchBuilder::PExtrOp<2>}, - {OPD(0, PF_3A_66, 0x16), 1, &OpDispatchBuilder::PExtrOp<4>}, - {OPD(1, PF_3A_66, 0x16), 1, &OpDispatchBuilder::PExtrOp<8>}, - {OPD(0, PF_3A_66, 0x17), 1, &OpDispatchBuilder::PExtrOp<4>}, + {OPD(0, PF_3A_66, 0x14), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PExtrOp, 1>}, + {OPD(0, PF_3A_66, 0x15), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PExtrOp, 2>}, + {OPD(0, PF_3A_66, 0x16), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PExtrOp, 4>}, + {OPD(1, PF_3A_66, 0x16), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PExtrOp, 8>}, + {OPD(0, PF_3A_66, 0x17), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PExtrOp, 4>}, {OPD(0, PF_3A_66, 0x20), 1, &OpDispatchBuilder::PINSROp<1>}, {OPD(0, PF_3A_66, 0x21), 1, &OpDispatchBuilder::InsertPSOp}, diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher.h b/FEXCore/Source/Interface/Core/OpcodeDispatcher.h index 067fcbb7b..bebce9b9e 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher.h +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher.h @@ -461,32 +461,22 @@ public: void MOVQOp(OpcodeArgs, VectorOpType VectorType); void MOVQMMXOp(OpcodeArgs); - template - void MOVMSKOp(OpcodeArgs); + void MOVMSKOp(OpcodeArgs, size_t ElementSize); void MOVMSKOpOne(OpcodeArgs); - template - void PUNPCKLOp(OpcodeArgs); - template - void PUNPCKHOp(OpcodeArgs); + void PUNPCKLOp(OpcodeArgs, size_t ElementSize); + void PUNPCKHOp(OpcodeArgs, size_t ElementSize); void PSHUFBOp(OpcodeArgs); - template - void PSHUFWOp(OpcodeArgs); + void PSHUFWOp(OpcodeArgs, bool Low); void PSHUFW8ByteOp(OpcodeArgs); void PSHUFDOp(OpcodeArgs); - template - void PSRLDOp(OpcodeArgs); - template - void PSRLI(OpcodeArgs); - template - void PSLLI(OpcodeArgs); - template - void PSLL(OpcodeArgs); - template - void PSRAOp(OpcodeArgs); + void PSRLDOp(OpcodeArgs, size_t ElementSize); + void PSRLI(OpcodeArgs, size_t ElementSize); + void PSLLI(OpcodeArgs, size_t ElementSize); + void PSLL(OpcodeArgs, size_t ElementSize); + void PSRAOp(OpcodeArgs, size_t ElementSize); void PSRLDQ(OpcodeArgs); void PSLLDQ(OpcodeArgs); - template - void PSRAIOp(OpcodeArgs); + void PSRAIOp(OpcodeArgs, size_t ElementSize); void MOVDDUPOp(OpcodeArgs); template void CVTGPR_To_FPR(OpcodeArgs); @@ -508,13 +498,11 @@ public: void LZCNT(OpcodeArgs); template void VFCMPOp(OpcodeArgs); - template - void SHUFOp(OpcodeArgs); + void SHUFOp(OpcodeArgs, size_t ElementSize); template void PINSROp(OpcodeArgs); void InsertPSOp(OpcodeArgs); - template - void PExtrOp(OpcodeArgs); + void PExtrOp(OpcodeArgs, size_t ElementSize); template void PSIGN(OpcodeArgs); @@ -608,8 +596,7 @@ public: void VPBLENDDOp(OpcodeArgs); void VPBLENDWOp(OpcodeArgs); - template - void VBROADCASTOp(OpcodeArgs); + void VBROADCASTOp(OpcodeArgs, size_t ElementSize); template void VDPPOp(OpcodeArgs); @@ -618,8 +605,7 @@ public: template void VHADDPOp(OpcodeArgs); - template - void VHSUBPOp(OpcodeArgs); + void VHSUBPOp(OpcodeArgs, size_t ElementSize); void VINSERTOp(OpcodeArgs); void VINSERTPSOp(OpcodeArgs); @@ -642,11 +628,9 @@ public: void VMPSADBWOp(OpcodeArgs); - template - void VPACKSSOp(OpcodeArgs); + void VPACKSSOp(OpcodeArgs, size_t ElementSize); - template - void VPACKUSOp(OpcodeArgs); + void VPACKUSOp(OpcodeArgs, size_t ElementSize); void VPALIGNROp(OpcodeArgs); @@ -663,8 +647,7 @@ public: void VPERMDOp(OpcodeArgs); void VPERMQOp(OpcodeArgs); - template - void VPERMILImmOp(OpcodeArgs); + void VPERMILImmOp(OpcodeArgs, size_t ElementSize); Ref VPERMILRegOpImpl(OpSize DstSize, size_t ElementSize, Ref Src, Ref Indices); template @@ -672,8 +655,7 @@ public: void VPHADDSWOp(OpcodeArgs); - template - void VPHSUBOp(OpcodeArgs); + void VPHSUBOp(OpcodeArgs, size_t ElementSize); void VPHSUBSWOp(OpcodeArgs); void VPINSRBOp(OpcodeArgs); @@ -698,40 +680,30 @@ public: void VPSHUFBOp(OpcodeArgs); - template - void VPSHUFWOp(OpcodeArgs); + void VPSHUFWOp(OpcodeArgs, size_t ElementSize, bool Low); - template - void VPSLLOp(OpcodeArgs); + void VPSLLOp(OpcodeArgs, size_t ElementSize); void VPSLLDQOp(OpcodeArgs); - template - void VPSLLIOp(OpcodeArgs); + void VPSLLIOp(OpcodeArgs, size_t ElementSize); void VPSLLVOp(OpcodeArgs); - template - void VPSRAOp(OpcodeArgs); + void VPSRAOp(OpcodeArgs, size_t ElementSize); - template - void VPSRAIOp(OpcodeArgs); + void VPSRAIOp(OpcodeArgs, size_t ElementSize); void VPSRAVDOp(OpcodeArgs); void VPSRLVOp(OpcodeArgs); - template - void VPSRLDOp(OpcodeArgs); + void VPSRLDOp(OpcodeArgs, size_t ElementSize); void VPSRLDQOp(OpcodeArgs); - template - void VPUNPCKHOp(OpcodeArgs); + void VPUNPCKHOp(OpcodeArgs, size_t ElementSize); - template - void VPUNPCKLOp(OpcodeArgs); + void VPUNPCKLOp(OpcodeArgs, size_t ElementSize); - template - void VPSRLIOp(OpcodeArgs); + void VPSRLIOp(OpcodeArgs, size_t ElementSize); - template - void VSHUFOp(OpcodeArgs); + void VSHUFOp(OpcodeArgs, size_t ElementSize); template void VTESTPOp(OpcodeArgs); @@ -944,8 +916,7 @@ public: template void VectorBlend(OpcodeArgs); - template - void VectorVariableBlend(OpcodeArgs); + void VectorVariableBlend(OpcodeArgs, size_t ElementSize); void PTestOpImpl(OpSize Size, Ref Dest, Ref Src); void PTestOp(OpcodeArgs); void PHMINPOSUWOp(OpcodeArgs); @@ -1405,8 +1376,7 @@ private: void AVXVectorALUOp(OpcodeArgs, IROps IROp, size_t ElementSize); void AVXVectorUnaryOp(OpcodeArgs, IROps IROp, size_t ElementSize); - template - void AVXVectorVariableBlend(OpcodeArgs); + void AVXVectorVariableBlend(OpcodeArgs, size_t ElementSize); void AVXVariableShiftImpl(OpcodeArgs, IROps IROp); diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher/Vector.cpp b/FEXCore/Source/Interface/Core/OpcodeDispatcher/Vector.cpp index 7b82f5135..14318975a 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher/Vector.cpp +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher/Vector.cpp @@ -702,8 +702,7 @@ void OpDispatchBuilder::MOVQMMXOp(OpcodeArgs) { StoreResult(FPRClass, Op, Src, 1); } -template -void OpDispatchBuilder::MOVMSKOp(OpcodeArgs) { +void OpDispatchBuilder::MOVMSKOp(OpcodeArgs, size_t ElementSize) { auto Size = GetSrcSize(Op); uint8_t NumElements = Size / ElementSize; @@ -752,9 +751,6 @@ void OpDispatchBuilder::MOVMSKOp(OpcodeArgs) { } } -template void OpDispatchBuilder::MOVMSKOp<4>(OpcodeArgs); -template void OpDispatchBuilder::MOVMSKOp<8>(OpcodeArgs); - void OpDispatchBuilder::MOVMSKOpOne(OpcodeArgs) { const auto SrcSize = GetSrcSize(Op); const auto Is256Bit = SrcSize == Core::CPUState::XMM_AVX_REG_SIZE; @@ -780,8 +776,7 @@ void OpDispatchBuilder::MOVMSKOpOne(OpcodeArgs) { StoreResult(GPRClass, Op, Result, -1); } -template -void OpDispatchBuilder::PUNPCKLOp(OpcodeArgs) { +void OpDispatchBuilder::PUNPCKLOp(OpcodeArgs, size_t ElementSize) { auto Size = GetSrcSize(Op); Ref Dest = LoadSource(FPRClass, Op, Op->Dest, Op->Flags); @@ -791,13 +786,7 @@ void OpDispatchBuilder::PUNPCKLOp(OpcodeArgs) { StoreResult(FPRClass, Op, ALUOp, -1); } -template void OpDispatchBuilder::PUNPCKLOp<1>(OpcodeArgs); -template void OpDispatchBuilder::PUNPCKLOp<2>(OpcodeArgs); -template void OpDispatchBuilder::PUNPCKLOp<4>(OpcodeArgs); -template void OpDispatchBuilder::PUNPCKLOp<8>(OpcodeArgs); - -template -void OpDispatchBuilder::VPUNPCKLOp(OpcodeArgs) { +void OpDispatchBuilder::VPUNPCKLOp(OpcodeArgs, size_t ElementSize) { const auto SrcSize = GetSrcSize(Op); const auto Is128Bit = SrcSize == Core::CPUState::XMM_SSE_REG_SIZE; @@ -817,13 +806,7 @@ void OpDispatchBuilder::VPUNPCKLOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::VPUNPCKLOp<1>(OpcodeArgs); -template void OpDispatchBuilder::VPUNPCKLOp<2>(OpcodeArgs); -template void OpDispatchBuilder::VPUNPCKLOp<4>(OpcodeArgs); -template void OpDispatchBuilder::VPUNPCKLOp<8>(OpcodeArgs); - -template -void OpDispatchBuilder::PUNPCKHOp(OpcodeArgs) { +void OpDispatchBuilder::PUNPCKHOp(OpcodeArgs, size_t ElementSize) { auto Size = GetSrcSize(Op); Ref Dest = LoadSource(FPRClass, Op, Op->Dest, Op->Flags); Ref Src = LoadSource(FPRClass, Op, Op->Src[0], Op->Flags); @@ -832,13 +815,7 @@ void OpDispatchBuilder::PUNPCKHOp(OpcodeArgs) { StoreResult(FPRClass, Op, ALUOp, -1); } -template void OpDispatchBuilder::PUNPCKHOp<1>(OpcodeArgs); -template void OpDispatchBuilder::PUNPCKHOp<2>(OpcodeArgs); -template void OpDispatchBuilder::PUNPCKHOp<4>(OpcodeArgs); -template void OpDispatchBuilder::PUNPCKHOp<8>(OpcodeArgs); - -template -void OpDispatchBuilder::VPUNPCKHOp(OpcodeArgs) { +void OpDispatchBuilder::VPUNPCKHOp(OpcodeArgs, size_t ElementSize) { const auto SrcSize = GetSrcSize(Op); const auto Is128Bit = SrcSize == Core::CPUState::XMM_SSE_REG_SIZE; @@ -858,11 +835,6 @@ void OpDispatchBuilder::VPUNPCKHOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::VPUNPCKHOp<1>(OpcodeArgs); -template void OpDispatchBuilder::VPUNPCKHOp<2>(OpcodeArgs); -template void OpDispatchBuilder::VPUNPCKHOp<4>(OpcodeArgs); -template void OpDispatchBuilder::VPUNPCKHOp<8>(OpcodeArgs); - Ref OpDispatchBuilder::GeneratePSHUFBMask(uint8_t SrcSize) { // PSHUFB doesn't 100% match VTBL behaviour // VTBL will set the element zero if the index is greater than @@ -949,8 +921,7 @@ void OpDispatchBuilder::PSHUFW8ByteOp(OpcodeArgs) { StoreResult(FPRClass, Op, Dest, -1); } -template -void OpDispatchBuilder::PSHUFWOp(OpcodeArgs) { +void OpDispatchBuilder::PSHUFWOp(OpcodeArgs, bool Low) { constexpr auto IdentityCopy = 0b11'10'01'00; uint16_t Shuffle = Op->Src[1].Data.Literal.Value; @@ -1000,9 +971,6 @@ void OpDispatchBuilder::PSHUFWOp(OpcodeArgs) { StoreResult(FPRClass, Op, Dest, -1); } -template void OpDispatchBuilder::PSHUFWOp(OpcodeArgs); -template void OpDispatchBuilder::PSHUFWOp(OpcodeArgs); - Ref OpDispatchBuilder::Single128Bit4ByteVectorShuffle(Ref Src, uint8_t Shuffle) { constexpr auto IdentityCopy = 0b11'10'01'00; @@ -1222,8 +1190,7 @@ void OpDispatchBuilder::PSHUFDOp(OpcodeArgs) { StoreResult(FPRClass, Op, Single128Bit4ByteVectorShuffle(Src, Shuffle), -1); } -template -void OpDispatchBuilder::VPSHUFWOp(OpcodeArgs) { +void OpDispatchBuilder::VPSHUFWOp(OpcodeArgs, size_t ElementSize, bool Low) { const auto SrcSize = GetSrcSize(Op); const auto Is256Bit = SrcSize == Core::CPUState::XMM_AVX_REG_SIZE; auto Shuffle = Op->Src[1].Literal(); @@ -1271,9 +1238,6 @@ void OpDispatchBuilder::VPSHUFWOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::VPSHUFWOp<2, false>(OpcodeArgs); -template void OpDispatchBuilder::VPSHUFWOp<2, true>(OpcodeArgs); -template void OpDispatchBuilder::VPSHUFWOp<4, true>(OpcodeArgs); Ref OpDispatchBuilder::SHUFOpImpl(OpcodeArgs, size_t DstSize, size_t ElementSize, Ref Src1, Ref Src2, uint8_t Shuffle) { // Since 256-bit variants and up don't lane cross, we can construct @@ -1466,8 +1430,7 @@ Ref OpDispatchBuilder::SHUFOpImpl(OpcodeArgs, size_t DstSize, size_t ElementSize return Dest; } -template -void OpDispatchBuilder::SHUFOp(OpcodeArgs) { +void OpDispatchBuilder::SHUFOp(OpcodeArgs, size_t ElementSize) { Ref Src1Node = LoadSource(FPRClass, Op, Op->Dest, Op->Flags); Ref Src2Node = LoadSource(FPRClass, Op, Op->Src[0], Op->Flags); uint8_t Shuffle = Op->Src[1].Literal(); @@ -1475,11 +1438,8 @@ void OpDispatchBuilder::SHUFOp(OpcodeArgs) { Ref Result = SHUFOpImpl(Op, GetDstSize(Op), ElementSize, Src1Node, Src2Node, Shuffle); StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::SHUFOp<4>(OpcodeArgs); -template void OpDispatchBuilder::SHUFOp<8>(OpcodeArgs); -template -void OpDispatchBuilder::VSHUFOp(OpcodeArgs) { +void OpDispatchBuilder::VSHUFOp(OpcodeArgs, size_t ElementSize) { Ref Src1Node = LoadSource(FPRClass, Op, Op->Src[0], Op->Flags); Ref Src2Node = LoadSource(FPRClass, Op, Op->Src[1], Op->Flags); uint8_t Shuffle = Op->Src[2].Literal(); @@ -1487,8 +1447,6 @@ void OpDispatchBuilder::VSHUFOp(OpcodeArgs) { Ref Result = SHUFOpImpl(Op, GetDstSize(Op), ElementSize, Src1Node, Src2Node, Shuffle); StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::VSHUFOp<4>(OpcodeArgs); -template void OpDispatchBuilder::VSHUFOp<8>(OpcodeArgs); void OpDispatchBuilder::VANDNOp(OpcodeArgs) { const auto SrcSize = GetSrcSize(Op); @@ -1524,8 +1482,7 @@ template void OpDispatchBuilder::VHADDPOp(OpcodeArgs); template void OpDispatchBuilder::VHADDPOp(OpcodeArgs); template void OpDispatchBuilder::VHADDPOp(OpcodeArgs); -template -void OpDispatchBuilder::VBROADCASTOp(OpcodeArgs) { +void OpDispatchBuilder::VBROADCASTOp(OpcodeArgs, size_t ElementSize) { const auto DstSize = GetDstSize(Op); Ref Result {}; @@ -1544,12 +1501,6 @@ void OpDispatchBuilder::VBROADCASTOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::VBROADCASTOp<1>(OpcodeArgs); -template void OpDispatchBuilder::VBROADCASTOp<2>(OpcodeArgs); -template void OpDispatchBuilder::VBROADCASTOp<4>(OpcodeArgs); -template void OpDispatchBuilder::VBROADCASTOp<8>(OpcodeArgs); -template void OpDispatchBuilder::VBROADCASTOp<16>(OpcodeArgs); - Ref OpDispatchBuilder::PINSROpImpl(OpcodeArgs, size_t ElementSize, const X86Tables::DecodedOperand& Src1Op, const X86Tables::DecodedOperand& Src2Op, const X86Tables::DecodedOperand& Imm) { const auto Size = GetDstSize(Op); @@ -1660,8 +1611,7 @@ void OpDispatchBuilder::VINSERTPSOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template -void OpDispatchBuilder::PExtrOp(OpcodeArgs) { +void OpDispatchBuilder::PExtrOp(OpcodeArgs, size_t ElementSize) { const auto DstSize = GetDstSize(Op); Ref Src = LoadSource(FPRClass, Op, Op->Src[0], Op->Flags); @@ -1672,7 +1622,7 @@ void OpDispatchBuilder::PExtrOp(OpcodeArgs) { // is the same except that REX.W or VEX.W is set to 1. Incredibly frustrating. // Use the destination size as the element size in this case. size_t OverridenElementSize = ElementSize; - if constexpr (ElementSize == 4) { + if (ElementSize == 4) { OverridenElementSize = DstSize; } @@ -1693,11 +1643,6 @@ void OpDispatchBuilder::PExtrOp(OpcodeArgs) { _VStoreVectorElement(16, OverridenElementSize, Src, Index, Dest); } -template void OpDispatchBuilder::PExtrOp<1>(OpcodeArgs); -template void OpDispatchBuilder::PExtrOp<2>(OpcodeArgs); -template void OpDispatchBuilder::PExtrOp<4>(OpcodeArgs); -template void OpDispatchBuilder::PExtrOp<8>(OpcodeArgs); - void OpDispatchBuilder::VEXTRACT128Op(OpcodeArgs) { const auto DstIsXMM = Op->Dest.IsGPR(); const auto StoreSize = DstIsXMM ? 32 : 16; @@ -1761,8 +1706,7 @@ Ref OpDispatchBuilder::PSRLDOpImpl(OpcodeArgs, size_t ElementSize, Ref Src, Ref return _VUShrSWide(Size, ElementSize, Src, ShiftVec); } -template -void OpDispatchBuilder::PSRLDOp(OpcodeArgs) { +void OpDispatchBuilder::PSRLDOp(OpcodeArgs, size_t ElementSize) { Ref Dest = LoadSource(FPRClass, Op, Op->Dest, Op->Flags); Ref Src = LoadSource(FPRClass, Op, Op->Src[0], Op->Flags); Ref Result = PSRLDOpImpl(Op, ElementSize, Dest, Src); @@ -1770,12 +1714,7 @@ void OpDispatchBuilder::PSRLDOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::PSRLDOp<2>(OpcodeArgs); -template void OpDispatchBuilder::PSRLDOp<4>(OpcodeArgs); -template void OpDispatchBuilder::PSRLDOp<8>(OpcodeArgs); - -template -void OpDispatchBuilder::VPSRLDOp(OpcodeArgs) { +void OpDispatchBuilder::VPSRLDOp(OpcodeArgs, size_t ElementSize) { const auto DstSize = GetDstSize(Op); const auto Is128Bit = DstSize == Core::CPUState::XMM_SSE_REG_SIZE; @@ -1789,12 +1728,7 @@ void OpDispatchBuilder::VPSRLDOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::VPSRLDOp<2>(OpcodeArgs); -template void OpDispatchBuilder::VPSRLDOp<4>(OpcodeArgs); -template void OpDispatchBuilder::VPSRLDOp<8>(OpcodeArgs); - -template -void OpDispatchBuilder::PSRLI(OpcodeArgs) { +void OpDispatchBuilder::PSRLI(OpcodeArgs, size_t ElementSize) { const uint64_t ShiftConstant = Op->Src[1].Literal(); if (ShiftConstant == 0) [[unlikely]] { // Nothing to do, value is already in Dest. @@ -1808,12 +1742,7 @@ void OpDispatchBuilder::PSRLI(OpcodeArgs) { StoreResult(FPRClass, Op, Shift, -1); } -template void OpDispatchBuilder::PSRLI<2>(OpcodeArgs); -template void OpDispatchBuilder::PSRLI<4>(OpcodeArgs); -template void OpDispatchBuilder::PSRLI<8>(OpcodeArgs); - -template -void OpDispatchBuilder::VPSRLIOp(OpcodeArgs) { +void OpDispatchBuilder::VPSRLIOp(OpcodeArgs, size_t ElementSize) { const auto Size = GetSrcSize(Op); const auto Is128Bit = Size == Core::CPUState::XMM_SSE_REG_SIZE; const uint64_t ShiftConstant = Op->Src[1].Literal(); @@ -1832,10 +1761,6 @@ void OpDispatchBuilder::VPSRLIOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::VPSRLIOp<2>(OpcodeArgs); -template void OpDispatchBuilder::VPSRLIOp<4>(OpcodeArgs); -template void OpDispatchBuilder::VPSRLIOp<8>(OpcodeArgs); - Ref OpDispatchBuilder::PSLLIImpl(OpcodeArgs, size_t ElementSize, Ref Src, uint64_t Shift) { if (Shift == 0) [[unlikely]] { // If zero-shift then just return the source. @@ -1845,8 +1770,7 @@ Ref OpDispatchBuilder::PSLLIImpl(OpcodeArgs, size_t ElementSize, Ref Src, uint64 return _VShlI(Size, ElementSize, Src, Shift); } -template -void OpDispatchBuilder::PSLLI(OpcodeArgs) { +void OpDispatchBuilder::PSLLI(OpcodeArgs, size_t ElementSize) { const uint64_t ShiftConstant = Op->Src[1].Literal(); if (ShiftConstant == 0) [[unlikely]] { // Nothing to do, value is already in Dest. @@ -1859,12 +1783,7 @@ void OpDispatchBuilder::PSLLI(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::PSLLI<2>(OpcodeArgs); -template void OpDispatchBuilder::PSLLI<4>(OpcodeArgs); -template void OpDispatchBuilder::PSLLI<8>(OpcodeArgs); - -template -void OpDispatchBuilder::VPSLLIOp(OpcodeArgs) { +void OpDispatchBuilder::VPSLLIOp(OpcodeArgs, size_t ElementSize) { const uint64_t ShiftConstant = Op->Src[1].Literal(); const auto DstSize = GetDstSize(Op); const auto Is128Bit = DstSize == Core::CPUState::XMM_SSE_REG_SIZE; @@ -1878,10 +1797,6 @@ void OpDispatchBuilder::VPSLLIOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::VPSLLIOp<2>(OpcodeArgs); -template void OpDispatchBuilder::VPSLLIOp<4>(OpcodeArgs); -template void OpDispatchBuilder::VPSLLIOp<8>(OpcodeArgs); - Ref OpDispatchBuilder::PSLLImpl(OpcodeArgs, size_t ElementSize, Ref Src, Ref ShiftVec) { const auto Size = GetDstSize(Op); @@ -1889,8 +1804,7 @@ Ref OpDispatchBuilder::PSLLImpl(OpcodeArgs, size_t ElementSize, Ref Src, Ref Shi return _VUShlSWide(Size, ElementSize, Src, ShiftVec); } -template -void OpDispatchBuilder::PSLL(OpcodeArgs) { +void OpDispatchBuilder::PSLL(OpcodeArgs, size_t ElementSize) { Ref Dest = LoadSource(FPRClass, Op, Op->Dest, Op->Flags); Ref Src = LoadSource(FPRClass, Op, Op->Src[0], Op->Flags); Ref Result = PSLLImpl(Op, ElementSize, Dest, Src); @@ -1898,12 +1812,7 @@ void OpDispatchBuilder::PSLL(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::PSLL<2>(OpcodeArgs); -template void OpDispatchBuilder::PSLL<4>(OpcodeArgs); -template void OpDispatchBuilder::PSLL<8>(OpcodeArgs); - -template -void OpDispatchBuilder::VPSLLOp(OpcodeArgs) { +void OpDispatchBuilder::VPSLLOp(OpcodeArgs, size_t ElementSize) { const auto DstSize = GetDstSize(Op); const auto Is128Bit = DstSize == Core::CPUState::XMM_SSE_REG_SIZE; @@ -1917,10 +1826,6 @@ void OpDispatchBuilder::VPSLLOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::VPSLLOp<2>(OpcodeArgs); -template void OpDispatchBuilder::VPSLLOp<4>(OpcodeArgs); -template void OpDispatchBuilder::VPSLLOp<8>(OpcodeArgs); - Ref OpDispatchBuilder::PSRAOpImpl(OpcodeArgs, size_t ElementSize, Ref Src, Ref ShiftVec) { const auto Size = GetDstSize(Op); @@ -1928,8 +1833,7 @@ Ref OpDispatchBuilder::PSRAOpImpl(OpcodeArgs, size_t ElementSize, Ref Src, Ref S return _VSShrSWide(Size, ElementSize, Src, ShiftVec); } -template -void OpDispatchBuilder::PSRAOp(OpcodeArgs) { +void OpDispatchBuilder::PSRAOp(OpcodeArgs, size_t ElementSize) { Ref Dest = LoadSource(FPRClass, Op, Op->Dest, Op->Flags); Ref Src = LoadSource(FPRClass, Op, Op->Src[0], Op->Flags); Ref Result = PSRAOpImpl(Op, ElementSize, Dest, Src); @@ -1937,11 +1841,7 @@ void OpDispatchBuilder::PSRAOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::PSRAOp<2>(OpcodeArgs); -template void OpDispatchBuilder::PSRAOp<4>(OpcodeArgs); - -template -void OpDispatchBuilder::VPSRAOp(OpcodeArgs) { +void OpDispatchBuilder::VPSRAOp(OpcodeArgs, size_t ElementSize) { const auto DstSize = GetDstSize(Op); const auto Is128Bit = DstSize == Core::CPUState::XMM_SSE_REG_SIZE; @@ -1955,9 +1855,6 @@ void OpDispatchBuilder::VPSRAOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::VPSRAOp<2>(OpcodeArgs); -template void OpDispatchBuilder::VPSRAOp<4>(OpcodeArgs); - void OpDispatchBuilder::PSRLDQ(OpcodeArgs) { const uint64_t Shift = Op->Src[1].Literal(); if (Shift == 0) [[unlikely]] { @@ -2059,8 +1956,7 @@ void OpDispatchBuilder::VPSLLDQOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template -void OpDispatchBuilder::PSRAIOp(OpcodeArgs) { +void OpDispatchBuilder::PSRAIOp(OpcodeArgs, size_t ElementSize) { const uint64_t Shift = Op->Src[1].Literal(); if (Shift == 0) [[unlikely]] { // Nothing to do, value is already in Dest. @@ -2074,11 +1970,7 @@ void OpDispatchBuilder::PSRAIOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::PSRAIOp<2>(OpcodeArgs); -template void OpDispatchBuilder::PSRAIOp<4>(OpcodeArgs); - -template -void OpDispatchBuilder::VPSRAIOp(OpcodeArgs) { +void OpDispatchBuilder::VPSRAIOp(OpcodeArgs, size_t ElementSize) { const uint64_t Shift = Op->Src[1].Literal(); const auto Size = GetDstSize(Op); const auto Is128Bit = Size == Core::CPUState::XMM_SSE_REG_SIZE; @@ -2097,9 +1989,6 @@ void OpDispatchBuilder::VPSRAIOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::VPSRAIOp<2>(OpcodeArgs); -template void OpDispatchBuilder::VPSRAIOp<4>(OpcodeArgs); - void OpDispatchBuilder::AVXVariableShiftImpl(OpcodeArgs, IROps IROp) { const auto DstSize = GetDstSize(Op); const auto SrcSize = GetSrcSize(Op); @@ -3016,8 +2905,7 @@ void OpDispatchBuilder::PACKUSOp(OpcodeArgs) { template void OpDispatchBuilder::PACKUSOp<2>(OpcodeArgs); template void OpDispatchBuilder::PACKUSOp<4>(OpcodeArgs); -template -void OpDispatchBuilder::VPACKUSOp(OpcodeArgs) { +void OpDispatchBuilder::VPACKUSOp(OpcodeArgs, size_t ElementSize) { const auto DstSize = GetDstSize(Op); const auto Is256Bit = DstSize == Core::CPUState::XMM_AVX_REG_SIZE; @@ -3033,9 +2921,6 @@ void OpDispatchBuilder::VPACKUSOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::VPACKUSOp<2>(OpcodeArgs); -template void OpDispatchBuilder::VPACKUSOp<4>(OpcodeArgs); - template void OpDispatchBuilder::PACKSSOp(OpcodeArgs) { Ref Dest = LoadSource(FPRClass, Op, Op->Dest, Op->Flags); @@ -3048,8 +2933,7 @@ void OpDispatchBuilder::PACKSSOp(OpcodeArgs) { template void OpDispatchBuilder::PACKSSOp<2>(OpcodeArgs); template void OpDispatchBuilder::PACKSSOp<4>(OpcodeArgs); -template -void OpDispatchBuilder::VPACKSSOp(OpcodeArgs) { +void OpDispatchBuilder::VPACKSSOp(OpcodeArgs, size_t ElementSize) { const auto DstSize = GetDstSize(Op); const auto Is256Bit = DstSize == Core::CPUState::XMM_AVX_REG_SIZE; @@ -3065,9 +2949,6 @@ void OpDispatchBuilder::VPACKSSOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::VPACKSSOp<2>(OpcodeArgs); -template void OpDispatchBuilder::VPACKSSOp<4>(OpcodeArgs); - Ref OpDispatchBuilder::PMULLOpImpl(OpSize Size, size_t ElementSize, bool Signed, Ref Src1, Ref Src2) { if (Size == OpSize::i64Bit) { if (Signed) { @@ -3506,8 +3387,7 @@ void OpDispatchBuilder::HSUBP(OpcodeArgs) { template void OpDispatchBuilder::HSUBP<4>(OpcodeArgs); template void OpDispatchBuilder::HSUBP<8>(OpcodeArgs); -template -void OpDispatchBuilder::VHSUBPOp(OpcodeArgs) { +void OpDispatchBuilder::VHSUBPOp(OpcodeArgs, size_t ElementSize) { const auto DstSize = GetDstSize(Op); const auto Is256Bit = DstSize == Core::CPUState::XMM_AVX_REG_SIZE; @@ -3524,9 +3404,6 @@ void OpDispatchBuilder::VHSUBPOp(OpcodeArgs) { StoreResult(FPRClass, Op, Dest, -1); } -template void OpDispatchBuilder::VHSUBPOp<4>(OpcodeArgs); -template void OpDispatchBuilder::VHSUBPOp<8>(OpcodeArgs); - Ref OpDispatchBuilder::PHSUBOpImpl(OpSize Size, Ref Src1, Ref Src2, size_t ElementSize) { auto Even = _VUnZip(Size, ElementSize, Src1, Src2); auto Odd = _VUnZip2(Size, ElementSize, Src1, Src2); @@ -3544,8 +3421,7 @@ void OpDispatchBuilder::PHSUB(OpcodeArgs) { template void OpDispatchBuilder::PHSUB<2>(OpcodeArgs); template void OpDispatchBuilder::PHSUB<4>(OpcodeArgs); -template -void OpDispatchBuilder::VPHSUBOp(OpcodeArgs) { +void OpDispatchBuilder::VPHSUBOp(OpcodeArgs, size_t ElementSize) { const auto DstSize = GetDstSize(Op); const auto Is256Bit = DstSize == Core::CPUState::XMM_AVX_REG_SIZE; @@ -3559,9 +3435,6 @@ void OpDispatchBuilder::VPHSUBOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::VPHSUBOp<2>(OpcodeArgs); -template void OpDispatchBuilder::VPHSUBOp<4>(OpcodeArgs); - Ref OpDispatchBuilder::PHADDSOpImpl(OpSize Size, Ref Src1, Ref Src2) { const uint8_t ElementSize = 2; @@ -4028,8 +3901,7 @@ template void OpDispatchBuilder::VectorBlend<2>(OpcodeArgs); template void OpDispatchBuilder::VectorBlend<4>(OpcodeArgs); template void OpDispatchBuilder::VectorBlend<8>(OpcodeArgs); -template -void OpDispatchBuilder::VectorVariableBlend(OpcodeArgs) { +void OpDispatchBuilder::VectorVariableBlend(OpcodeArgs, size_t ElementSize) { auto Size = GetSrcSize(Op); Ref Dest = LoadSource(FPRClass, Op, Op->Dest, Op->Flags); @@ -4048,14 +3920,10 @@ void OpDispatchBuilder::VectorVariableBlend(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::VectorVariableBlend<1>(OpcodeArgs); -template void OpDispatchBuilder::VectorVariableBlend<4>(OpcodeArgs); -template void OpDispatchBuilder::VectorVariableBlend<8>(OpcodeArgs); -template -void OpDispatchBuilder::AVXVectorVariableBlend(OpcodeArgs) { +void OpDispatchBuilder::AVXVectorVariableBlend(OpcodeArgs, size_t ElementSize) { const auto SrcSize = GetSrcSize(Op); - constexpr auto ElementSizeBits = ElementSize * 8; + const auto ElementSizeBits = ElementSize * 8; Ref Src1 = LoadSource(FPRClass, Op, Op->Src[0], Op->Flags); Ref Src2 = LoadSource(FPRClass, Op, Op->Src[1], Op->Flags); @@ -4068,9 +3936,6 @@ void OpDispatchBuilder::AVXVectorVariableBlend(OpcodeArgs) { Ref Result = _VBSL(SrcSize, Shifted, Src2, Src1); StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::AVXVectorVariableBlend<1>(OpcodeArgs); -template void OpDispatchBuilder::AVXVectorVariableBlend<4>(OpcodeArgs); -template void OpDispatchBuilder::AVXVectorVariableBlend<8>(OpcodeArgs); void OpDispatchBuilder::PTestOpImpl(OpSize Size, Ref Dest, Ref Src) { // Invalidate deferred flags early @@ -4889,8 +4754,7 @@ void OpDispatchBuilder::VZEROOp(OpcodeArgs) { } } -template -void OpDispatchBuilder::VPERMILImmOp(OpcodeArgs) { +void OpDispatchBuilder::VPERMILImmOp(OpcodeArgs, size_t ElementSize) { const auto DstSize = GetDstSize(Op); const auto Is256Bit = DstSize == Core::CPUState::XMM_AVX_REG_SIZE; const auto Selector = Op->Src[1].Literal() & 0xFF; @@ -4898,7 +4762,7 @@ void OpDispatchBuilder::VPERMILImmOp(OpcodeArgs) { Ref Src = LoadSource(FPRClass, Op, Op->Src[0], Op->Flags); Ref Result = LoadZeroVector(DstSize); - if constexpr (ElementSize == 8) { + if (ElementSize == 8) { Result = _VInsElement(DstSize, ElementSize, 0, Selector & 0b0001, Result, Src); Result = _VInsElement(DstSize, ElementSize, 1, (Selector & 0b0010) >> 1, Result, Src); @@ -4923,9 +4787,6 @@ void OpDispatchBuilder::VPERMILImmOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, -1); } -template void OpDispatchBuilder::VPERMILImmOp<4>(OpcodeArgs); -template void OpDispatchBuilder::VPERMILImmOp<8>(OpcodeArgs); - Ref OpDispatchBuilder::VPERMILRegOpImpl(OpSize DstSize, size_t ElementSize, Ref Src, Ref Indices) { // NOTE: See implementation of VPERMD for the gist of what we do to make this work. //