aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-03-29 20:49:00 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-03-29 20:49:00 +0200
commita362f023e538bc30dd9f2107f71c2435f62b9289 (patch)
tree403c3e385daa0141fced2cc170fd23bc95606ee5 /gcc/combine.c
parente0bffbbb5936be8b6a35d868db4226ca1b2365fa (diff)
downloadgcc-a362f023e538bc30dd9f2107f71c2435f62b9289.zip
gcc-a362f023e538bc30dd9f2107f71c2435f62b9289.tar.gz
gcc-a362f023e538bc30dd9f2107f71c2435f62b9289.tar.bz2
re PR rtl-optimization/70429 (Wrong code with -O1.)
PR rtl-optimization/70429 * combine.c (simplify_shift_const_1): For ASHIFTRT don't optimize (cst1 >> count) >> cst2 into (cst1 >> cst2) >> count if mode != result_mode. * gcc.c-torture/execute/pr70429.c: New test. From-SVN: r234531
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index f701f28..1d0e8be 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -10533,6 +10533,11 @@ simplify_shift_const_1 (enum rtx_code code, machine_mode result_mode,
>> orig_count, result_mode,
&complement_p))
break;
+ /* For ((int) (cstLL >> count)) >> cst2 just give up. Queuing
+ up outer sign extension (often left and right shift) is
+ hardly more efficient than the original. See PR70429. */
+ if (code == ASHIFTRT && mode != result_mode)
+ break;
rtx new_rtx = simplify_const_binary_operation (code, mode,
XEXP (varop, 0),