This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/14541] [tree-ssa] built-in math functions are not fully optimized at tree level
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 01 Dec 2014 14:15:17 +0000
- Subject: [Bug tree-optimization/14541] [tree-ssa] built-in math functions are not fully optimized at tree level
- Auto-submitted: auto-generated
- References: <bug-14541-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14541
--- Comment #16 from Richard Biener <rguenth at gcc dot gnu.org> ---
(for logfn (BUILT_IN_LOGF BUILT_IN_LOG BUILT_IN_LOGL)
expfn (BUILT_IN_EXPF BUILT_IN_EXP BUILT_IN_EXPL)
(simplify
(logfn (expfn @0))
(if (flag_unsafe_math_optimizations)
@0)))
with the still somewhat awkward syntax, patch for proposed better one
is not yet ready but would look like
(define_operator_list log (BUILT_IN_LOGF BUILT_IN_LOG BUILT_IN_LOGL))
(define_operator_list exp (BUILT_IN_EXPF BUILT_IN_EXP BUILT_IN_EXPL))
(simplify
(log (exp @0))
(if (flag_unsafe_math_optimizations)
@0)))
thus the 'for' would be implicit. Note that fold_builtin_logarithm does handle
some more cases. The match-and-simplify branch already covers quite some
patterns in match-builtins.def (but not the above).
I'll see if I can take the syntax patch (I was waiting for that so not to
merge the "ugly" syntax).