summaryrefslogtreecommitdiff
path: root/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/powerpc/powerpc64/fpu/s_rintf.S')
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_rintf.S15
1 files changed, 11 insertions, 4 deletions
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_rintf.S b/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
index 0b274b008a..7ac532cc8e 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
@@ -1,5 +1,5 @@
/* Round float to int floating-point values. PowerPC64 version.
- Copyright (C) 2004-2016 Free Software Foundation, Inc.
+ Copyright (C) 2004-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
+#include <libm-alias-float.h>
.section ".toc","aw"
.p2align 3
@@ -25,14 +26,14 @@
.long 0x0
.section ".text"
-EALIGN (__rintf, 4, 0)
+ENTRY (__rintf, 4)
CALL_MCOUNT 0
lfs fp13,.LC0@toc(2)
fabs fp0,fp1
fsubs fp12,fp13,fp13 /* generate 0.0 */
fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */
fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
- bnllr cr7
+ bnl cr7,.L10
bng cr6,.L4
fadds fp1,fp1,fp13 /* x+= TWO23; */
fsubs fp1,fp1,fp13 /* x-= TWO23; */
@@ -44,7 +45,13 @@ EALIGN (__rintf, 4, 0)
fadds fp1,fp1,fp13 /* x+= TWO23; */
fnabs fp1,fp1 /* if (x == 0.0) */
blr /* x = -0.0; */
+.L10:
+ /* Ensure sNaN input is converted to qNaN. */
+ fcmpu cr7,fp1,fp1
+ beqlr cr7
+ fadds fp1,fp1,fp1
+ blr
END (__rintf)
-weak_alias (__rintf, rintf)
+libm_alias_float (__rint, rint)