summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-10-07 18:40:02 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-10-07 18:40:02 +0000
commit5fe63105665fd62320cdbeb910e771408e56d0db (patch)
treed068862ccb803da23231118cfebcfb111014f4bc
parent41854acbb6be2042f64f275154a9a4bf194e8bf4 (diff)
downloadgcc-5fe63105665fd62320cdbeb910e771408e56d0db.tar.gz
gcc/
* simplify-rtx.c (simplify_binary_operation_1): Canonicalize truncated shift counts. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129072 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/simplify-rtx.c11
2 files changed, 14 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index db4a7d011a9..7562e40d616 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2007-10-07 Richard Sandiford <rsandifo@nildram.co.uk>
+
+ * simplify-rtx.c (simplify_binary_operation_1): Canonicalize
+ truncated shift counts.
+
2007-10-07 Kazu Hirata <kazu@codesourcery.com>
* config/m68k/m68k.c, config/m68k/m68k.md: Use the assembly
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 8e02612f481..0371339d540 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -2562,6 +2562,13 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
&& (unsigned HOST_WIDE_INT) INTVAL (trueop0) == GET_MODE_MASK (mode)
&& ! side_effects_p (op1))
return op0;
+ canonicalize_shift:
+ if (SHIFT_COUNT_TRUNCATED && GET_CODE (op1) == CONST_INT)
+ {
+ val = INTVAL (op1) & (GET_MODE_BITSIZE (mode) - 1);
+ if (val != INTVAL (op1))
+ return simplify_gen_binary (code, mode, op0, GEN_INT (val));
+ }
break;
case ASHIFT:
@@ -2571,7 +2578,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
return op0;
if (trueop0 == CONST0_RTX (mode) && ! side_effects_p (op1))
return op0;
- break;
+ goto canonicalize_shift;
case LSHIFTRT:
if (trueop1 == CONST0_RTX (mode))
@@ -2593,7 +2600,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
return simplify_gen_relational (EQ, mode, imode,
XEXP (op0, 0), const0_rtx);
}
- break;
+ goto canonicalize_shift;
case SMIN:
if (width <= HOST_BITS_PER_WIDE_INT