OSDN Git Service

gcc/
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Sep 2007 15:35:52 +0000 (15:35 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Sep 2007 15:35:52 +0000 (15:35 +0000)
PR middle-end/33290
* optabs.c (avoid_expensive_constant): Canonicalize CONST_INTs
before forcing them into a register.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128048 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/optabs.c

index 9bdd53f..3526e61 100644 (file)
@@ -1,5 +1,11 @@
 2007-09-03  Richard Sandiford  <richard@codesourcery.com>
 
+       PR middle-end/33290
+       * optabs.c (avoid_expensive_constant): Canonicalize CONST_INTs
+       before forcing them into a register.
+
+2007-09-03  Richard Sandiford  <richard@codesourcery.com>
+
        * config/mips/mips.md (fetchop_bit): Use define_code_iterator
        rather than define_code_macro.
 
index fee7c50..8d0139e 100644 (file)
@@ -1290,7 +1290,13 @@ avoid_expensive_constant (enum machine_mode mode, optab binoptab,
       && CONSTANT_P (x)
       && rtx_cost (x, binoptab->code) > COSTS_N_INSNS (1))
     {
-      if (GET_MODE (x) != VOIDmode)
+      if (GET_CODE (x) == CONST_INT)
+       {
+         HOST_WIDE_INT intval = trunc_int_for_mode (INTVAL (x), mode);
+         if (intval != INTVAL (x))
+           x = GEN_INT (intval);
+       }
+      else
        x = convert_modes (mode, VOIDmode, x, unsignedp);
       x = force_reg (mode, x);
     }