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

From: Linus Torvalds
Date: Mon Jul 15 2013 - 14:59:02 EST


On Mon, Jul 15, 2013 at 11:47 AM, H. Peter Anvin <hpa@xxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/