Fixes zero register flag generation

Fixes 140976d322

Adds a unit test to ensure it keeps working.
This commit is contained in:
Ryan Houdek 2024-02-24 16:32:25 -08:00
parent d8a18687e8
commit d703f3ccee
No known key found for this signature in database
2 changed files with 20 additions and 2 deletions

View File

@ -5138,8 +5138,9 @@ void OpDispatchBuilder::ALUOpImpl(OpcodeArgs, FEXCore::IR::IROps ALUIROp, FEXCor
Op->Dest.IsGPR() && Op->Src[SrcIdx].IsGPR() &&
Op->Dest.Data.GPR == Op->Src[SrcIdx].Data.GPR) {
StoreResult(GPRClass, Op, _Constant(0), -1);
ZeroNZCV();
auto Result = _Constant(0);
StoreResult(GPRClass, Op, Result, -1);
GenerateFlags_Logical(Op, Result, Result, Result);
return;
}

View File

@ -0,0 +1,17 @@
%ifdef CONFIG
{
"RegData": {
"RAX": "0x0000000000004600"
}
}
%endif
; FEX had a bug where an optimization for canonical zeroing of a register would fail to set flags correctly.
; This broke `Metal Gear Rising: Revengeance`. The title screen geometry was broken.
mov rax, 0
mov rbx, 0
sahf
xor rbx, rbx
lahf
hlt