This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]