combine.c (expand_compound_operation): Make sure that zero_extend operation is profit...
authorEric Christopher <echristo@redhat.com>
Fri, 16 May 2003 02:05:29 +0000 (02:05 +0000)
committerEric Christopher <echristo@gcc.gnu.org>
Fri, 16 May 2003 02:05:29 +0000 (02:05 +0000)
2003-05-15 Eric Christopher <echristo@redhat.com>

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

From-SVN: r66853

gcc/ChangeLog
gcc/combine.c

index 413e82720110e0af1a9097ab64e0eee8eae37077..699bba0e1fc6ef4978a9e5c510f523313b577557 100644 (file)
@@ -1,3 +1,8 @@
+2003-05-15 Eric Christopher <echristo@redhat.com>
+
+        * combine.c (expand_compound_operation): Make sure
+        that zero_extend operation is profitable.
+
 2003-05-15  Richard Henderson  <rth@redhat.com>
 
        * config/alpha/linux.h, config/alpha/linux-elf.h: Remove
index bff8b08f5bfa61770a5fe8d67dca71136d959161..79f0226e8cd6661b68b6494355323d030261340b 100644 (file)
@@ -5802,7 +5802,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.  */