Adhemerval Zanella
84977600da
math: Fix UB on sinpif (BZ 32925)
...
The left shift overflows for 'int', use uint32_t instead. It syncs
with CORE-MATH commit bbfabd99.
Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com >
2025-04-29 15:20:28 -03:00
Adhemerval Zanella
246e52574d
math: Consolidate cospif and sinpif internal tables
...
The libm size improvement built with gcc-14, "--enable-stack-protector=strong
--enable-bind-now=yes --enable-fortify-source=2":
Before:
text data bss dec hex filename
584500 844 12 585356 8ee8c aarch64-linux-gnu/math/libm.so
977341 1076 12 978429 eedfd x86_64-linux-gnu/math/libm.so
1205762 5608 368 1211738 127d5a powerpc64le-linux-gnu/math/libm.so
After:
text data bss dec hex filename
583444 844 12 584300 8ea6c aarch64-linux-gnu/math/libm.so
976349 1076 12 977437 eea1d x86_64-linux-gnu/math/libm.so
1204738 5608 368 1210714 12795a powerpc64le-linux-gnu/math/libm.so
Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org >
2025-02-17 10:09:09 -03:00
Adhemerval Zanella
de2fca9fe2
math: Use sinpif from CORE-MATH
...
The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows better performance to the generic sinpif.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).
Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1):
latency master patched improvement
x86_64 47.5710 38.4455 19.18%
x86_64v2 46.8828 40.7563 13.07%
x86_64v3 44.0034 34.1497 22.39%
aarch64 (Neoverse) 19.2493 14.1968 26.25%
power8 23.5312 16.3854 30.37%
power10 22.6485 10.2888 54.57%
reciprocal-throughput master patched improvement
x86_64 21.8858 11.6717 46.67%
x86_64v2 22.0620 11.9853 45.67%
x86_64v3 21.5653 11.3291 47.47%
aarch64 (Neoverse) 13.0615 6.5499 49.85%
power8 16.2030 6.9580 57.06%
power10 12.8911 4.2858 66.75%
Reviewed-by: DJ Delorie <dj@redhat.com >
2025-02-12 16:31:57 -03:00