File tree Expand file tree Collapse file tree 5 files changed +22
-82
lines changed Expand file tree Collapse file tree 5 files changed +22
-82
lines changed Original file line number Diff line number Diff line change 1919#include " src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
2020#include " src/math/generic/sincos_eval.h"
2121
22- #ifdef LIBC_TARGET_CPU_HAS_FMA
23- #include " range_reduction_double_fma.h"
24-
25- using LIBC_NAMESPACE::fma::FAST_PASS_EXPONENT;
26- using LIBC_NAMESPACE::fma::ONE_TWENTY_EIGHT_OVER_PI;
27- using LIBC_NAMESPACE::fma::range_reduction_small;
28- using LIBC_NAMESPACE::fma::SIN_K_PI_OVER_128;
29-
30- LIBC_INLINE constexpr bool NO_FMA = false ;
31- #else
32- #include " range_reduction_double_nofma.h"
33-
34- using LIBC_NAMESPACE::nofma::FAST_PASS_EXPONENT;
35- using LIBC_NAMESPACE::nofma::ONE_TWENTY_EIGHT_OVER_PI;
36- using LIBC_NAMESPACE::nofma::range_reduction_small;
37- using LIBC_NAMESPACE::nofma::SIN_K_PI_OVER_128;
38-
39- LIBC_INLINE constexpr bool NO_FMA = true ;
40- #endif // LIBC_TARGET_CPU_HAS_FMA
41-
4222// TODO: We might be able to improve the performance of large range reduction of
4323// non-FMA targets further by operating directly on 25-bit chunks of 128/pi and
4424// pre-split SIN_K_PI_OVER_128, but that might double the memory footprint of
Original file line number Diff line number Diff line change 1818#include " src/__support/integer_literals.h"
1919#include " src/__support/macros/config.h"
2020
21+ #ifdef LIBC_TARGET_CPU_HAS_FMA
22+ #include " range_reduction_double_fma.h"
23+
24+ // With FMA, we limit the maxmimum exponent to be 2^16, so that the error bound
25+ // from the fma::range_reduction_small is bounded by 2^-88 instead of 2^-72.
26+ #define FAST_PASS_EXPONENT 16
27+ using LIBC_NAMESPACE::fma::ONE_TWENTY_EIGHT_OVER_PI;
28+ using LIBC_NAMESPACE::fma::range_reduction_small;
29+ using LIBC_NAMESPACE::fma::SIN_K_PI_OVER_128;
30+
31+ LIBC_INLINE constexpr bool NO_FMA = false ;
32+ #else
33+ #include " range_reduction_double_nofma.h"
34+
35+ using LIBC_NAMESPACE::nofma::FAST_PASS_EXPONENT;
36+ using LIBC_NAMESPACE::nofma::ONE_TWENTY_EIGHT_OVER_PI;
37+ using LIBC_NAMESPACE::nofma::range_reduction_small;
38+ using LIBC_NAMESPACE::nofma::SIN_K_PI_OVER_128;
39+
40+ LIBC_INLINE constexpr bool NO_FMA = true ;
41+ #endif // LIBC_TARGET_CPU_HAS_FMA
42+
2143namespace LIBC_NAMESPACE_DECL {
2244
2345namespace generic {
Original file line number Diff line number Diff line change 2020#include " src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
2121#include " src/math/generic/sincos_eval.h"
2222
23- #ifdef LIBC_TARGET_CPU_HAS_FMA
24- #include " range_reduction_double_fma.h"
25-
26- using LIBC_NAMESPACE::fma::FAST_PASS_EXPONENT;
27- using LIBC_NAMESPACE::fma::ONE_TWENTY_EIGHT_OVER_PI;
28- using LIBC_NAMESPACE::fma::range_reduction_small;
29- using LIBC_NAMESPACE::fma::SIN_K_PI_OVER_128;
30-
31- LIBC_INLINE constexpr bool NO_FMA = false ;
32- #else
33- #include " range_reduction_double_nofma.h"
34-
35- using LIBC_NAMESPACE::nofma::FAST_PASS_EXPONENT;
36- using LIBC_NAMESPACE::nofma::ONE_TWENTY_EIGHT_OVER_PI;
37- using LIBC_NAMESPACE::nofma::range_reduction_small;
38- using LIBC_NAMESPACE::nofma::SIN_K_PI_OVER_128;
39-
40- LIBC_INLINE constexpr bool NO_FMA = true ;
41- #endif // LIBC_TARGET_CPU_HAS_FMA
42-
4323// TODO: We might be able to improve the performance of large range reduction of
4424// non-FMA targets further by operating directly on 25-bit chunks of 128/pi and
4525// pre-split SIN_K_PI_OVER_128, but that might double the memory footprint of
Original file line number Diff line number Diff line change 2121#include " src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
2222#include " src/math/generic/sincos_eval.h"
2323
24- #ifdef LIBC_TARGET_CPU_HAS_FMA
25- #include " range_reduction_double_fma.h"
26-
27- using LIBC_NAMESPACE::fma::FAST_PASS_EXPONENT;
28- using LIBC_NAMESPACE::fma::ONE_TWENTY_EIGHT_OVER_PI;
29- using LIBC_NAMESPACE::fma::range_reduction_small;
30- using LIBC_NAMESPACE::fma::SIN_K_PI_OVER_128;
31-
32- LIBC_INLINE constexpr bool NO_FMA = false ;
33- #else
34- #include " range_reduction_double_nofma.h"
35-
36- using LIBC_NAMESPACE::nofma::FAST_PASS_EXPONENT;
37- using LIBC_NAMESPACE::nofma::ONE_TWENTY_EIGHT_OVER_PI;
38- using LIBC_NAMESPACE::nofma::range_reduction_small;
39- using LIBC_NAMESPACE::nofma::SIN_K_PI_OVER_128;
40-
41- LIBC_INLINE constexpr bool NO_FMA = true ;
42- #endif // LIBC_TARGET_CPU_HAS_FMA
43-
4424// TODO: We might be able to improve the performance of large range reduction of
4525// non-FMA targets further by operating directly on 25-bit chunks of 128/pi and
4626// pre-split SIN_K_PI_OVER_128, but that might double the memory footprint of
Original file line number Diff line number Diff line change 2121#include " src/__support/macros/optimization.h" // LIBC_UNLIKELY
2222#include " src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
2323
24- #ifdef LIBC_TARGET_CPU_HAS_FMA
25- #include " range_reduction_double_fma.h"
26-
27- // With FMA, we limit the maxmimum exponent to be 2^16, so that the error bound
28- // from the fma::range_reduction_small is bounded by 2^-88 instead of 2^-72.
29- #define FAST_PASS_EXPONENT 16
30- using LIBC_NAMESPACE::fma::ONE_TWENTY_EIGHT_OVER_PI;
31- using LIBC_NAMESPACE::fma::range_reduction_small;
32- using LIBC_NAMESPACE::fma::SIN_K_PI_OVER_128;
33-
34- LIBC_INLINE constexpr bool NO_FMA = false ;
35- #else
36- #include " range_reduction_double_nofma.h"
37-
38- using LIBC_NAMESPACE::nofma::FAST_PASS_EXPONENT;
39- using LIBC_NAMESPACE::nofma::ONE_TWENTY_EIGHT_OVER_PI;
40- using LIBC_NAMESPACE::nofma::range_reduction_small;
41- using LIBC_NAMESPACE::nofma::SIN_K_PI_OVER_128;
42-
43- LIBC_INLINE constexpr bool NO_FMA = true ;
44- #endif // LIBC_TARGET_CPU_HAS_FMA
45-
4624// TODO: We might be able to improve the performance of large range reduction of
4725// non-FMA targets further by operating directly on 25-bit chunks of 128/pi and
4826// pre-split SIN_K_PI_OVER_128, but that might double the memory footprint of
You can’t perform that action at this time.
0 commit comments