This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: commutative asm operands
On Mon, Aug 05, 2002 at 07:16:10AM +0930, Alan Modra wrote:
> On Sun, Aug 04, 2002 at 06:29:19PM +0200, Roman Zippel wrote:
> > Alan Modra wrote:
> > > * recog.c (constrain_operands): Handle commutative operands.
> >
> > What exactly does this patch fix?
>
> The ICE reported at the beginning of this thread, and the following
> similar one.
>
> > What is the assembly output for this test case (register names might
> > need a change):
>
> Thanks, this testcase is useful.
>
> void f (void)
> {
> register int a asm ("%r3");
> register int b asm ("%r4");
> register int c asm ("%r5");
> register int d asm ("%r6");
>
> asm volatile ("addc %0, %2, %3\n\tadde %1, %4, %5"
> : "=r" (a), "=r" (b)
> : "%0" (a), "r" (c), "%1" (b), "r" (d));
> asm volatile ("addc %0, %2, %3\n\tadde %1, %4, %5"
> : "=r" (a), "=r" (b)
> : "%0" (c), "r" (a), "%1" (d), "r" (b));
> }
>
> produces, with my patch:
>
> .f:
> #APP
> addc 3, 3, 5
> adde 4, 4, 6
> addc 3, 5, 3
> adde 4, 4, 6
> #NO_APP
> blr
and with yours:
.f:
#APP
addc 3, 3, 5
adde 4, 4, 6
addc 3, 3, 5
adde 4, 4, 6
#NO_APP
blr
I suspect your fix would never generate the "addc 3,5,3" case, which
is probably a good thing in that the rest of the compiler never needs
to worry about "%" constraints.
--
Alan Modra
IBM OzLabs - Linux Technology Centre