Reputation: 63
.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?
Upvotes: 6
Views: 1317
Reputation: 288298
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.
Upvotes: 5
Reputation: 61991
je
will jump is ZF = 1
.add
modifies the ZF
.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
Upvotes: 12
Reputation: 170
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.
Upvotes: 1