public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/103008] New: poor inlined builtin_fmod on x86_64
@ 2021-10-30 18:51 fx at gnu dot org
  2021-10-30 18:52 ` [Bug target/103008] " fx at gnu dot org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: fx at gnu dot org @ 2021-10-30 18:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103008
           Summary: poor inlined builtin_fmod on x86_64
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fx at gnu dot org
  Target Milestone: ---
            Target: x86_64

Created attachment 51706
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51706&action=edit
ggl.f90

This is from looking at a Fortran benchmark set
<https://www.fortran.uk/fortran-compiler-comparisons/>, but presumably
isn't Fortran-specific.

One of the cases in that set (ac.f90) gets bottlenecked on a random
number routine (which may be rubbish, but it's there).  It uses DMOD,
which gets compiled to __builtin_fmod according to the tree dump, and
is inlined.  However, the benchmark performance is still 50% worse
with gfortran than Intel ifort, and if I replace DMOD with its
definition, gfortran is much closer to ifort.

I'll attach files ggl.f90, the original, and gglx.f90 which avoids the
call to the intrinsic, along with assembler from each.  The assembler
is from GCC 11.2.0, run (on SKX) as

  gfortran -Ofast -march=native

(I note that the generated fmod isn't inlined with -O3, which looks to
me like a Fortran miss that I should report.)

I only take benchmarks too seriously for understanding the results
but, at least with PDO, GCC is pretty much on a par with ifort on the
bottom line of that set, despite also #40770, and another poor case. :-)

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

end of thread, other threads:[~2022-02-14  7:35 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-30 18:51 [Bug target/103008] New: poor inlined builtin_fmod on x86_64 fx at gnu dot org
2021-10-30 18:52 ` [Bug target/103008] " fx at gnu dot org
2021-10-30 18:55 ` fx at gnu dot org
2021-10-30 18:56 ` fx at gnu dot org
2021-10-30 20:15 ` fx at gnu dot org
2021-10-30 20:39 ` anlauf at gcc dot gnu.org
2021-10-31 20:05 ` ubizjak at gmail dot com
2021-11-01  8:23 ` ubizjak at gmail dot com
2022-02-10 14:18 ` rguenth at gcc dot gnu.org
2022-02-10 14:22 ` rguenth at gcc dot gnu.org
2022-02-10 18:09 ` ubizjak at gmail dot com
2022-02-10 20:50 ` joseph at codesourcery dot com
2022-02-11  7:59 ` rguenth at gcc dot gnu.org
2022-02-11 15:47 ` ubizjak at gmail dot com
2022-02-12 22:07 ` ubizjak at gmail dot com
2022-02-13 21:00 ` Dave.Love at manchester dot ac.uk
2022-02-14  7:12 ` rguenther at suse dot de
2022-02-14  7:35 ` rguenth 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).