summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/dbl-64')
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c
index 885260163e..8bb52524b7 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c
@@ -21,6 +21,7 @@
 #define __lround __hidden___lround
 
 #include <math.h>
+#include <sysdep.h>
 
 #include <math_private.h>
 
@@ -64,16 +65,31 @@ __llround (double x)
 
 weak_alias (__llround, llround)
 #ifdef NO_LONG_DOUBLE
-strong_alias (__llround, __lroundl)
-weak_alias (__llround, lroundl)
+strong_alias (__llround, __llroundl)
+weak_alias (__llround, llroundl)
 #endif
 
-/* long has the same width as long long on 64-bit machines.  */
+/* long has the same width as long long on LP64 machines, so use an alias.
+   If building for ILP32 on a machine with 64-bit registers, however,
+   use a cast if necessary.  */
 #undef lround
 #undef __lround
+#if !defined (_LP64) && REGISTER_CAST_INT32_TO_INT64
+long int
+__lround (double x)
+{
+  return __llround (x);
+}
+weak_alias (__lround, lround)
+# ifdef NO_LONG_DOUBLE
+strong_alias (__lround, __lroundl)
+weak_alias (__lround, lroundl)
+# endif
+#else
 strong_alias (__llround, __lround)
 weak_alias (__llround, lround)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__llround, __llroundl)
-weak_alias (__llround, llroundl)
+# ifdef NO_LONG_DOUBLE
+strong_alias (__llround, __lroundl)
+weak_alias (__llround, lroundl)
+# endif
 #endif