Code: Select all
cmp 0,1
je equal
jne not_equal
I just want to know if there is an if statement like there is in C++
that doesn't jump to different locations like CMP does.
Code: Select all
cmp 0,1
je equal
jne not_equal
Code: Select all
je equal
jne not_equal
Code: Select all
je equal
not_equal:
bla eax
bla ebx
jmp rest
equal:
bla ecx
bla edx
rest:
; continue here
Code: Select all
;equivalent to setnae/setb/setc al, or salc
sbb al, al
Code: Select all
; value = (i < j) ? a : b
; while avoiding unnecessary pipeline flushes
mov eax, a
mov edx, b
mov ecx, i
; this is cmp ecx, j; cmovc eax, edx; in 5 386-friendly instructions. no jumps needed.
sub edx, eax
cmp ecx, j
sbb ecx, ecx
and ecx, edx
add eax, ecx
Or just use GCC to produce assembly.bewing wrote:I think it would be very educational for you to take a simple C program with some "if"s in it, compile it with GCC, and then disassemble it with GDB or whatever.