summaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2013-07-08 10:11:08 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2013-07-08 10:11:08 +0200
commit046f1eeec356d116ef3dcfc512d0ef8085efc8bf (patch)
tree313ca83a7db895760a39111d559cdb9fddfd83a0 /gcc/simplify-rtx.c
parent466c212744b8307eef2e40272ceda90e8fc12f97 (diff)
downloadgcc-046f1eeec356d116ef3dcfc512d0ef8085efc8bf.tar.gz
re PR rtl-optimization/57829 (Wrong constant folding)
PR rtl-optimization/57829 * simplify-rtx.c (simplify_binary_operation_1) <case IOR>: Ensure that mask bits outside of mode are just sign-extension from mode to HWI. * gcc.c-torture/execute/pr57829.c: New test. From-SVN: r200768
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 9bb31e76ed9..be54db8f5d0 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -2818,6 +2818,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
HOST_WIDE_INT mask = INTVAL (trueop1) << count;
if (mask >> count == INTVAL (trueop1)
+ && trunc_int_for_mode (mask, mode) == mask
&& (mask & nonzero_bits (XEXP (op0, 0), mode)) == 0)
return simplify_gen_binary (ASHIFTRT, mode,
plus_constant (mode, XEXP (op0, 0),