It seems that Y86 does not have cmp
instruction. However, it has sub
, push
and pop
.
So cmpl %ebx, %ecx
can be converted to the following code:
pushl %ecx
subl %ebx, %ecx
popl %ecx
cmp
is exactly the same as sub
, with the difference that cmp
does not store the result, it only updates the flags. So cmp
can always be replaced with push
, sub
, pop
(if there's enough space in the stack).