This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: commutative asm operands
On Wed, Jul 31, 2002 at 03:48:04PM -0700, Richard Henderson wrote:
> On Wed, Jul 31, 2002 at 11:44:25PM +0930, Alan Modra wrote:
> > I was forwarded a testcase today containing some horrible asm
> >
> > asm ("addc %0, %2, %3\n\t"
> > "adde %1, %4, %5"
> > : "=r" (lo), "=r" (hi)
> > : "%r" (__lo), "0" (lo), "%r" (__hi), "1" (hi))
> >
> > Note the use of "%" with "0"/"1" in the next operand. Is this legal?
>
> Dunno. The x86 port does this the other way around -- puts
> the % with the matching constraint. I.e.
>
> : "%0" (lo), "r"(__lo)
Interesting. That ought to bomb in constrain_operands the same way my
testcase did if gcc ever decides to swap operands. Thinking about it
some more, I reckon it is legal.
: "r,0" (__lo), "0,r" (lo)
seems reasonable and is really the longhand version of the "%"
expression, isn't it?
--
Alan Modra
IBM OzLabs - Linux Technology Centre