public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* combiner vs. USE
@ 1997-08-19  2:36 Joern Rennecke
  0 siblings, 0 replies; only message in thread
From: Joern Rennecke @ 1997-08-19  2:36 UTC (permalink / raw)
  To: egcs

combine.c currently poses unnecessarily strict constraints on instructions
that feed the last insn.  It allows a single SET with one or more CLOBBERS,
but it doesn't allow a USE.

Consider this testcase:

double f(double d)
{
  int i = 7;
  return (double)i + d;
}

When compiled with ss-970803, configured for target rs6000-ibm-aix4.1,
the int->double conversion uses a pattern that contains some USEs.
Hence, combine refuses to use it as a combined-in feeding instruction for
the floating point addition.
A fix is quite simple and has a profound effect on the compiled code
(using -O2):

--- floatsidf.s-970803	Tue Aug 19 01:37:03 1997
+++ floatsidf.s	Tue Aug 19 02:13:03 1997
@@ -14,7 +14,7 @@
 __gnu_compiled_c:
 .toc
 LC..0:
-	.tc FD_43300000_80000000[TC],1127219200,-2147483648
+	.tc FD_401c0000_0[TC],1075576832,0
 .csect .text[PR]
 	.align 2
 	.globl f
@@ -30,15 +30,8 @@
 	.extern __divus
 	.extern __quoss
 	.extern __quous
-	li 0,7
-	xoris 0,0,0x8000
-	stw 0,28(1)
-	lis 0,0x4330
-	stw 0,24(1)
-	lfd 13,24(1)
 	lfd 0,LC..0(2)
-	fsub 13,13,0
-	fadd 1,1,13
+	fadd 1,1,0
 	blr
 LT..f:
 	.long 0

Here is the gcc source patch.  Most is just updating comments...

Tue Aug 19 02:11:26 1997  J"orn Rennecke <amylaar@cygnus.co.uk>

	* combine.c (can_combine_p): Allow USEs.

*** combine.c-970803-bugfixed	Wed Aug 13 22:37:54 1997
--- combine.c	Tue Aug 19 02:11:26 1997
*************** can_combine_p (insn, i3, pred, succ, pde
*** 826,832 ****
  		      : next_active_insn (insn) == i3);
  
    /* Can combine only if previous insn is a SET of a REG, a SUBREG or CC0.
!      or a PARALLEL consisting of such a SET and CLOBBERs. 
  
       If INSN has CLOBBER parallel parts, ignore them for our processing.
       By definition, these happen during the execution of the insn.  When it
--- 826,832 ----
  		      : next_active_insn (insn) == i3);
  
    /* Can combine only if previous insn is a SET of a REG, a SUBREG or CC0.
!      or a PARALLEL consisting of such a SET and CLOBBERs / USEs.
  
       If INSN has CLOBBER parallel parts, ignore them for our processing.
       By definition, these happen during the execution of the insn.  When it
*************** can_combine_p (insn, i3, pred, succ, pde
*** 851,858 ****
  
  	  switch (GET_CODE (elt))
  	    {
! 	      /* We can ignore CLOBBERs.  */
  	    case CLOBBER:
  	      break;
  
  	    case SET:
--- 851,859 ----
  
  	  switch (GET_CODE (elt))
  	    {
! 	      /* We can ignore CLOBBERs and USEs.  */
  	    case CLOBBER:
+ 	    case USE:
  	      break;
  
  	    case SET:

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-08-19  2:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-08-19  2:36 combiner vs. USE Joern Rennecke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).