diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp b/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp index 9645ccd64..4e69415d6 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp @@ -5138,8 +5138,8 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(1, 0b01, 0x7C), 1, &OpDispatchBuilder::VHADDPOp}, {OPD(1, 0b11, 0x7C), 1, &OpDispatchBuilder::VHADDPOp}, - {OPD(1, 0b01, 0x7D), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VHSUBPOp, 8>}, - {OPD(1, 0b11, 0x7D), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VHSUBPOp, 4>}, + {OPD(1, 0b01, 0x7D), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VHSUBPOp, OpSize::i64Bit>}, + {OPD(1, 0b11, 0x7D), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VHSUBPOp, OpSize::i32Bit>}, {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>}, @@ -5204,7 +5204,7 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {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, 0xF4), 1, &OpDispatchBuilder::VPMULLOp}, {OPD(1, 0b01, 0xF5), 1, &OpDispatchBuilder::VPMADDWDOp}, {OPD(1, 0b01, 0xF6), 1, &OpDispatchBuilder::VPSADBWOp}, {OPD(1, 0b01, 0xF7), 1, &OpDispatchBuilder::MASKMOVOp}, @@ -5253,7 +5253,7 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(2, 0b01, 0x24), 1, &OpDispatchBuilder::ExtendVectorElements}, {OPD(2, 0b01, 0x25), 1, &OpDispatchBuilder::ExtendVectorElements}, - {OPD(2, 0b01, 0x28), 1, &OpDispatchBuilder::VPMULLOp<4, true>}, + {OPD(2, 0b01, 0x28), 1, &OpDispatchBuilder::VPMULLOp}, {OPD(2, 0b01, 0x29), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::AVXVectorALUOp, IR::OP_VCMPEQ, OpSize::i64Bit>}, {OPD(2, 0b01, 0x2A), 1, &OpDispatchBuilder::MOVVectorNTOp}, {OPD(2, 0b01, 0x2B), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VPACKUSOp, OpSize::i32Bit>}, diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher.h b/FEXCore/Source/Interface/Core/OpcodeDispatcher.h index e924a2280..633167bb8 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher.h +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher.h @@ -585,7 +585,7 @@ public: template void VHADDPOp(OpcodeArgs); - void VHSUBPOp(OpcodeArgs, size_t ElementSize); + void VHSUBPOp(OpcodeArgs, IR::OpSize ElementSize); void VINSERTOp(OpcodeArgs); void VINSERTPSOp(OpcodeArgs); @@ -653,7 +653,7 @@ public: template void VPMULHWOp(OpcodeArgs); - template + template void VPMULLOp(OpcodeArgs); void VPSADBWOp(OpcodeArgs); @@ -801,7 +801,7 @@ public: template void PACKSSOp(OpcodeArgs); - template + template void PMULLOp(OpcodeArgs); template @@ -830,7 +830,7 @@ public: void PMULHRSW(OpcodeArgs); void MOVBEOp(OpcodeArgs); - template + template void HSUBP(OpcodeArgs); template void PHSUB(OpcodeArgs); @@ -1375,7 +1375,7 @@ private: Ref ExtendVectorElementsImpl(OpcodeArgs, IR::OpSize ElementSize, IR::OpSize DstElementSize, bool Signed); - Ref HSUBPOpImpl(OpSize Size, size_t ElementSize, Ref Src1, Ref Src2); + Ref HSUBPOpImpl(OpSize Size, IR::OpSize ElementSize, Ref Src1, Ref Src2); Ref InsertPSOpImpl(OpcodeArgs, const X86Tables::DecodedOperand& Src1, const X86Tables::DecodedOperand& Src2, const X86Tables::DecodedOperand& Imm); @@ -1406,7 +1406,7 @@ private: Ref PMULHWOpImpl(OpcodeArgs, bool Signed, Ref Src1, Ref Src2); - Ref PMULLOpImpl(OpSize Size, size_t ElementSize, bool Signed, Ref Src1, Ref Src2); + Ref PMULLOpImpl(OpSize Size, IR::OpSize ElementSize, bool Signed, Ref Src1, Ref Src2); Ref PSADBWOpImpl(IR::OpSize Size, Ref Src1, Ref Src2); diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher/H0F38Tables.h b/FEXCore/Source/Interface/Core/OpcodeDispatcher/H0F38Tables.h index 2f4e9ee5b..8ae2a47a8 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher/H0F38Tables.h +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher/H0F38Tables.h @@ -49,7 +49,7 @@ constexpr std::tuple OpDis {OPD(PF_38_66, 0x23), 1, &OpDispatchBuilder::ExtendVectorElements}, {OPD(PF_38_66, 0x24), 1, &OpDispatchBuilder::ExtendVectorElements}, {OPD(PF_38_66, 0x25), 1, &OpDispatchBuilder::ExtendVectorElements}, - {OPD(PF_38_66, 0x28), 1, &OpDispatchBuilder::PMULLOp<4, true>}, + {OPD(PF_38_66, 0x28), 1, &OpDispatchBuilder::PMULLOp}, {OPD(PF_38_66, 0x29), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VCMPEQ, OpSize::i64Bit>}, {OPD(PF_38_66, 0x2A), 1, &OpDispatchBuilder::MOVVectorNTOp}, {OPD(PF_38_66, 0x2B), 1, &OpDispatchBuilder::PACKUSOp}, diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher/SecondaryTables.h b/FEXCore/Source/Interface/Core/OpcodeDispatcher/SecondaryTables.h index 5a3a7851c..bd15a0912 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher/SecondaryTables.h +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher/SecondaryTables.h @@ -131,7 +131,7 @@ constexpr std::tuple OpDisp {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>}, + {0xF4, 1, &OpDispatchBuilder::PMULLOp}, {0xF5, 1, &OpDispatchBuilder::PMADDWD}, {0xF6, 1, &OpDispatchBuilder::PSADBW}, {0xF7, 1, &OpDispatchBuilder::MASKMOVOp}, @@ -196,7 +196,7 @@ constexpr std::tuple OpDisp {0x5F, 1, &OpDispatchBuilder::VectorScalarInsertALUOp}, {0x70, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::PSHUFWOp, true>}, {0x7C, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VFADDP, OpSize::i32Bit>}, - {0x7D, 1, &OpDispatchBuilder::HSUBP<4>}, + {0x7D, 1, &OpDispatchBuilder::HSUBP}, {0xD0, 1, &OpDispatchBuilder::ADDSUBPOp}, {0xD6, 1, &OpDispatchBuilder::MOVQ2DQ}, {0xC2, 1, &OpDispatchBuilder::InsertScalarFCMPOp}, @@ -254,7 +254,7 @@ constexpr std::tuple OpDisp {0x76, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VCMPEQ, OpSize::i32Bit>}, {0x78, 1, nullptr}, // GROUP 17 {0x7C, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorALUOp, IR::OP_VFADDP, OpSize::i64Bit>}, - {0x7D, 1, &OpDispatchBuilder::HSUBP<8>}, + {0x7D, 1, &OpDispatchBuilder::HSUBP}, {0x7E, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::MOVBetweenGPR_FPR, OpDispatchBuilder::VectorOpType::SSE>}, {0x7F, 1, &OpDispatchBuilder::MOVVectorAlignedOp}, {0xC2, 1, &OpDispatchBuilder::VFCMPOp}, @@ -298,7 +298,7 @@ constexpr std::tuple OpDisp {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>}, + {0xF4, 1, &OpDispatchBuilder::PMULLOp}, {0xF5, 1, &OpDispatchBuilder::PMADDWD}, {0xF6, 1, &OpDispatchBuilder::PSADBW}, {0xF7, 1, &OpDispatchBuilder::MASKMOVOp}, diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher/Vector.cpp b/FEXCore/Source/Interface/Core/OpcodeDispatcher/Vector.cpp index ce90c7190..e81fafe0f 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher/Vector.cpp +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher/Vector.cpp @@ -2933,7 +2933,7 @@ void OpDispatchBuilder::VPACKSSOp(OpcodeArgs, IR::OpSize ElementSize) { StoreResult(FPRClass, Op, Result, OpSize::iInvalid); } -Ref OpDispatchBuilder::PMULLOpImpl(OpSize Size, size_t ElementSize, bool Signed, Ref Src1, Ref Src2) { +Ref OpDispatchBuilder::PMULLOpImpl(OpSize Size, IR::OpSize ElementSize, bool Signed, Ref Src1, Ref Src2) { if (Size == OpSize::i64Bit) { if (Signed) { return _VSMull(OpSize::i128Bit, ElementSize, Src1, Src2); @@ -2952,7 +2952,7 @@ Ref OpDispatchBuilder::PMULLOpImpl(OpSize Size, size_t ElementSize, bool Signed, } } -template +template void OpDispatchBuilder::PMULLOp(OpcodeArgs) { static_assert(ElementSize == sizeof(uint32_t), "Currently only handles 32-bit -> 64-bit"); @@ -2966,7 +2966,7 @@ void OpDispatchBuilder::PMULLOp(OpcodeArgs) { template void OpDispatchBuilder::PMULLOp(OpcodeArgs); template void OpDispatchBuilder::PMULLOp(OpcodeArgs); -template +template void OpDispatchBuilder::VPMULLOp(OpcodeArgs) { static_assert(ElementSize == sizeof(uint32_t), "Currently only handles 32-bit -> 64-bit"); @@ -3041,7 +3041,7 @@ template void OpDispatchBuilder::VADDSUBPOp(OpcodeArgs); template void OpDispatchBuilder::VADDSUBPOp(OpcodeArgs); void OpDispatchBuilder::PFNACCOp(OpcodeArgs) { - auto Size = GetSrcSize(Op); + const auto Size = OpSizeFromSrc(Op); Ref Dest = LoadSource(FPRClass, Op, Op->Dest, Op->Flags); Ref Src = LoadSource(FPRClass, Op, Op->Src[0], Op->Flags); @@ -3356,13 +3356,13 @@ void OpDispatchBuilder::VPMULHRSWOp(OpcodeArgs) { StoreResult(FPRClass, Op, Result, OpSize::iInvalid); } -Ref OpDispatchBuilder::HSUBPOpImpl(OpSize SrcSize, size_t ElementSize, Ref Src1, Ref Src2) { +Ref OpDispatchBuilder::HSUBPOpImpl(OpSize SrcSize, IR::OpSize ElementSize, Ref Src1, Ref Src2) { auto Even = _VUnZip(SrcSize, ElementSize, Src1, Src2); auto Odd = _VUnZip2(SrcSize, ElementSize, Src1, Src2); return _VFSub(SrcSize, ElementSize, Even, Odd); } -template +template void OpDispatchBuilder::HSUBP(OpcodeArgs) { Ref Src1 = LoadSource(FPRClass, Op, Op->Dest, Op->Flags); Ref Src2 = LoadSource(FPRClass, Op, Op->Src[0], Op->Flags); @@ -3373,7 +3373,7 @@ void OpDispatchBuilder::HSUBP(OpcodeArgs) { template void OpDispatchBuilder::HSUBP(OpcodeArgs); template void OpDispatchBuilder::HSUBP(OpcodeArgs); -void OpDispatchBuilder::VHSUBPOp(OpcodeArgs, size_t ElementSize) { +void OpDispatchBuilder::VHSUBPOp(OpcodeArgs, IR::OpSize ElementSize) { const auto DstSize = GetDstSize(Op); const auto Is256Bit = DstSize == Core::CPUState::XMM_AVX_REG_SIZE; diff --git a/FEXCore/Source/Interface/IR/IR.json b/FEXCore/Source/Interface/IR/IR.json index 2d037d191..f4a7f6b19 100644 --- a/FEXCore/Source/Interface/IR/IR.json +++ b/FEXCore/Source/Interface/IR/IR.json @@ -2211,7 +2211,7 @@ "DestSize": "RegisterSize", "NumElements": "RegisterSize / ElementSize" }, - "FPR = VUnZip u8:#RegisterSize, u8:#ElementSize, FPR:$VectorLower, FPR:$VectorUpper": { + "FPR = VUnZip OpSize:#RegisterSize, OpSize:#ElementSize, FPR:$VectorLower, FPR:$VectorUpper": { "DestSize": "RegisterSize", "NumElements": "RegisterSize / ElementSize" },