[PATCH] D96632: [THUMB2] add .w suffixes for ldr/str w/ immediates

Renato Golin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 15 04:51:31 PST 2021


rengolin added a comment.

In D96632#2563111 <https://reviews.llvm.org/D96632#2563111>, @DavidSpickett wrote:

>   A8.1.3 Instruction encodings
>   
>   For example, the assembler
>   syntax documented for the 32-bit Thumb AND (register) encoding includes the .W qualifier to ensure that the
>   32-bit encoding is selected even for the small proportion of operand combinations for which the 16-bit
>   encoding is also available.
>
> Which is not a great example because when I tested this with gcc, it would prefer 16 bit encodings in most situations
> that I could come up with. However, AND has conditions for being in or out of an IT block so that might be higher priority than any .w encoding.

Note that "the assembler" in the quoted text is not GAS specifically. It is the rule that any "conforming" arm assembler must follow.

However, avoiding this particular rule won't generate execution errors, just pick the wrong encoding for the exact same instruction, so if GAS is picking the wrong encoding, it probably decided it was worth it.

This doesn't mean LLVM should do the same. We strongly prefer to follow the rules of the architecture manuals, when available.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96632/new/

https://reviews.llvm.org/D96632



More information about the llvm-commits mailing list