public inbox for
 help / color / mirror / Atom feed
From: Paul Zimmermann <>
Subject: slowdown with -std=gnu18 with respect to -std=c99
Date: Tue, 03 May 2022 10:28:39 +0200	[thread overview]
Message-ID: <> (raw)


I observe a slowdown of some code compiled with gcc when I use -std=gnu18
instead of -std=c99.

My computer is a i5-4590, and I use gcc version 11.3.0 (Debian 11.3.0-1).

To reproduce:

$ git clone
$ cd core-math
$ CORE_MATH_PERF_MODE=rdtsc CFLAGS="-O3 -march=native -ffinite-math-only -std=gnu18" ./ exp10f
GNU libc version: 2.33
GNU libc release: release
$ CORE_MATH_PERF_MODE=rdtsc CFLAGS="-O3 -march=native -ffinite-math-only -std=c99" ./ exp10f
GNU libc version: 2.33
GNU libc release: release

The difference is seen between the first figures in each run (31.746 and
21.514), which indicate the average number of cycles of the exp10f function
from the core-math library.

The code is very simple (a few dozen lines):

Some more remarks:

* this slowdown does not happen on all machines, for example it does not
  appear on an AMD EPYC 7282 with gcc gcc version 10.2.1 (Debian 10.2.1-6).

* this slowdown disappears when I replace __builtin_expect(ex>(127+6), 0)
  by ex>(127+6) at line 45 of the code, however that branch is never taken
  in the above experiment.

Does anyone have a clue?

Best regards,
Paul Zimmermann

             reply	other threads:[~2022-05-03  8:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03  8:28 Paul Zimmermann [this message]
2022-05-03  9:09 ` Alexander Monakov
2022-05-03 11:45   ` Paul Zimmermann
2022-05-03 12:12     ` Alexander Monakov
2022-05-05  8:57   ` Stéphane Glondu
2022-05-05 14:31     ` Stéphane Glondu
2022-05-05 14:41       ` Marc Glisse
2022-05-05 14:56         ` Alexander Monakov
2022-05-06  7:46           ` Paul Zimmermann
2022-05-06  9:27             ` Alexander Monakov
2022-05-07  6:11               ` Paul Zimmermann
2022-05-11 13:26               ` Alexander Monakov
2022-05-05 17:50         ` Paul Zimmermann

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* 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).