The C compiler uses FUCOMIP instead of FCOMP for x86 and UCOMISD for x64.
Both FUCOMIP and UCOMISD set the zero, parity and carry flags so you don't have to store the status word in this case.
The parity flag is evaluated first. If it is set, the compared values are not equal.
If parity is not set, the zero flag is evaluated. It it is set, the compared values are equal, if not they are not equal.
So the code would look something like
Code: Select all
MOV eax, 1
FUCOMIP st0, st1
JP .False
JZ .True
.False:
XOR eax, eax
.True:
If you do want to use the status word, you can first invert the zero flag and then check the parity and zero flag together.
Code: Select all
FNSTSW ax
XOR ah, 0x40
TEST ah, 0x44
JNZ .False
MOV eax, 1
JMP .True
.False:
XOR eax, eax
.True: