On Mar 24, 2009, at 11:02 AM, Rodrigo Dominguez wrote:
When assembling this program, 'cc1' emits a 'shrl %ecx, %eax' instruction. The 'shr' instruction can only take an 8-bit register as the first operand. The emitted instruction should have been 'shrl %cl, %eax'. Therefore, the
compilation fails with a 'suffix or operands invalid for shr' message.

I have 2 questions:

1. AFAIK, by default, __asm__ chooses a register according to the size of
the operand (int8_t in this case). Is this correct? Where can I find
documentation of this?

Though several people responded with useful information, no one has answered the question. The issue here is that "-s" has int type, not int8_t because of C promotion rules. Try using (int8_t)(-s).


-Chris

Reply via email to