diff options
author | Jakub Jelinek <jakub@redhat.com> | 2015-05-19 15:54:32 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2015-05-19 15:54:32 +0200 |
commit | a60c51fe4803ad63d909c819642490630d893152 (patch) | |
tree | 10eb4f7411e8dc56c8e74c0a8a4e98363bae7752 /gcc/match.pd | |
parent | 0e50b62468123005202598f2a88b59f9ca695eb8 (diff) | |
download | gcc-a60c51fe4803ad63d909c819642490630d893152.zip gcc-a60c51fe4803ad63d909c819642490630d893152.tar.gz gcc-a60c51fe4803ad63d909c819642490630d893152.tar.bz2 |
re PR rtl-optimization/66187 (wrong code at -O1, -O2 and -O3 on x86_64-linux-gnu)
PR tree-optimization/66187
* match.pd ((bit_and (plus/minus (convert @0) (convert @1)) mask)):
Pass TYPE_SIGN to tree_int_cst_min_precision. If
!TYPE_OVERFLOW_WRAPS, ensure @4 is non-negative.
* gcc.c-torture/execute/pr66187.c: New test.
* gcc.dg/pr66187-1.c: New test.
* gcc.dg/pr66187-2.c: New test.
From-SVN: r223366
Diffstat (limited to 'gcc/match.pd')
-rw-r--r-- | gcc/match.pd | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/match.pd b/gcc/match.pd index f277fe3..54500d9 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1115,8 +1115,10 @@ along with GCC; see the file COPYING3. If not see /* The inner conversion must be a widening conversion. */ && TYPE_PRECISION (TREE_TYPE (@2)) > TYPE_PRECISION (TREE_TYPE (@0)) && types_match (@0, @1) - && (tree_int_cst_min_precision (@4, UNSIGNED) + && (tree_int_cst_min_precision (@4, TYPE_SIGN (TREE_TYPE (@0))) <= TYPE_PRECISION (TREE_TYPE (@0))) + && (TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0)) + || tree_int_cst_sgn (@4) >= 0) && single_use (@5)) (if (TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0))) (with { tree ntype = TREE_TYPE (@0); } |