This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: (forw) Re: (forw) pr5649 on powerpc (broken splitters)
- From: Geoff Keating <geoffk at geoffk dot org>
- To: matz at kde dot org
- Cc: pthomas at suse dot de
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 9 Mar 2002 13:00:51 -0800
- Subject: Re: (forw) Re: (forw) pr5649 on powerpc (broken splitters)
- References: <Pine.GSO.4.33.0203011807300.9673-100000@platon>
- Reply-to: Geoff Keating <geoffk at redhat dot com>
> Date: Fri, 1 Mar 2002 18:11:58 +0100 (MET)
> From: Michael Matz <matz@kde.org>
> On Fri, 1 Mar 2002, Philipp Thomas wrote:
>
> > ----- Forwarded message from Geoff Keating <geoffk@geoffk.org> -----
> >
> > > sorry to disturb you, but this seems to have escaped your eye, so I'm
> > > forwarding it. David Edelsohn said this would require input from someone
> > > with your knowledge.
> >
> > Didn't I reply to that? Maybe I started a reply and deleted it...
> >
> > It just needs another CLOBBER on the initial pattern, and appropriate
> > changes to the splitter.
> >
> > Actually, it doesn't strictly need another clobber. I can't see an
> > easy way to explain this to GCC, though.
>
> You mean something like the below diff? With that it too doesn't barf on
> the testcase. I actually tested both variants of the insn: Normally it
> takes the first one (because it's cheaper, and one clobber less is
> needed), but I made it more costly (by "=!x,?y" in constraints). After
> that it indeed allocated both clobbers, and used them to make the split
> (and match) work.
I couldn't generate a testcase for this---the obvious
void bar(void);
unsigned foo(int x, unsigned y)
{
if ( ( ((unsigned) - abs (x)) >> 31) + y == 0)
bar();
}
doesn't quite generate the right pattern, combine doesn't seem to want
to fold the COMPARE in; so I'm just committing the following.
Tested on powerpc-eabisim.
--
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>
===File ~/patches/cygnus/rs6000-ne0p4.patch=================
Index: ChangeLog
2002-03-09 Geoffrey Keating <geoffk@redhat.com>
* config/rs6000/rs6000.md (ne0+4): Add extra CLOBBER.
(ne0+5): Use new clobber to generate proper shift pattern.
Patch by Michael Matz <matz@kde.org>.
Index: config/rs6000/rs6000.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.md,v
retrieving revision 1.173
diff -p -u -p -r1.173 rs6000.md
--- rs6000.md 2002/02/27 05:42:20 1.173
+++ rs6000.md 2002/03/09 19:12:29
@@ -11013,7 +11013,8 @@
(const_int 31))
(match_operand:SI 2 "gpc_reg_operand" "r,r"))
(const_int 0)))
- (clobber (match_scratch:SI 3 "=&r,&r"))]
+ (clobber (match_scratch:SI 3 "=&r,&r"))
+ (clobber (match_scratch:SI 4 "=X,&r"))]
"! TARGET_POWERPC64"
"@
{ai|addic} %3,%1,-1\;{aze.|addze.} %3,%2
@@ -11029,12 +11030,14 @@
(const_int 31))
(match_operand:SI 2 "gpc_reg_operand" ""))
(const_int 0)))
- (clobber (match_scratch:SI 3 ""))]
+ (clobber (match_scratch:SI 3 ""))
+ (clobber (match_scratch:SI 4 ""))]
"! TARGET_POWERPC64 && reload_completed"
- [(set (match_dup 3)
- (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
- (const_int 31))
- (match_dup 2)))
+ [(parallel [(set (match_dup 3)
+ (plus:SI (lshiftrt:SI (neg:SI (abs:SI (match_dup 1)))
+ (const_int 31))
+ (match_dup 2)))
+ (clobber (match_dup 4))])
(set (match_dup 0)
(compare:CC (match_dup 3)
(const_int 0)))]
============================================================