slowdown with -std=gnu18 with respect to -std=c99

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



       Hi,

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 https://gitlab.inria.fr/core-math/core-math.git
$ cd core-math
$ CORE_MATH_PERF_MODE=rdtsc CFLAGS="-O3 -march=native -ffinite-math-only -std=gnu18" ./perf.sh exp10f
GNU libc version: 2.33
GNU libc release: release
31.746
11.780
$ CORE_MATH_PERF_MODE=rdtsc CFLAGS="-O3 -march=native -ffinite-math-only -std=c99" ./perf.sh exp10f
GNU libc version: 2.33
GNU libc release: release
21.514
11.751

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):

https://gitlab.inria.fr/core-math/core-math/-/blob/master/src/binary32/exp10/exp10f.c

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



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux