This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: commutative asm operands
- From: Roman Zippel <zippel at linux-m68k dot org>
- To: Alan Modra <amodra at bigpond dot net dot au>
- Cc: gcc at gcc dot gnu dot org, <rth at redhat dot com>
- Date: Wed, 7 Aug 2002 01:16:40 +0200 (CEST)
- Subject: Re: commutative asm operands
Hi,
On Tue, 6 Aug 2002, Alan Modra wrote:
> > The "3, 5, 3" line isn't correct, it's conflicting with the constraints.
>
> Oh? This is from (doing some renumbering of constraints)
>
> asm ("addc %0, %1, %2" : "=r" (a) : "%0" (c), "r" (a));
>
> Or expanding the "%" constraint:
>
> asm ("addc %0, %1, %2" : "=r,r" (a) : "0,r" (c), "r,0" (a));
>
> Tell me why this conflicts.
While thinking more about it, I think it's not really correct to exchange
the constraint, reload should only try to exchange the operands, e.g.
asm("add %0,%2" : "=r" (a) : "%0" (b), "g" (c));
has to work as well. An example like is mentioned in the docs, the first
and second operand must be the same, otherwise you'll break some machines.
Richard, could you please confirm/correct this?
bye, Roman