aboutsummaryrefslogtreecommitdiff
path: root/gcc/match.pd
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-03-28 21:15:39 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2018-03-28 21:15:39 +0200
commit30a2c10eb639f1855fe7e060552f09c706efa532 (patch)
tree707858c0b19b0db09b4434b773deb95486f2dae0 /gcc/match.pd
parentcefc09063eb4b0eb572c89c3f0657e5b5e36e77d (diff)
downloadgcc-30a2c10eb639f1855fe7e060552f09c706efa532.zip
gcc-30a2c10eb639f1855fe7e060552f09c706efa532.tar.gz
gcc-30a2c10eb639f1855fe7e060552f09c706efa532.tar.bz2
re PR middle-end/82004 (SPEC CPU2017 628.pop2_s miscompare)
PR tree-optimization/82004 * gimple-match-head.c (optimize_pow_to_exp): New function. * match.pd (pow(C,x) -> exp(log(C)*x)): Wrap with #if GIMPLE. Don't fold to exp if optimize_pow_to_exp is false. * gcc.dg/pr82004.c: New test. From-SVN: r258930
Diffstat (limited to 'gcc/match.pd')
-rw-r--r--gcc/match.pd5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/match.pd b/gcc/match.pd
index 3e1636c..7c4c11c 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -4006,6 +4006,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* pow(C,x) -> exp(log(C)*x) if C > 0,
or if C is a positive power of 2,
pow(C,x) -> exp2(log2(C)*x). */
+#if GIMPLE
(for pows (POW)
exps (EXP)
logs (LOG)
@@ -4035,8 +4036,10 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
}
}
(if (!use_exp2)
- (exps (mult (logs @0) @1))
+ (if (optimize_pow_to_exp (@0, @1))
+ (exps (mult (logs @0) @1)))
(exp2s (mult (log2s @0) @1)))))))
+#endif
/* pow(C,x)*expN(y) -> expN(logN(C)*x+y) if C > 0. */
(for pows (POW)