mirror of
https://github.com/FEX-Emu/FEX.git
synced 2024-11-30 10:11:07 +00:00
IR: Change FCmp to use IR::OpSize
This commit is contained in:
parent
fd9158c75f
commit
1a115a8ce6
@ -5037,10 +5037,10 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() {
|
||||
{OPD(1, 0b10, 0x2D), 1, &OpDispatchBuilder::CVTFPR_To_GPR<OpSize::i32Bit, true>},
|
||||
{OPD(1, 0b11, 0x2D), 1, &OpDispatchBuilder::CVTFPR_To_GPR<OpSize::i64Bit, true>},
|
||||
|
||||
{OPD(1, 0b00, 0x2E), 1, &OpDispatchBuilder::UCOMISxOp<4>},
|
||||
{OPD(1, 0b01, 0x2E), 1, &OpDispatchBuilder::UCOMISxOp<8>},
|
||||
{OPD(1, 0b00, 0x2F), 1, &OpDispatchBuilder::UCOMISxOp<4>},
|
||||
{OPD(1, 0b01, 0x2F), 1, &OpDispatchBuilder::UCOMISxOp<8>},
|
||||
{OPD(1, 0b00, 0x2E), 1, &OpDispatchBuilder::UCOMISxOp<OpSize::i32Bit>},
|
||||
{OPD(1, 0b01, 0x2E), 1, &OpDispatchBuilder::UCOMISxOp<OpSize::i64Bit>},
|
||||
{OPD(1, 0b00, 0x2F), 1, &OpDispatchBuilder::UCOMISxOp<OpSize::i32Bit>},
|
||||
{OPD(1, 0b01, 0x2F), 1, &OpDispatchBuilder::UCOMISxOp<OpSize::i64Bit>},
|
||||
|
||||
{OPD(1, 0b00, 0x50), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::MOVMSKOp, OpSize::i32Bit>},
|
||||
{OPD(1, 0b01, 0x50), 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::MOVMSKOp, OpSize::i64Bit>},
|
||||
|
@ -790,7 +790,7 @@ public:
|
||||
void XSaveOp(OpcodeArgs);
|
||||
|
||||
void PAlignrOp(OpcodeArgs);
|
||||
template<size_t ElementSize>
|
||||
template<IR::OpSize ElementSize>
|
||||
void UCOMISxOp(OpcodeArgs);
|
||||
void LDMXCSR(OpcodeArgs);
|
||||
void STMXCSR(OpcodeArgs);
|
||||
@ -980,7 +980,7 @@ public:
|
||||
Ref AVX128_PSIGNImpl(size_t ElementSize, Ref Src1, Ref Src2);
|
||||
template<size_t ElementSize>
|
||||
void AVX128_VPSIGN(OpcodeArgs);
|
||||
template<size_t ElementSize>
|
||||
template<IR::OpSize ElementSize>
|
||||
void AVX128_UCOMISx(OpcodeArgs);
|
||||
void AVX128_VectorScalarInsertALU(OpcodeArgs, FEXCore::IR::IROps IROp, size_t ElementSize);
|
||||
Ref AVX128_VFCMPImpl(size_t ElementSize, Ref Src1, Ref Src2, uint8_t CompType);
|
||||
@ -2078,7 +2078,7 @@ private:
|
||||
}
|
||||
|
||||
// Compares two floats and sets flags for a COMISS instruction
|
||||
void Comiss(size_t ElementSize, Ref Src1, Ref Src2, bool InvalidateAF = false) {
|
||||
void Comiss(IR::OpSize ElementSize, Ref Src1, Ref Src2, bool InvalidateAF = false) {
|
||||
// First, set flags according to Arm FCMP.
|
||||
HandleNZCVWrite();
|
||||
_FCmp(ElementSize, Src1, Src2);
|
||||
|
@ -69,10 +69,10 @@ void OpDispatchBuilder::InstallAVX128Handlers() {
|
||||
{OPD(1, 0b10, 0x2D), 1, &OpDispatchBuilder::AVX128_CVTFPR_To_GPR<OpSize::i32Bit, true>},
|
||||
{OPD(1, 0b11, 0x2D), 1, &OpDispatchBuilder::AVX128_CVTFPR_To_GPR<OpSize::i64Bit, true>},
|
||||
|
||||
{OPD(1, 0b00, 0x2E), 1, &OpDispatchBuilder::AVX128_UCOMISx<4>},
|
||||
{OPD(1, 0b01, 0x2E), 1, &OpDispatchBuilder::AVX128_UCOMISx<8>},
|
||||
{OPD(1, 0b00, 0x2F), 1, &OpDispatchBuilder::AVX128_UCOMISx<4>},
|
||||
{OPD(1, 0b01, 0x2F), 1, &OpDispatchBuilder::AVX128_UCOMISx<8>},
|
||||
{OPD(1, 0b00, 0x2E), 1, &OpDispatchBuilder::AVX128_UCOMISx<OpSize::i32Bit>},
|
||||
{OPD(1, 0b01, 0x2E), 1, &OpDispatchBuilder::AVX128_UCOMISx<OpSize::i64Bit>},
|
||||
{OPD(1, 0b00, 0x2F), 1, &OpDispatchBuilder::AVX128_UCOMISx<OpSize::i32Bit>},
|
||||
{OPD(1, 0b01, 0x2F), 1, &OpDispatchBuilder::AVX128_UCOMISx<OpSize::i64Bit>},
|
||||
|
||||
{OPD(1, 0b00, 0x50), 1, &OpDispatchBuilder::AVX128_MOVMSK<4>},
|
||||
{OPD(1, 0b01, 0x50), 1, &OpDispatchBuilder::AVX128_MOVMSK<8>},
|
||||
@ -1093,7 +1093,7 @@ void OpDispatchBuilder::AVX128_VPSIGN(OpcodeArgs) {
|
||||
[this](size_t _ElementSize, Ref Src1, Ref Src2) { return AVX128_PSIGNImpl(_ElementSize, Src1, Src2); });
|
||||
}
|
||||
|
||||
template<size_t ElementSize>
|
||||
template<IR::OpSize ElementSize>
|
||||
void OpDispatchBuilder::AVX128_UCOMISx(OpcodeArgs) {
|
||||
const auto SrcSize = Op->Src[0].IsGPR() ? GetGuestVectorLength() : OpSizeFromSrc(Op);
|
||||
|
||||
|
@ -59,7 +59,7 @@ constexpr std::tuple<uint8_t, uint8_t, FEXCore::X86Tables::OpDispatchPtr> OpDisp
|
||||
{0x2B, 1, &OpDispatchBuilder::MOVVectorNTOp},
|
||||
{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>},
|
||||
{0x2E, 2, &OpDispatchBuilder::UCOMISxOp<OpSize::i32Bit>},
|
||||
{0x50, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::MOVMSKOp, OpSize::i32Bit>},
|
||||
{0x51, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorUnaryOp, IR::OP_VFSQRT, 4>},
|
||||
{0x52, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorUnaryOp, IR::OP_VFRSQRT, 4>},
|
||||
@ -215,7 +215,7 @@ constexpr std::tuple<uint8_t, uint8_t, FEXCore::X86Tables::OpDispatchPtr> OpDisp
|
||||
{0x2B, 1, &OpDispatchBuilder::MOVVectorNTOp},
|
||||
{0x2C, 1, &OpDispatchBuilder::XMM_To_MMX_Vector_CVT_Float_To_Int<8, true, false>},
|
||||
{0x2D, 1, &OpDispatchBuilder::XMM_To_MMX_Vector_CVT_Float_To_Int<8, true, true>},
|
||||
{0x2E, 2, &OpDispatchBuilder::UCOMISxOp<8>},
|
||||
{0x2E, 2, &OpDispatchBuilder::UCOMISxOp<OpSize::i64Bit>},
|
||||
|
||||
{0x50, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::MOVMSKOp, OpSize::i64Bit>},
|
||||
{0x51, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorUnaryOp, IR::OP_VFSQRT, 8>},
|
||||
|
@ -2855,7 +2855,7 @@ void OpDispatchBuilder::VPALIGNROp(OpcodeArgs) {
|
||||
StoreResult(FPRClass, Op, Result, OpSize::iInvalid);
|
||||
}
|
||||
|
||||
template<size_t ElementSize>
|
||||
template<IR::OpSize ElementSize>
|
||||
void OpDispatchBuilder::UCOMISxOp(OpcodeArgs) {
|
||||
const auto SrcSize = Op->Src[0].IsGPR() ? GetGuestVectorLength() : OpSizeFromSrc(Op);
|
||||
Ref Src1 = LoadSource_WithOpSize(FPRClass, Op, Op->Dest, GetGuestVectorLength(), Op->Flags);
|
||||
|
@ -1668,7 +1668,7 @@
|
||||
"DestSize": "DestElementSize"
|
||||
},
|
||||
|
||||
"FCmp u8:$ElementSize, FPR:$Scalar1, FPR:$Scalar2": {
|
||||
"FCmp OpSize:$ElementSize, FPR:$Scalar1, FPR:$Scalar2": {
|
||||
"Desc": ["Does a scalar unordered compare and sets NZCV accordingly.",
|
||||
"NZCV follows Arm conventions, a separate AXFLAG instruction is required for x86",
|
||||
"Ordering flag result is true if either float input is NaN"
|
||||
|
@ -912,7 +912,7 @@ void X87StackOptimization::Run(IREmitter* Emit) {
|
||||
|
||||
Ref CmpNode {};
|
||||
if (ReducedPrecisionMode) {
|
||||
CmpNode = IREmit->_FCmp(8, StackValue1, StackValue2);
|
||||
CmpNode = IREmit->_FCmp(OpSize::i64Bit, StackValue1, StackValue2);
|
||||
} else {
|
||||
CmpNode = IREmit->_F80Cmp(StackValue1, StackValue2);
|
||||
}
|
||||
@ -928,7 +928,7 @@ void X87StackOptimization::Run(IREmitter* Emit) {
|
||||
|
||||
Ref CmpNode {};
|
||||
if (ReducedPrecisionMode) {
|
||||
CmpNode = IREmit->_FCmp(8, StackNode, ZeroConst);
|
||||
CmpNode = IREmit->_FCmp(OpSize::i64Bit, StackNode, ZeroConst);
|
||||
} else {
|
||||
CmpNode = IREmit->_F80Cmp(StackNode, ZeroConst);
|
||||
}
|
||||
@ -944,7 +944,7 @@ void X87StackOptimization::Run(IREmitter* Emit) {
|
||||
|
||||
Ref CmpNode {};
|
||||
if (ReducedPrecisionMode) {
|
||||
CmpNode = IREmit->_FCmp(8, StackNode, Value);
|
||||
CmpNode = IREmit->_FCmp(OpSize::i64Bit, StackNode, Value);
|
||||
} else {
|
||||
CmpNode = IREmit->_F80Cmp(StackNode, Value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user