From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26389 invoked by alias); 30 Oct 2002 22:46:03 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 26332 invoked by uid 71); 30 Oct 2002 22:46:02 -0000 Date: Wed, 30 Oct 2002 14:46:00 -0000 Message-ID: <20021030224602.26317.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Michael Matz Subject: Re: optimization/6162: gcc 3.0.4: certain i386 asm reloader ice Reply-To: Michael Matz X-SW-Source: 2002-10/txt/msg01276.txt.bz2 List-Id: The following reply was made to PR optimization/6162; it has been noted by GNATS. From: Michael Matz To: Kevin Ryde Cc: Nathanael Nerode , , , , =?iso-8859-1?q?Torbj=F6rn?= Granlund Subject: Re: optimization/6162: gcc 3.0.4: certain i386 asm reloader ice Date: Wed, 30 Oct 2002 23:38:45 +0100 (CET) Hi, On Thu, 31 Oct 2002, Kevin Ryde wrote: > > Well, to find it is quite easy. reload is inherently incapable of > > handling more than one commutative operand, but there are two of them in > > the asm. If you are unlucky both of them would need to be swapped to make > > the insn valid, and this is what breaks reload, as it only can swap the > > last pair. I don't know why this constraint isn't documented, but anyway, > > that's the reason. > > The stuff in question is from longlong.h actually (shared by GMP and > GCC). All the add_ssaaaa's (or it looks like all) have two > commutatives. Wow. Indeed. Some of them even have such funny things like: __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \ : "=r" ((USItype) (sh)), \ "=&r" ((USItype) (sl)) \ : "%r" ((USItype) (ah)), \ "%r" ((USItype) (al)), \ "rI" ((USItype) (bl))); which obviously is broken, or __asm__ ("addu.co %1,%r4,%r5\n\taddu.ci %0,%r2,%r3" \ : "=r" ((USItype) (sh)), \ "=&r" ((USItype) (sl)) \ : "%rJ" ((USItype) (ah)), \ "rJ" ((USItype) (bh)), \ "%rJ" ((USItype) (al)), \ "rJ" ((USItype) (bl))) which is useless (they have the same constraints, so commutativity doesn't matter at all). Some of them probably are just lucky, like: __asm__ ("add.f %1, %4, %5\n\tadc %0, %2, %3" \ : "=r" ((USItype) (sh)), \ "=&r" ((USItype) (sl)) \ : "%r" ((USItype) (ah)), \ "rIJ" ((USItype) (bh)), \ "%r" ((USItype) (al)), \ "rIJ" ((USItype) (bl))) If called with only variables, or constants already in the right operands, the swapping also doesn't take place. But if then also operand matching comes into play (like some asms in longlong and also your example) the chance of getting unlucky is even higher. Anyway given that longlong.h uses it I again looked into reload, and no, it simply can't handle correctly more than one pair which needs swapping. It keeps track of only one operand which is commutative (the 'commutative' variable), and it only tries each alternative twice at most (once normally and once with the last pair swapped). Therefore I think longlong.h is broken, but I wonder why this never popped up. Ciao, Michael.