aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-04-25 09:28:43 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-04-25 09:28:43 +0200
commitba5d69f3f27f4e30f95d658cf36f5d2e1debf09e (patch)
treecea421db7b2efec7beac4958f77bce491de8d185 /gcc/combine.c
parent392594621391ab6dd6f6ccd4ad8a77b883c84a5b (diff)
downloadgcc-ba5d69f3f27f4e30f95d658cf36f5d2e1debf09e.zip
gcc-ba5d69f3f27f4e30f95d658cf36f5d2e1debf09e.tar.gz
gcc-ba5d69f3f27f4e30f95d658cf36f5d2e1debf09e.tar.bz2
re PR rtl-optimization/80501 (Wrong code w/ a signed char, a shift, and a conversion to int)
PR rtl-optimization/80501 * combine.c (make_compound_operation_int): Set subreg_code to SET even for AND with mask of the sign bit of mode. * gcc.c-torture/execute/pr80501.c: New test. From-SVN: r247128
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 87daa28..39ef3c6 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -8170,12 +8170,15 @@ make_compound_operation_int (machine_mode mode, rtx *x_ptr,
|| GET_CODE (inner) == SUBREG
/* (subreg:SI (and:DI (reg:DI) (const_int 0x800000000)) 0)
is (const_int 0), rather than
- (subreg:SI (lshiftrt:DI (reg:DI) (const_int 35)) 0). */
+ (subreg:SI (lshiftrt:DI (reg:DI) (const_int 35)) 0).
+ Similarly (subreg:QI (and:SI (reg:SI) (const_int 0x80)) 0)
+ for non-equality comparisons against 0 is not equivalent
+ to (subreg:QI (lshiftrt:SI (reg:SI) (const_int 7)) 0). */
|| (GET_CODE (inner) == AND
&& CONST_INT_P (XEXP (inner, 1))
&& GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (inner))
&& exact_log2 (UINTVAL (XEXP (inner, 1)))
- >= GET_MODE_BITSIZE (mode))))
+ >= GET_MODE_BITSIZE (mode) - 1)))
subreg_code = SET;
tem = make_compound_operation (inner, subreg_code);