diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2018-02-23 22:36:54 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2018-02-23 22:36:54 +0000 |
commit | 88a3ea34080ad3087a8191fbf479543153175d59 (patch) | |
tree | 34eaec34d3588e09f9a77abba776266f124dc823 /gcc/match.pd | |
parent | 25e15aaed275cdfef34b3ee6eb3cb4b43a48d44f (diff) | |
parent | e65055a558093bd4fc0b1b0024b7814cc187b8e8 (diff) | |
download | gccgo.tar.gz |
Merge from trunk revision 257954.gccgo
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gccgo@257955 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/match.pd')
-rw-r--r-- | gcc/match.pd | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/gcc/match.pd b/gcc/match.pd index f7597110c4b..b77f4ead3a8 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1733,9 +1733,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) CONSTANT_CLASS_P@2) /* If one of the types wraps, use that one. */ (if (!ANY_INTEGRAL_TYPE_P (type) || TYPE_OVERFLOW_WRAPS (type)) - (if (outer_op == PLUS_EXPR) - (plus (view_convert @0) (inner_op @2 (view_convert @1))) - (minus (view_convert @0) (neg_inner_op @2 (view_convert @1)))) + /* If all 3 captures are CONSTANT_CLASS_P, punt, as we might recurse + forever if something doesn't simplify into a constant. */ + (if (!CONSTANT_CLASS_P (@0)) + (if (outer_op == PLUS_EXPR) + (plus (view_convert @0) (inner_op @2 (view_convert @1))) + (minus (view_convert @0) (neg_inner_op @2 (view_convert @1))))) (if (!ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0)) || TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0))) (if (outer_op == PLUS_EXPR) @@ -4003,7 +4006,14 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (simplify (pows REAL_CST@0 @1) (if (real_compare (GT_EXPR, TREE_REAL_CST_PTR (@0), &dconst0) - && real_isfinite (TREE_REAL_CST_PTR (@0))) + && real_isfinite (TREE_REAL_CST_PTR (@0)) + /* As libmvec doesn't have a vectorized exp2, defer optimizing + the use_exp2 case until after vectorization. It seems actually + beneficial for all constants to postpone this until later, + because exp(log(C)*x), while faster, will have worse precision + and if x folds into a constant too, that is unnecessary + pessimization. */ + && canonicalize_math_after_vectorization_p ()) (with { const REAL_VALUE_TYPE *const value = TREE_REAL_CST_PTR (@0); bool use_exp2 = false; @@ -4018,10 +4028,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) } (if (!use_exp2) (exps (mult (logs @0) @1)) - /* As libmvec doesn't have a vectorized exp2, defer optimizing - this until after vectorization. */ - (if (canonicalize_math_after_vectorization_p ()) - (exp2s (mult (log2s @0) @1)))))))) + (exp2s (mult (log2s @0) @1))))))) (for sqrts (SQRT) cbrts (CBRT) |