Does anyone know how I can get rid of the following assembler warning?
Code is x86, 32 bit:
int test (int x)
{
int y;
// do a bit-rotate by 8 on
You can use %w0 if I remember right. I just tested it, too. :-)
int
test(int x)
{
int y;
asm ("rorw $8, %w0" : "=q" (y) : "0" (x));
return y;
}
Edit: In response to the OP, yes, you can do the following too:
int
test(int x)
{
int y;
asm ("xchg %b0, %h0" : "=Q" (y) : "0" (x));
return y;
}
For x86 it's documented in the x86 Operand Modifiers section of the Extended Asm part of the manual.
For non-x86 instruction sets, you may have to dig through their .md files in the GCC source. For example, gcc/config/i386/i386.md was the only place to find this before it was officially documented.
(Related: In GNU C inline asm, what are the size-override modifiers for xmm/ymm/zmm for a single operand? for vector registers.)