Home > Software engineering >  Are comparison flags cleared after a jump in assembly?
Are comparison flags cleared after a jump in assembly?

Time:11-12

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 ?

CodePudding user response:

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
  • Related