summaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-18 10:32:20 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-18 10:32:20 +0000
commit523464ff57eea48adea62ae64f3dadc464250513 (patch)
tree65f830a71da03bc6f1c2c25119de05ca0e685a8a /gcc/combine.c
parent3fb2de4ac89890191b61d1d8a8b7b874ffebff19 (diff)
downloadgcc-523464ff57eea48adea62ae64f3dadc464250513.tar.gz
2016-04-18 Basile Starynkevitch <basile@starynkevitch.net>
{{merging with even more of GCC 6, using subversion 1.9 svn merge -r234051:234650 ^/trunk }} git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@235119 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 24dcefa0bf6..1d0e8beeb2c 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -10524,9 +10524,24 @@ simplify_shift_const_1 (enum rtx_code code, machine_mode result_mode,
&& CONST_INT_P (XEXP (varop, 0))
&& !CONST_INT_P (XEXP (varop, 1)))
{
+ /* For ((unsigned) (cstULL >> count)) >> cst2 we have to make
+ sure the result will be masked. See PR70222. */
+ if (code == LSHIFTRT
+ && mode != result_mode
+ && !merge_outer_ops (&outer_op, &outer_const, AND,
+ GET_MODE_MASK (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),
- GEN_INT (count));
+ XEXP (varop, 0),
+ GEN_INT (count));
varop = gen_rtx_fmt_ee (code, mode, new_rtx, XEXP (varop, 1));
count = 0;
continue;