public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/116826] New: Optimise log (1.0 / x) into -log (x)
@ 2024-09-24  8:14 ktkachov at gcc dot gnu.org
  2024-09-24  9:56 ` [Bug tree-optimization/116826] " jschmitz at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2024-09-24  8:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116826

            Bug ID: 116826
           Summary: Optimise log (1.0 / x) into -log (x)
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---

float
foo (float a)
{
  return __builtin_logf (1.0f / a);
}

We can avoid the division by folding it into -__builtin_logf (a);
under the usual -funsafe-math-optimizations group for all the various standard
logs.
More generally, log (CST / a) could be folded into log (CST) - log (a).

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-25  6:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-24  8:14 [Bug tree-optimization/116826] New: Optimise log (1.0 / x) into -log (x) ktkachov at gcc dot gnu.org
2024-09-24  9:56 ` [Bug tree-optimization/116826] " jschmitz at gcc dot gnu.org
2024-09-24 18:13 ` pinskia at gcc dot gnu.org
2024-09-25  6:45 ` ktkachov at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).