On Wed, Feb 20, 2019 at 10:08:07AM -0600, Peter Bergner wrote: > On 2/19/19 9:09 PM, Alan Modra wrote: > > On Mon, Feb 18, 2019 at 01:13:31PM -0600, Peter Bergner wrote: > >> long input; > >> long > >> bug (void) > >> { > >> register long output asm ("r3"); > >> asm ("blah %0, %1, %2" : "=&r" (output) : "r" (input), "0" (input)); > >> return output; > >> } > >> > >> I know an input operand can have a matching constraint associated with > >> an early clobber operand, as there seems to be code that explicitly > >> mentions this scenario. In this case, the user has to manually ensure > >> that the input operand is not clobbered by the early clobber operand. > >> In the case that the input operand uses an "r" constraint, we just > >> ensure that the early clobber operand and the input operand are assigned > >> different registers. My question is, what about the case above where > >> we have the same variable being used for two different inputs with > >> constraints that seem to be incompatible? > > > > Without the asm("r3") gcc will provide your "blah" instruction with > > one register for %0 and %2, and another register for %1. Both > > registers will be initialised with the value of "input". > > That's not what I'm seeing. I see one pseudo (123) used for the output > operand and one pseudo (121) used for both input operands. Like so:
I meant by the time you get to assembly. blah 3, 9, 3 > 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; } -- Alan Modra Australia Development Lab, IBM