Not exactly the way that you have written it, no.
You can't use brackets with the 'cmp' instruction. The brackets mean use
the register contents as a pointer to an address in memory. Only the 'ld'
and 'st' group of instructions can do that.
You also can't do arithmatic like that in the same instruction. The
assembler allows it for some types of addressing modes, but again, that only
works in the 'ld' and 'st' instrucitons.
I hope that helps.
:-)
Bettina
Post by ahmad faizal arifi have a question, can you compare the value in register directly in
assembly language?
e.g. cmp [%r2 - 1], [%r2]
thanks.