aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorRichard Sandiford <r.sandiford@uk.ibm.com>2014-05-26 18:50:55 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2014-05-26 18:50:55 +0000
commit3e26c8f6099f045cc5804968bbe7ad56ef28ab5c (patch)
tree21a0a8b4063a6435c89c6ef18670302306d554e3 /gcc/combine.c
parentcf0ff174cd17856e67b222efaaf4344adc3e4410 (diff)
downloadgcc-3e26c8f6099f045cc5804968bbe7ad56ef28ab5c.zip
gcc-3e26c8f6099f045cc5804968bbe7ad56ef28ab5c.tar.gz
gcc-3e26c8f6099f045cc5804968bbe7ad56ef28ab5c.tar.bz2
re PR rtl-optimization/61222 (ICE on valid code at -O2 and -O3 on x86_64-linux-gnu in decompose, at rtl.h:1456)
gcc/ PR rtl-optimization/61222 * combine.c (simplify_shift_const_1): When moving a PLUS outside the shift, truncate the PLUS operand to the result mode. gcc/testsuite/ PR rtl-optimization/61222 * gcc.c-torture/compile/pr61222-1.c: New test. * gcc.c-torture/compile/pr61222-2.c: Likewise. From-SVN: r210945
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 061b4d5..72bde7a 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -10349,9 +10349,10 @@ simplify_shift_const_1 (enum rtx_code code, enum machine_mode result_mode,
/* (ashift (plus foo C) N) is (plus (ashift foo N) C'). */
if (code == ASHIFT
&& CONST_INT_P (XEXP (varop, 1))
- && (new_rtx = simplify_const_binary_operation (ASHIFT, result_mode,
- XEXP (varop, 1),
- GEN_INT (count))) != 0
+ && (new_rtx = simplify_const_binary_operation
+ (ASHIFT, result_mode,
+ gen_int_mode (INTVAL (XEXP (varop, 1)), result_mode),
+ GEN_INT (count))) != 0
&& CONST_INT_P (new_rtx)
&& merge_outer_ops (&outer_op, &outer_const, PLUS,
INTVAL (new_rtx), result_mode, &complement_p))
@@ -10368,9 +10369,10 @@ simplify_shift_const_1 (enum rtx_code code, enum machine_mode result_mode,
if (code == LSHIFTRT
&& CONST_INT_P (XEXP (varop, 1))
&& mode_signbit_p (result_mode, XEXP (varop, 1))
- && (new_rtx = simplify_const_binary_operation (code, result_mode,
- XEXP (varop, 1),
- GEN_INT (count))) != 0
+ && (new_rtx = simplify_const_binary_operation
+ (code, result_mode,
+ gen_int_mode (INTVAL (XEXP (varop, 1)), result_mode),
+ GEN_INT (count))) != 0
&& CONST_INT_P (new_rtx)
&& merge_outer_ops (&outer_op, &outer_const, XOR,
INTVAL (new_rtx), result_mode, &complement_p))