public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul Zimmermann <Paul.Zimmermann@inria.fr>
To: libc-alpha@sourceware.org
Subject: use of fma
Date: Wed, 28 Apr 2021 09:23:51 +0200	[thread overview]
Message-ID: <mwv986oos8.fsf@tomate.loria.fr> (raw)

       Hi,

I noticed that on recent x86_64 with fma (fused-multiply-add) in hardware,
as claimed by /proc/cpuinfo, glibc does not use fma by default.

The reason seems to be that with the default flags (-O2 -g), gcc does not
define __FP_FAST_FMA:

tomate$ gcc -O2 -g -dM -E -xc /dev/null | grep -q __FP_FAST_FMA
tomate$ echo $?
1

but it is defined with -march=native:

tomate$ gcc -O2 -g -march=native -dM -E -xc /dev/null | grep -q __FP_FAST_FMA
tomate$ echo $?
0

However, on PowerPC __FP_FAST_FMA is defined without -march=native:

pzimmermann@drac-12:~$ gcc -O2 -g -dM -E -xc /dev/null | grep -q __FP_FAST_FMA
pzimmermann@drac-12:~$ echo $?
0

Would it make sense to add -march=native to CFLAGS, or to add an option
like --enable-fma to configure?

Paul






             reply	other threads:[~2021-04-28  7:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28  7:23 Paul Zimmermann [this message]
2021-04-28  8:25 ` Florian Weimer
2021-04-28  8:42   ` Paul Zimmermann
2021-04-28  9:06     ` Florian Weimer
2021-04-28 17:29     ` Joseph Myers
2021-04-28 15:00   ` Tulio Magno Quites Machado Filho
2021-04-28 15:18     ` Paul Zimmermann
2021-04-28 15:45       ` Tulio Magno Quites Machado Filho
2021-04-28 17:46         ` Joseph Myers

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=mwv986oos8.fsf@tomate.loria.fr \
    --to=paul.zimmermann@inria.fr \
    --cc=libc-alpha@sourceware.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).