public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/105206] mis-optimization with -ffast-math and __builtin_powf Date: Sat, 09 Apr 2022 19:35:41 +0000 [thread overview] Message-ID: <bug-105206-4-c7kkB8SKEj@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-105206-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105206 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |minor --- Comment #1 from kargl at gcc dot gnu.org --- Not sure if anyone cares. I don't use -ffast-math, but this might considered a mis-optimization with that option. #include <math.h> float foof(float x) { return (powf(10.f,x)); } double food(double x) { return (pow(10.,x)); } -fdump-tree-original shows ;; Function foof (null) ;; enabled by -tree-original { return powf (1.0e+1, x); } ;; Function food (null) ;; enabled by -tree-original { return pow (1.0e+1, x); } Compiling to assembly shows foof: .LFB3: .cfi_startproc movaps %xmm0, %xmm1 movss .LC0(%rip), %xmm0 jmp powf .cfi_endproc food: .LFB4: .cfi_startproc mulsd .LC1(%rip), %xmm0 jmp exp .cfi_endproc So, the middle-end is converting pow(10.x) to exp(x*log(10.0)) where log(10.0) is reduced, but the same transformation of powf(10.f,x) still yields a call to powf.
next prev parent reply other threads:[~2022-04-09 19:35 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-09 19:30 [Bug middle-end/105206] New: " kargl at gcc dot gnu.org 2022-04-09 19:35 ` kargl at gcc dot gnu.org [this message] 2022-04-11 7:18 ` [Bug middle-end/105206] " rguenth at gcc dot gnu.org 2022-04-11 14:45 ` kargl at gcc dot gnu.org 2022-04-11 19:21 ` sgk at troutmask dot apl.washington.edu 2022-04-11 19:24 ` [Bug target/105206] " kargl at gcc dot gnu.org 2022-04-12 6:46 ` rguenther at suse dot de 2022-04-12 17:35 ` kargl at gcc dot gnu.org 2022-04-25 7:28 ` rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-105206-4-c7kkB8SKEj@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).