diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-12-09 11:13:18 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-12-09 11:13:18 +0100 |
commit | 49647b7b25673273262fb630598027c6d841690f (patch) | |
tree | 4c6f773e0273b14f939c5926752cfd99310ca630 /gcc/match.pd | |
parent | 8e03b21e84e4b6a3c806bb48bb5eceac1f7ed273 (diff) |
re PR tree-optimization/92834 (misssed SLP vectorization in LightPixel)
PR tree-optimization/92834
* match.pd (A - ((A - B) & -(C cmp D)) -> (C cmp D) ? B : A,
A + ((B - A) & -(C cmp D)) -> (C cmp D) ? B : A): New simplifications.
* gcc.dg/tree-ssa/pr92834.c: New test.
From-SVN: r279113
Diffstat (limited to 'gcc/match.pd')
-rw-r--r-- | gcc/match.pd | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/match.pd b/gcc/match.pd index 58c57a573e2..dda86964b4c 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -2697,6 +2697,31 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (cmp (minmax @0 INTEGER_CST@1) INTEGER_CST@2) (comb (cmp @0 @2) (cmp @1 @2)))) +/* Undo fancy way of writing max/min or other ?: expressions, + like a - ((a - b) & -(a < b)), in this case into (a < b) ? b : a. + People normally use ?: and that is what we actually try to optimize. */ +(for cmp (simple_comparison) + (simplify + (minus @0 (bit_and:c (minus @0 @1) + (convert? (negate@4 (convert? (cmp@5 @2 @3)))))) + (if (INTEGRAL_TYPE_P (type) + && INTEGRAL_TYPE_P (TREE_TYPE (@4)) + && TREE_CODE (TREE_TYPE (@4)) != BOOLEAN_TYPE + && INTEGRAL_TYPE_P (TREE_TYPE (@5)) + && (TYPE_PRECISION (TREE_TYPE (@4)) >= TYPE_PRECISION (type) + || !TYPE_UNSIGNED (TREE_TYPE (@4)))) + (cond (cmp @2 @3) @1 @0))) + (simplify + (plus:c @0 (bit_and:c (minus @1 @0) + (convert? (negate@4 (convert? (cmp@5 @2 @3)))))) + (if (INTEGRAL_TYPE_P (type) + && INTEGRAL_TYPE_P (TREE_TYPE (@4)) + && TREE_CODE (TREE_TYPE (@4)) != BOOLEAN_TYPE + && INTEGRAL_TYPE_P (TREE_TYPE (@5)) + && (TYPE_PRECISION (TREE_TYPE (@4)) >= TYPE_PRECISION (type) + || !TYPE_UNSIGNED (TREE_TYPE (@4)))) + (cond (cmp @2 @3) @1 @0)))) + /* Simplifications of shift and rotates. */ (for rotate (lrotate rrotate) |