[LLVMdev] [PATCH] x86/asm: avoid mnemonics without type suffix

Linus Torvalds torvalds at linux-foundation.org
Mon Jul 15 11:58:56 PDT 2013


On Mon, Jul 15, 2013 at 11:47 AM, H. Peter Anvin <hpa at zytor.com> wrote:
>
> To be fair, we *ought to* be able to do something like:
>
>         asm volatile(LOCK_PREFIX "bts%z0 %1,%0"
>                         : BITOP_ADDR(addr) : "Ir" (nr) : "memory");
>
> ... but some older version of gcc are broken and emit "ll" rather than
> "q".  Furthermore, since that would actually result in *worse* code
> emitted overall (unnecessary REX prefixes), I'm not exactly happy on the
> idea.

I really think the "worse code" argument is the one that matters.

Specifying the size of the operation is *overspecifying* things,
exactly because the 32-bit encoding is actually the *better* one when
possible.

So it's much better to underspecify and let the assembler pick the
best encoding, than it is to use an explicit size and get worse code.

Which is why I brought up the issue of small constants and short
jumps. I really believe this is exactly the same issue.

              Linus



More information about the llvm-dev mailing list