public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fx at gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/97142] New: __builtin_fmod not optimized on POWER
Date: Mon, 21 Sep 2020 10:57:19 +0000	[thread overview]
Message-ID: <bug-97142-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 97142
           Summary: __builtin_fmod not optimized on POWER
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fx at gnu dot org
  Target Milestone: ---

I ran some Fortran benchmarks (the "Polyhedron" set) on POWER9, and found one
of them has pathologically bad performance compared with xlf.  Profiling shows
that's due to spending most of its time in fmod via a random-number function. 
fmod isn't called when compiled with xlf -O5 or when compiling the same on
x86_64.  Although it's Fortran, this doesn't appear to be Fortran-specific as
the DMOD intrinsic is turned into __builtin_fmod.

The following is with gcc 10.2, comparing the two targets.

On RHEL7 POWER9 (and the same with -mcpu=native):

$ cat ggl.f90
      REAL FUNCTION GGL(Ds)
      DOUBLE PRECISION Ds , d2
      DATA d2/2147483647.D0/
      Ds = DMOD(16807.D0*Ds,d2)
      GGL = Ds/d2
      END
$ gfortran -O3 -fopt-info-all -c ggl.f90
ggl.f90:4:0: missed:   not inlinable: ggl/0 -> __builtin_fmod/2, function body
not available
Unit growth for small function inlining: 12->12 (0%)

Inlined 0 calls, eliminated 0 functions

ggl.f90:6:0: note: ***** Analysis failed with vector mode V2DF
$ nm ggl.o
                 U fmod
0000000000000000 T ggl_
                 U .TOC.

On Debian 10 SKX with the same source:

$ gfortran-10 -Ofast -fopt-info-all -c ggl.f90
ggl.f90:4:0: missed:   not inlinable: ggl/0 -> __builtin_fmod/2, function body
not available
Unit growth for small function inlining: 12->12 (0%)

Inlined 0 calls, eliminated 0 functions

ggl.f90:6:0: note: ***** Analysis failed with vector mode V2DF
ggl.f90:6:0: note: ***** Skipping vector mode V16QI, which would repeat the
analysis for V2DF
$ nm ggl.o
0000000000000000 r .LC0
0000000000000008 r .LC1
0000000000000010 r .LC2
0000000000000000 T ggl_

             reply	other threads:[~2020-09-21 10:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-21 10:57 fx at gnu dot org [this message]
2020-09-21 11:24 ` [Bug target/97142] " rguenth at gcc dot gnu.org
2020-09-21 11:26 ` rguenth at gcc dot gnu.org
2020-09-21 14:42 ` bergner at gcc dot gnu.org
2020-09-21 14:45 ` fx at gnu dot org
2020-09-21 14:47 ` fx at gnu dot org
2020-09-21 17:52 ` segher at gcc dot gnu.org
2020-09-21 18:10 ` bergner at gcc dot gnu.org
2020-09-21 19:33 ` segher at gcc dot gnu.org
2020-09-21 21:54 ` bergner at gcc dot gnu.org
2021-04-13  6:24 ` luoxhu at gcc dot gnu.org
2021-04-13 16:26 ` segher at gcc dot gnu.org
2021-05-27  0:54 ` luoxhu at gcc dot gnu.org
2021-09-02 22:05 ` bergner at gcc dot gnu.org
2021-09-02 22:38 ` segher at gcc dot gnu.org
2021-09-03  2:33 ` luoxhu at gcc dot gnu.org
2021-09-07  1:29 ` cvs-commit at gcc dot gnu.org
2021-09-07 17:58 ` bergner at gcc dot gnu.org
2021-09-07 19:34 ` segher at gcc dot gnu.org
2021-09-07 21:20 ` segher at gcc dot gnu.org
2021-09-14  5:33 ` cvs-commit at gcc dot gnu.org
2021-09-14  5:34 ` cvs-commit at gcc dot gnu.org
2021-09-14  5:36 ` luoxhu 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-97142-4@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: link
Be 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).