[LLVMdev] [PATCH] x86: disambiguate unqualified btr, bts

Ramkumar Ramachandra artagnon at gmail.com
Sun Jul 14 01:44:26 PDT 2013


Stephen Checkoway wrote:
> [...]

Thanks for the absolutely splendid analysis!

> For the memory, immediate form without the suffix, it seems like the options are
> 1. If the immediate value is in [0,15], use btsl/btrl since it saves a byte, otherwise error;
> 2. Follow both gas's behavior and the Solaris assembler manual Jim Grosbach linked to which stated that unsuffixed instructions are assumed to be long and alias bts to btsl and btr to btrl; or
> 3. Always error even when there is no ambiguity.
>
> I have no opinion on which option LLVM should follow.

Okay, so while digging through the history of the linux.git tree, I
found this.  The patch _replaces_ btrl instructions with btr
instructions, for seemingly good reason.  What is your opinion on the
issue?

commit 1c54d77078056cde0f195b1a982cb681850efc08
Author: Jeremy Fitzhardinge <jeremy at goop.org>
Date:   5 years ago

    x86: partial unification of asm-x86/bitops.h

    This unifies the set/clear/test bit functions of asm/bitops.h.

    I have not attempted to merge the bit-finding functions, since they
    rely on the machine word size and can't be easily restructured to work
    generically without a lot of #ifdefs.  In particular, the 64-bit code
    can assume the presence of conditional move instructions, whereas
    32-bit needs to be more careful.

    The inline assembly for the bit operations has been changed to remove
    explicit sizing hints on the instructions, so the assembler will pick
    the appropriate instruction forms depending on the architecture and
    the context.

    Signed-off-by: Jeremy Fitzhardinge <jeremy at xensource.com>
    Cc: Andi Kleen <ak at suse.de>
    Cc: Linus Torvalds <torvalds at linux-foundation.org>

    Signed-off-by: Ingo Molnar <mingo at elte.hu>
    Signed-off-by: Thomas Gleixner <tglx at linutronix.de>



More information about the llvm-dev mailing list