r206963 - [ARM64] Change inline assembly constraints to be more lax, to match the behaviour of Clang/AArch64 and GCC.

Jim Grosbach grosbach at apple.com
Fri Apr 25 13:54:13 PDT 2014


On Apr 24, 2014, at 1:49 AM, Tim Northover <t.p.northover at gmail.com> wrote:

> On 24 April 2014 00:35, Jim Grosbach <grosbach at apple.com> wrote:
>> I share Eric’s concern here. As I recall, the spec from ARM was very clear on this point, requiring a modifier to specify anything other than a 64-bit GPR. Matching the behavior of GCC is not a sufficient reason to change that unless the specification changed as well.
> 
> Unfortunately, that spec doesn't seem to have made it to GCC, either
> in code or in documentation form.

I don’t think that’s true, actually. Rather, someone decided to change it. The word we got was, which I was told mirrored the GCC implementation at the time, "Note that general register operands will be output using their 64-bit x register name, whatever the size of the variable, unless the asm operand is prefixed by the %w modifier."

> Personally, I don't think GPR64 has any more claim to being general
> purpose than GPR32. The options I'd favour are to *require* an operand
> modifier in all cases (I'm always in favour of explicit assembly), or
> what GCC actually does by inferring the size. The first is clearly not
> viable though.

As Eric says, this is a 64-bit arch, so having ‘r’ mean 64 bits seems reasonable. I also quite agree that this is a very good place to be strict. Requiring the modifier has helped us catch many bugs that otherwise would have taken who knows how long to track down.

-Jim



More information about the cfe-commits mailing list