summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-03 15:35:52 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-03 15:35:52 +0000
commit81747544ba9eeb8143a39537d34fe70fe76f1898 (patch)
treee5fef72222c55492804f063aeaff14e113ce5a35
parent953d8c1262a417ca5d04a76e565bb6b244274a1c (diff)
downloadppe42-gcc-81747544ba9eeb8143a39537d34fe70fe76f1898.tar.gz
ppe42-gcc-81747544ba9eeb8143a39537d34fe70fe76f1898.zip
gcc/
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
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/optabs.c8
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9bdd53f6a01..3526e61feae 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/optabs.c b/gcc/optabs.c
index fee7c5039cc..8d0139e8fca 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -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);
}
OpenPOWER on IntegriCloud