سؤال

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