Do this only for fast-math as accuracy is reduced. This is much faster
since pow is more complex than exp.
gcc/
* match.pd: Add pow (C, x) simplification
From-SVN: r251230
+2017-08-21 Wilco Dijkstra <wdijkstr@arm.com>
+
+ * match.pd: Add pow (C, x) simplification.
+
2017-08-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/81900
(logs (pows @0 @1))
(mult @1 (logs @0))))
+ /* pow(C,x) -> exp(log(C)*x) if C > 0. */
+ (for pows (POW)
+ exps (EXP)
+ logs (LOG)
+ (simplify
+ (pows REAL_CST@0 @1)
+ (if (real_compare (GT_EXPR, TREE_REAL_CST_PTR (@0), &dconst0)
+ && real_isfinite (TREE_REAL_CST_PTR (@0)))
+ (exps (mult (logs @0) @1)))))
+
(for sqrts (SQRT)
cbrts (CBRT)
pows (POW)