summaryrefslogtreecommitdiff
path: root/sysdeps/powerpc/fpu/s_rintf.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-03-08 20:26:36 +0000
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-06-12 11:46:22 -0300
commit21bd039bb41a59cdbd6c93670433e3b473720653 (patch)
tree4047dcc470c90f96a12f8b2d3e43e726da1f3e8d /sysdeps/powerpc/fpu/s_rintf.c
parentcfa611447b44d2fa1cb3d8f853b6f3f75ade366a (diff)
downloadglibc-21bd039bb41a59cdbd6c93670433e3b473720653.tar.gz
powerpc: consolidate rint
This patches consolidates all the powerpc rint{f} implementations on the generic sysdeps/powerpc/fpu/s_rint{f}. Checked on powerpc-linux-gnu (built without --with-cpu, with --with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch), powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+ and --disable-multi-arch). * sysdeps/powerpc/fpu/round_to_integer.h (set_fenv_mode, round_to_integer_float, round_mode): Add RINT handling. (reset_fenv_mode): New symbol. * sysdeps/powerpc/fpu/s_rint.c (__rint): Use generic implementation. * sysdeps/powerpc/fpu/s_rintf.c (__rintf): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_rint.S: Remove file. * sysdeps/powerpc/powerpc32/fpu/s_rintf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_rint.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise. Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
Diffstat (limited to 'sysdeps/powerpc/fpu/s_rintf.c')
-rw-r--r--sysdeps/powerpc/fpu/s_rintf.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/sysdeps/powerpc/fpu/s_rintf.c b/sysdeps/powerpc/fpu/s_rintf.c
index 03aaec2c85..c29e7a22b4 100644
--- a/sysdeps/powerpc/fpu/s_rintf.c
+++ b/sysdeps/powerpc/fpu/s_rintf.c
@@ -19,26 +19,11 @@
#define NO_MATH_REDIRECT
#include <math.h>
#include <libm-alias-float.h>
+#include <round_to_integer.h>
float
__rintf (float x)
{
- static const float TWO23 = 8388608.0;
-
- if (fabsf (x) < TWO23)
- {
- if (x > 0.0)
- {
- x += TWO23;
- x -= TWO23;
- }
- else if (x < 0.0)
- {
- x = TWO23 - x;
- x = -(x - TWO23);
- }
- }
-
- return x;
+ return round_to_integer_float (RINT, x);
}
libm_alias_float (__rint, rint)