This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

combine patch


I appear to have lost a patch from mainline that I thought I checked in
and so didn't bring over with the rewrite merge. I'll double check that
it's ok to check in.

OK?

2003-05-12 Eric Christopher <echristo@redhat.com>

	* combine.c (expand_compound_operation): Make sure
        that zero_extend operation is profitable.


Index: gcc/combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.313.2.5
diff -u -p -w -r1.313.2.5 combine.c
--- gcc/combine.c       6 Jan 2003 21:24:44 -0000       1.313.2.5
+++ gcc/combine.c       14 Jan 2003 01:29:32 -0000
@@ -5777,7 +5777,15 @@ expand_compound_operation (x)
               == 0)))
     {
       rtx temp = gen_rtx_ZERO_EXTEND (GET_MODE (x), XEXP (x, 0));
-      return expand_compound_operation (temp);
+      rtx temp2 = expand_compound_operation (temp);
+
+      /* Make sure this is a profitable operation.  */
+      if (rtx_cost (x, SET) > rtx_cost (temp2, SET))
+       return temp2;
+      else if (rtx_cost (x, SET) > rtx_cost (temp, SET))
+       return temp;
+      else
+       return x;
     }
  
   /* We can optimize some special cases of ZERO_EXTEND.  */

-- 
Eric Christopher <echristo@redhat.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]