summaryrefslogtreecommitdiff
path: root/gcc/match.pd
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-27 09:32:11 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-27 09:32:11 +0000
commit762f6b3bb81db44b3d4100b9a668d87d30d0d204 (patch)
tree9451dee7b1c759995c7a5b8096b5dcdc8b5492e1 /gcc/match.pd
parentff19098073020a9b055f58046baabe58574ea0fb (diff)
downloadgcc-762f6b3bb81db44b3d4100b9a668d87d30d0d204.tar.gz
Move expN folds to match.pd
Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi. gcc/ * builtins.c (fold_builtin_exponent): Delete. (fold_builtin_2): Handle constant expN arguments here. * match.pd: Fold expN(logN(x)) -> x. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229410 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/match.pd')
-rw-r--r--gcc/match.pd8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/match.pd b/gcc/match.pd
index 1c3331972d6..26491d27840 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -2407,12 +2407,16 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(rdiv @0 (exps:s @1))
(mult @0 (exps (negate @1)))))
- /* Special case, optimize logN(expN(x)) = x. */
(for logs (LOG LOG2 LOG10 LOG10)
exps (EXP EXP2 EXP10 POW10)
+ /* logN(expN(x)) -> x. */
(simplify
(logs (exps @0))
- @0))
+ @0)
+ /* expN(logN(x)) -> x. */
+ (simplify
+ (exps (logs @0))
+ @0))
/* Optimize logN(func()) for various exponential functions. We
want to determine the value "x" and the power "exponent" in