문제

Is it possible to do comparison between two integer immediates, such as cmp $1, $2 or test $1, $2?

I keep getting error messages from gcc/as, saying "suffix or operands invalid for cmp". The exact line is

cmpq $2, $1001
도움이 되었습니까?

해결책

x86 require no matter when one of the operands is a register, so this is impossible.

Suggestion: since it is two immediates and if your code isn't self-modifying, you can base on the result and hand-optimise the remaining code and replace operations that reads the flags with ones that does not appropriately.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top