This is an archive of the discontinued LLVM Phabricator instance.

[libc][math] Implement double precision exp2 function correctly rounded for all rounding modes.
ClosedPublic

Authored by lntue on Aug 24 2023, 9:46 PM.

Details

Summary

Implement double precision exp2 function correctly rounded for all
rounding modes. Using the same algorithm as double precision exp function in
https://reviews.llvm.org/D158551.

Diff Detail

Event Timeline

lntue created this revision.Aug 24 2023, 9:46 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 24 2023, 9:46 PM
lntue requested review of this revision.Aug 24 2023, 9:46 PM
zimmermann6 accepted this revision.Aug 24 2023, 11:43 PM

all CORE-MATH tests do pass, and I get on an AMD EPYC 7282:

zimmerma@biscotte:~/svn/core-math$ LIBM=/localdisk/zimmerma/llvm-project/build/projects/libc/lib/libm.a CORE_MATH_PERF_MODE=rdtsc ./perf.sh exp2
GNU libc version: 2.37
GNU libc release: stable
[####################] 100 %
Ntrial = 20 ; Min = 27.634 + 0.381 clc/call; Median-Min = 0.332 clc/call; Max = 29.524 clc/call;
[####################] 100 %
Ntrial = 20 ; Min = 8.795 + 0.332 clc/call; Median-Min = 0.282 clc/call; Max = 9.361 clc/call;
[####################] 100 %
Ntrial = 20 ; Min = 17.916 + 0.145 clc/call; Median-Min = 0.054 clc/call; Max = 18.288 clc/call;

and for the latency:

zimmerma@biscotte:~/svn/core-math$ LIBM=/localdisk/zimmerma/llvm-project/build/projects/libc/lib/libm.a CORE_MATH_PERF_MODE=rdtsc PERF_ARGS=--latency ./perf.sh exp2
GNU libc version: 2.37
GNU libc release: stable
[####################] 100 %
Ntrial = 20 ; Min = 74.091 + 0.367 clc/call; Median-Min = 0.326 clc/call; Max = 74.729 clc/call;
[####################] 100 %
Ntrial = 20 ; Min = 31.585 + 0.349 clc/call; Median-Min = 0.318 clc/call; Max = 32.236 clc/call;
[####################] 100 %
Ntrial = 20 ; Min = 53.596 + 0.405 clc/call; Median-Min = 0.329 clc/call; Max = 54.656 clc/call;
This revision is now accepted and ready to land.Aug 24 2023, 11:43 PM