mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 07:00:20 +02:00
Merge pull request #5864 from simon902/pf2id_saturation
Fix pf2id overflow saturation
This commit is contained in:
5 files changed
+32
-3
No files matched your search
@@ -799,6 +799,7 @@ public:
|
||||
void VPFCMPOp(OpcodeArgs, uint8_t CompType);
|
||||
void PI2FWOp(OpcodeArgs);
|
||||
void PF2IWOp(OpcodeArgs);
|
||||
void PF2IDOp(OpcodeArgs);
|
||||
|
||||
void PMULHRWOp(OpcodeArgs);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ constexpr DispatchTableEntry OpDispatch_DDDTable[] = {
|
||||
{0x0C, 1, &OpDispatchBuilder::PI2FWOp},
|
||||
{0x0D, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::Vector_CVT_Int_To_Float, OpSize::i32Bit, false, false>},
|
||||
{0x1C, 1, &OpDispatchBuilder::PF2IWOp},
|
||||
{0x1D, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::Vector_CVT_Float_To_Int, OpSize::i32Bit, false, false>},
|
||||
{0x1D, 1, &OpDispatchBuilder::PF2IDOp},
|
||||
|
||||
{0x86, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::VectorUnaryOp, IR::OP_VFRECPPRECISION, OpSize::i32Bit>},
|
||||
{0x87, 1, &OpDispatchBuilder::Bind<&OpDispatchBuilder::RSqrt3DNowOp, false>},
|
||||
|
||||
@@ -3592,6 +3592,16 @@ void OpDispatchBuilder::PF2IWOp(OpcodeArgs) {
|
||||
StoreResultFPR_WithOpSize(Op, Op->Dest, Src, Size);
|
||||
}
|
||||
|
||||
void OpDispatchBuilder::PF2IDOp(OpcodeArgs) {
|
||||
Ref Src = LoadSourceFPR(Op, Op->Src[0], Op->Flags);
|
||||
|
||||
const auto Size = OpSizeFromDst(Op);
|
||||
|
||||
Src = _Vector_FToZS(Size, OpSize::i32Bit, Src);
|
||||
|
||||
StoreResultFPR_WithOpSize(Op, Op->Dest, Src, Size);
|
||||
}
|
||||
|
||||
void OpDispatchBuilder::PMULHRWOp(OpcodeArgs) {
|
||||
const auto Size = OpSizeFromSrc(Op);
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
%ifdef CONFIG
|
||||
{
|
||||
"RegData": {
|
||||
"MM0": "0x800000007FFFFFFF"
|
||||
},
|
||||
"HostFeatures": ["3DNOW"]
|
||||
}
|
||||
%endif
|
||||
|
||||
; +3000000000.0f > INT32_MAX -> saturate to 0x7FFFFFFF
|
||||
; -3000000000.0f < INT32_MIN -> saturate to 0x80000000
|
||||
pf2id mm0, [rel data1]
|
||||
|
||||
hlt
|
||||
|
||||
align 8
|
||||
data1:
|
||||
dd 0x4F32D05E ; +3000000000.0f
|
||||
dd 0xCF32D05E ; -3000000000.0f
|
||||
@@ -67,7 +67,7 @@
|
||||
]
|
||||
},
|
||||
"pf2id mm0, mm1": {
|
||||
"ExpectedInstructionCount": 8,
|
||||
"ExpectedInstructionCount": 7,
|
||||
"Comment": [
|
||||
"0x0f 0x0f 0x1d"
|
||||
],
|
||||
@@ -76,7 +76,6 @@
|
||||
"mov w20, #0xffff",
|
||||
"strb w20, [x28, #1202]",
|
||||
"ldr d2, [x28, #1072]",
|
||||
"frint32z v2.4s, v2.4s",
|
||||
"fcvtzs v2.2s, v2.2s",
|
||||
"str d2, [x28, #1056]",
|
||||
"strh w20, [x28, #1064]"
|
||||
|
||||
Reference in new issue
Block a user