How does the JE instruction work without CMP?
.L10:
leal (%rsi,%rsi,4), %edx
movsbl %al,%eax
addq $1, %rdi
leal -48(%rax,%rdx,2), %esi
je 开发者_开发技巧.L3
In the above there's no cmp
preceding je
. How does it work here?
je
will jump isZF = 1
.add
modifies theZF
.lea
,movsb
does not affect any flags.
Keep the Intel 64 and IA32 Architecture Developer's Manual in hand. You can find all the instruction details of Intel 64 and IA32 architecture in the manual Volume 2
je
jumps if the ZF flag is set in the EFLAGS register. The value of the ZF flag is set by the previous (for example cmp
) operation that modified it.
Since neither lea
nor movsbl
modify the ZF flag, but add
does (compare Intel Developer's Manual, 3-36), je
jumps to .L3
iff $1 + %rdi
is zero.
The preceding instruction sets a processor status flag. Each conditional jump checks a certain flag, even if a cmp
was not executed. I believe je
executes if the zero flag is set.
精彩评论