diff options
| author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2025-11-04 13:20:00 -0300 |
|---|---|---|
| committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2025-11-05 07:15:52 -0300 |
| commit | 7ec8eb567639b6cfd2a8f3d267bdc6dd47c32d3e (patch) | |
| tree | 2a3df05b19f870b3d78f30f30af2f00f09fd0bfe /sysdeps/ieee754 | |
| parent | a5cc3018f31a125f019685b239c6e5a0bf1a272b (diff) | |
math: Remove the SVID error handling from atan2f
It improves latency for about 3-6% and throughput for about 5-12%.
Tested on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Diffstat (limited to 'sysdeps/ieee754')
| -rw-r--r-- | sysdeps/ieee754/flt-32/e_atan2f.c | 24 | ||||
| -rw-r--r-- | sysdeps/ieee754/flt-32/w_atan2f.c | 1 |
2 files changed, 21 insertions, 4 deletions
diff --git a/sysdeps/ieee754/flt-32/e_atan2f.c b/sysdeps/ieee754/flt-32/e_atan2f.c index 1c72845c7c..03070e017d 100644 --- a/sysdeps/ieee754/flt-32/e_atan2f.c +++ b/sysdeps/ieee754/flt-32/e_atan2f.c @@ -3,7 +3,7 @@ Copyright (c) 2022-2024 Alexei Sibidanov and Paul Zimmermann. The original version of this file was copied from the CORE-MATH -project (file src/binary32/atan2/atan2f.c, revision 7835c5d). +project (file src/binary32/atan2/atan2f.c, revision 9b28a4a). Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -28,6 +28,8 @@ SOFTWARE. #include <math.h> #include <stdint.h> #include <libm-alias-finite.h> +#include <libm-alias-float.h> +#include <math-svid-compat.h> #include "math_config.h" static inline double @@ -85,11 +87,15 @@ cr_atan2f_tiny (float y, float x) else t -= 1; } - return asdouble (t); + double r = asdouble (t); + float rf = r; + if (__glibc_unlikely (rf == 0.0f)) + return __math_uflowf (t >> 63); + return rf; } float -__ieee754_atan2f (float y, float x) +__atan2f (float y, float x) { static const double cn[] = { @@ -269,6 +275,16 @@ __ieee754_atan2f (float y, float x) } r = th + tm; } - return r; + float rf = r; + if (__glibc_unlikely (rf == 0.0f)) + return __math_uflowf (asuint (rf) >> 1); + return rf; } +strong_alias (__atan2f, __ieee754_atan2f) +#if LIBM_SVID_COMPAT +versioned_symbol (libm, __atan2f, atan2f, GLIBC_2_43); +libm_alias_float_other (__atan2, atan2) +#else +libm_alias_float (__atan2, atan2) +#endif libm_alias_finite (__ieee754_atan2f, __atan2f) diff --git a/sysdeps/ieee754/flt-32/w_atan2f.c b/sysdeps/ieee754/flt-32/w_atan2f.c new file mode 100644 index 0000000000..1cc8931700 --- /dev/null +++ b/sysdeps/ieee754/flt-32/w_atan2f.c @@ -0,0 +1 @@ +/* Not needed. */ |
