Katoptriss
Katoptriss

Reputation: 107

Are comparison flags cleared after a jump in assembly?

A basic question but I have trouble finding an answer. In assembly, disregarding which one, are the flags used to perform JE, JNE, JL, JG, JLE, JGE usually all cleared after the jump is done ?

Upvotes: 3

Views: 889

Answers (1)

fuz
fuz

Reputation: 93034

Conditional jump instructions do not set flags. So you can for example jump multiple times on the same comparison:

cmp eax, ecx
jl foo         ; if eax < ecx jump to foo
jg bar         ; if eax > ecx jump to bar
jmp baz        ; otherwise jump to baz

Upvotes: 5

Related Questions