How is the ">" operator implemented (for 32-bit integers)?
Let's say the x86 environment.
How compilers compile the ">" operator on 32-bit integers. Logically, I mean. Without any build knowledge.
Assume a high-level language code:
int32 x, y;
x = 123;
y = 456;
bool z;
z = x > y;
What does the compiler do to evaluate the expression x > y?
This does something like (assuming x and y are positive integers):
w = sign_of(x - y);
if (w == 0)
// expression is 'false'
else if (w == 1)
// expression is 'true'
else
// expression is 'false'
Is there a link to such information?
x86 ( , ) , . , , - , >,> =, =, <=, <
, , , , (ZF = 1). , a <b ( ), , a - b ( CF = 1). x86:
JE Jump if equal ZF = 1
JZ Jump if zero
JNE Jump if not equal ZF = 0
JNZ Jump if not zero
JB Jump if below unsigned CF = 1
JNAE Jump if not above or equal
JC Jump if carry
JNB Jump if not below unsigned CF = 0
JAE Jump if above or equal
JNC Jump if not carry
JBE Jump if below or equal unsigned CF = 1 or ZF = 1
JNA Jump if not above
JA Jump if above unsigned CF = 0 and ZF = 0
JNBE Jump if not below or equal
( MIPS) , - , . . , , - ; , , ,
