Question regarding constraint usage within inline asm

Peter Bergner
Thu Feb 21 03:03:00 GMT 2019

On 2/20/19 4:04 PM, Alan Modra wrote:
> On Wed, Feb 20, 2019 at 10:08:07AM -0600, Peter Bergner wrote:
>> On 2/19/19 9:09 PM, Alan Modra wrote:
>> That said, talking with Segher and Uli offline, they both think the
>> inline asm usage in the test case should be legal
> Good, it seems we are in agreement.  Incidentally, the single pseudo
> for the inputs happens even for testcases like
> long input;
> long
> bug (void)
> {
>   register long output /* asm ("r3") */;
>   asm ("blah %0, %1, %2" : "=r" (output) : "wi" (input), "0" (input));
>   return output;
> }

This is a different problem than I'm fixing, but you are correct that
asmcons shouldn't replace operand %1 since it has a non-compatible
constraint than the output operand.  In this case, it's probably "ok"
to spill even though it's a hard register, because it doesn't match
the regclass it is supposed to have.  I'm not sure how important
this is to fix.  It can also imagine that this would be hard to
handle, since we'd have to call into the backend to see whether the
two constraints are compatible and with the overlap between different
constraints, that could be very very messy!


More information about the Gcc mailing list