mirror of
https://github.com/FEX-Emu/FEX.git
synced 2024-12-16 02:17:20 +00:00
Fixes zero register flag generation
Fixes 140976d322
Adds a unit test to ensure it keeps working.
This commit is contained in:
parent
d8a18687e8
commit
d703f3ccee
@ -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;
|
||||
}
|
||||
|
||||
|
17
unittests/ASM/FEX_bugs/xor_flags.asm
Normal file
17
unittests/ASM/FEX_bugs/xor_flags.asm
Normal 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
|
Loading…
Reference in New Issue
Block a user