[RFC] Re: gcc-3.1 ICE on ppc-linux, regression wrt 2.95

Geoff Keating geoffk@geoffk.org
Thu Apr 25 17:23:00 GMT 2002


> cc: gcc-patches@gcc.gnu.org
> Date: Thu, 25 Apr 2002 15:46:02 -0400
> From: David Edelsohn <dje@watson.ibm.com>
> 
> 	The ICE is caused by a splitter trying to handle a pattern where
> we could not allocate cr0 for an implicit condition set and instead needed
> to re-split the instruction.  For most patterns like this, the original
> pattern without the compare did not need a CLOBBER, but this pattern does.
> 
> 	A problem is that the pattern without the compare needs one
> CLOBBER and the pattern with the compare also needs only one CLOBBER.  In
> the splitter, the CLOBBER is the intermediate result to be compared.
> 
> 	The question is how to create the additional CLOBBER.  The
> splitter only runs after reload, so we cannot create another pseudo.  We
> also know that in the overall sequence, the intermediate result really is
> dead.  The only options appear to be either list the match_dup twice: once
> as the intermediate result and again as the CLOBBERed reg (which is
> exactly how the compare version of the pattern avoids two CLOBBERS), or
> only allow cr0 for this pattern and disallow a splitter.
> 
> 	The patch below adds the extra CLOBBER and resolves the ICE, but I
> do not know if mentioning the REG as a result and as a CLOBBER is entirely
> safe in the GCC backend even though the use of the register twice in the
> actual sequence of PowerPC instructions is correct.  Anyone know for sure
> what is safe in a define_split?

This doesn't make sense.  You can't have 

(parallel [
   (set (reg foo) something)
   (set (reg foo) something_else)
 ])

even if one of the SETs is a CLOBBER.

I presume, from the description, that actually it is possible to execute

(set (match_dup 4)
     (plus:SI (eq:SI (match_dup 1)
                     (match_dup 2))
              (match_dup 3)))

without any CLOBBER being necessary, in which case there should be a
pattern to do that.

> Thanks, David
> 
> 
> 	* rs6000.md (sCC splitter): Add CLOBBER.
> 
> Index: rs6000.md
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/config/rs6000/rs6000.md,v
> retrieving revision 1.180
> diff -c -p -r1.180 rs6000.md
> *** rs6000.md	23 Apr 2002 00:19:14 -0000	1.180
> --- rs6000.md	25 Apr 2002 19:25:12 -0000
> ***************
> *** 10894,10903 ****
>   	 (const_int 0)))
>      (clobber (match_scratch:SI 4 ""))]
>     "! TARGET_POWERPC64 && reload_completed"
> !   [(set (match_dup 4)
>   	(plus:SI (eq:SI (match_dup 1)
>   		 (match_dup 2))
>   	  (match_dup 3)))
>      (set (match_dup 0)
>   	(compare:CC (match_dup 4)
>   		    (const_int 0)))]
> --- 11131,11141 ----
>   	 (const_int 0)))
>      (clobber (match_scratch:SI 4 ""))]
>     "! TARGET_POWERPC64 && reload_completed"
> !   [(parallel [(set (match_dup 4)
>   	(plus:SI (eq:SI (match_dup 1)
>   		 (match_dup 2))
>   	  (match_dup 3)))
> +    (clobber (match_dup 4))])
>      (set (match_dup 0)
>   	(compare:CC (match_dup 4)
>   		    (const_int 0)))]
> 


-- 
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>



More information about the Gcc-patches mailing list