glibc/sysdeps
Adhemerval Zanella 5c22fd25c1 math: Use exp2m1f from CORE-MATH
The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows better performance compared to the generic exp2m1f.

The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).  The
only change is to handle FLT_MAX_EXP for FE_DOWNWARD or FE_TOWARDZERO.

The benchmark inputs are based on exp2f ones.

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                      40.6042        48.7104       -19.96%
x86_64v2                    40.7506        35.9032        11.90%
x86_64v3                    35.2301        31.7956        9.75%
i686                        102.094        94.6657        7.28%
aarch64                     18.2704        15.1387        17.14%
power10                     11.9444         8.2402        31.01%

reciprocal-throughput        master        patched   improvement
x86_64                      20.8683        16.1428        22.64%
x86_64v2                    19.5076        10.4474        46.44%
x86_64v3                    19.2106        10.4014        45.86%
i686                        56.4054        59.3004        -5.13%
aarch64                     12.0781         7.3953        38.77%
power10                      6.5306         5.9388         9.06%

The generic implementation calls __ieee754_exp2f and x86_64 provides
an optimized ifunc version (built with -mfma -mavx2, not correctly
rounded).  This explains the performance difference for x86_64.

Same for i686, where the ABI provides an optimized __ieee754_exp2f
version built with '-msse2 -mfpmath=sse'.  When built wth same
flags, the new algorithm shows a better performance:

                            master        patched    improvement
latency                    102.094        91.2823         10.59%
reciprocal-throughput      56.4054        52.7984          6.39%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-01 11:27:35 -03:00
..
aarch64 math: Use exp2m1f from CORE-MATH 2024-11-01 11:27:35 -03:00
alpha replace tgammaf by the CORE-MATH implementation 2024-10-11 11:12:32 +02:00
arc math: Use exp2m1f from CORE-MATH 2024-11-01 11:27:35 -03:00
arm math: Use exp2m1f from CORE-MATH 2024-11-01 11:27:35 -03:00
csky replace tgammaf by the CORE-MATH implementation 2024-10-11 11:12:32 +02:00
generic stdlib: Make abort/_Exit AS-safe (BZ 26275) 2024-10-08 14:40:12 -03:00
gnu sysdeps: Re-flow and sort multiline gnu/Makefile definitions 2024-08-07 11:02:03 -03:00
hppa math: Use exp2m1f from CORE-MATH 2024-11-01 11:27:35 -03:00
htl stdlib: Make abort/_Exit AS-safe (BZ 26275) 2024-10-08 14:40:12 -03:00
hurd hurd: Move internal functions to internal header 2024-03-23 22:43:07 +01:00
i386 math: Use exp2m1f from CORE-MATH 2024-11-01 11:27:35 -03:00
ieee754 math: Use exp2m1f from CORE-MATH 2024-11-01 11:27:35 -03:00
loongarch math: Use exp2m1f from CORE-MATH 2024-11-01 11:27:35 -03:00
m68k math: Use exp2m1f from CORE-MATH 2024-11-01 11:27:35 -03:00
mach Fix header guard in sysdeps/mach/hurd/x86_64/vm_param.h 2024-10-09 19:16:53 +02:00
microblaze replace tgammaf by the CORE-MATH implementation 2024-10-11 11:12:32 +02:00
mips math: Use exp2m1f from CORE-MATH 2024-11-01 11:27:35 -03:00
nios2 replace tgammaf by the CORE-MATH implementation 2024-10-11 11:12:32 +02:00
nptl stdlib: Make abort/_Exit AS-safe (BZ 26275) 2024-10-08 14:40:12 -03:00
or1k replace tgammaf by the CORE-MATH implementation 2024-10-11 11:12:32 +02:00
posix stdlib: Make abort/_Exit AS-safe (BZ 26275) 2024-10-08 14:40:12 -03:00
powerpc math: Use exp2m1f from CORE-MATH 2024-11-01 11:27:35 -03:00
pthread Add more tests of pthread_mutexattr_gettype and pthread_mutexattr_settype 2024-10-23 16:45:15 +00:00
riscv math: Use exp2m1f from CORE-MATH 2024-11-01 11:27:35 -03:00
s390 math: Use exp2m1f from CORE-MATH 2024-11-01 11:27:35 -03:00
sh replace tgammaf by the CORE-MATH implementation 2024-10-11 11:12:32 +02:00
sparc math: Use exp2m1f from CORE-MATH 2024-11-01 11:27:35 -03:00
unix LoongArch: Add RSEQ_SIG in rseq.h. 2024-11-01 10:41:20 +08:00
wordsize-32 Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wordsize-64 Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
x86 x86: Enable non-temporal memset for Hygon processors 2024-08-26 10:01:58 -07:00
x86_64 math: Use exp2m1f from CORE-MATH 2024-11-01 11:27:35 -03:00