|Stack and calling convention questions firstname.lastname@example.org (Thelonious Georgia) (1999-08-01)|
|Re: Stack and calling convention questions email@example.com (1999-08-07)|
|Re: Stack and calling convention questions firstname.lastname@example.org (Tzvetan Mikov) (1999-08-12)|
|From:||"Tzvetan Mikov" <email@example.com>|
|Date:||12 Aug 1999 02:59:56 -0400|
|Organization:||Posted via Supernews, http://www.supernews.com|
RKRayhawk wrote in message 99-08-037...
>But more importantly the XOR instruction is testing the EAX register.
>It is a nearly universal convention that EAX is used as the result
>register of simple scalars in C subroutine interfaces. (Not
>always. Sometimes larger entities must land in EAX/EDX.) So the XOR is
>testing the result.
>The XOR instruction will set the PF, SF and ZF. In effect the meaning
>of the contents of EAX is transfered to the status register, where it
>can subsequently be used for branches.
I don't think XOR is used for testing the register. "xor eax,eax" is
primarily used to clear a register, while testing is done with "or eax,eax"
or "test eax,eax".
Hypothetically, If the calling convention allowed using flags for return
values, "xor eax,eax" could be used instead of
mov eax, 0
or eax, eax
in order to set the value and the flags, so in this sense it would be
Btw, is there any compiler for x86 that utilizes flags for function
return values? May be Watcom C (it is pretty flexible in this regard)?
Now, for the superscalar x86-s this doesn't make much sense because it
would introduce a too strict dependancy. In the pre-Pentium days
however I can imagine a big space and perfrormance win. All functions
returning _bool_ and many C library functions which must be tested for
Return to the
Search the comp.compilers archives again.