diff --git a/unittests/32Bit_ASM/FEX_bugs/InvertedCarrySet.asm b/unittests/32Bit_ASM/FEX_bugs/InvertedCarrySet.asm new file mode 100644 index 0000000000..16d83ded99 --- /dev/null +++ b/unittests/32Bit_ASM/FEX_bugs/InvertedCarrySet.asm @@ -0,0 +1,20 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "1" + }, + "Mode": "32BIT" +} +%endif + +; FEX had a bug where inverting CF to match the ABI when flushing the register cache didn't mark CF as possibly being set. +; This caused accesses relying on that flag to be set correctly to return wrong values. +and al,cl ; Zeros CF, non-inverted +push ecx ; Triggers a register cache flush +inc eax ; Tries to preserve CF, but would encounter the bug and set it instead +jnb succ +mov eax, 0 +hlt +succ: +mov eax, 1 +hlt