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).

Reply via email to