about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2012-03-06 15:58:51 -0800
committerRichard Henderson <rth@twiddle.net>2012-03-09 11:15:47 -0800
commit15194b4b3d39e3d2099f9159f3a8abb52d37cc00 (patch)
tree2319d488746b9861828c5878aace5f6cc6425a76
parent64e21edef13c6d2592f276d599d8eed01a1b1a9a (diff)
downloadglibc-15194b4b3d39e3d2099f9159f3a8abb52d37cc00.tar.gz
glibc-15194b4b3d39e3d2099f9159f3a8abb52d37cc00.tar.xz
glibc-15194b4b3d39e3d2099f9159f3a8abb52d37cc00.zip
x86_64: Convert __rint* and __floor* from macros to inlines.
-rw-r--r--ChangeLog4
-rw-r--r--sysdeps/x86_64/fpu/math_private.h92
2 files changed, 47 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index d8d167aaa2..59d7e9e822 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-03-08  Richard Henderson  <rth@twiddle.net>
 
+	* sysdeps/x86_64/fpu/math_private.h (__rint): Convert from macro
+	to inline function.
+	(__rintf, __floor, __floorf): Likewise.
+
 	* sysdeps/x86_64/fpu/math_private.h (__ieee754_sqrt): Convert from
 	macro to inline function.
 	(__ieee754_sqrtf, __ieee754_sqrtl): Likewise.
diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h
index 07bc7e30c4..9b8d31de87 100644
--- a/sysdeps/x86_64/fpu/math_private.h
+++ b/sysdeps/x86_64/fpu/math_private.h
@@ -123,60 +123,54 @@ __ieee754_sqrtl (long double d)
 }
 
 #ifdef __SSE4_1__
-# ifndef __rint
-#  if defined __AVX__ || defined SSE2AVX
-#   define __rint(d) \
-  ({ double __res; \
-    asm ("vroundsd $4, %1, %0, %0" : "=x" (__res) : "xm" ((double) (d)));      \
-     __res; })
-#  else
-#   define __rint(d) \
-  ({ double __res; \
-    asm ("roundsd $4, %1, %0" : "=x" (__res) : "xm" ((double) (d)));	      \
-     __res; })
-#  endif
+extern __always_inline double
+__rint (double d)
+{
+  double res;
+# if defined __AVX__ || defined SSE2AVX
+  asm ("vroundsd $4, %1, %0, %0" : "=x" (res) : "xm" (d));
+# else
+  asm ("roundsd $4, %1, %0" : "=x" (res) : "xm" (d));
 # endif
-# ifndef __rintf
-#  if defined __AVX__ || defined SSE2AVX
-#   define __rintf(d) \
-  ({ float __res; \
-    asm ("vroundss $4, %1, %0, %0" : "=x" (__res) : "xm" ((float) (d)));      \
-     __res; })
-#  else
-#   define __rintf(d) \
-  ({ float __res; \
-    asm ("roundss $4, %1, %0" : "=x" (__res) : "xm" ((float) (d)));	      \
-     __res; })
-#  endif
+  return res;
+}
+
+extern __always_inline float
+__rintf (float d)
+{
+  float res;
+# if defined __AVX__ || defined SSE2AVX
+  asm ("vroundss $4, %1, %0, %0" : "=x" (res) : "xm" (d));
+# else
+  asm ("roundss $4, %1, %0" : "=x" (res) : "xm" (d));
 # endif
+  return res;
+}
 
-# ifndef __floor
-#  if defined __AVX__ || defined SSE2AVX
-#   define __floor(d) \
-  ({ double __res; \
-    asm ("vroundsd $1, %1, %0, %0" : "=x" (__res) : "xm" ((double) (d)));      \
-     __res; })
-#  else
-#   define __floor(d) \
-  ({ double __res; \
-    asm ("roundsd $1, %1, %0" : "=x" (__res) : "xm" ((double) (d)));	      \
-     __res; })
-#  endif
+extern __always_inline double
+__floor (double d)
+{
+  double res;
+# if defined __AVX__ || defined SSE2AVX
+  asm ("vroundsd $1, %1, %0, %0" : "=x" (res) : "xm" (d));
+# else
+  asm ("roundsd $1, %1, %0" : "=x" (res) : "xm" (d));
 # endif
-# ifndef __floorf
-#  if defined __AVX__ || defined SSE2AVX
-#   define __floorf(d) \
-  ({ float __res; \
-    asm ("vroundss $1, %1, %0, %0" : "=x" (__res) : "xm" ((float) (d)));      \
-     __res; })
-#  else
-#   define __floorf(d) \
-  ({ float __res; \
-    asm ("roundss $1, %1, %0" : "=x" (__res) : "xm" ((float) (d)));	      \
-     __res; })
+  return res;
+}
+
+extern __always_inline float
+__floorf (float d)
+{
+  float res;
+# if defined __AVX__ || defined SSE2AVX
+  asm ("vroundss $1, %1, %0, %0" : "=x" (res) : "xm" (d));
+# else
+  asm ("roundss $1, %1, %0" : "=x" (res) : "xm" (d));
 #  endif
-# endif
-#endif
+  return res;
+}
+#endif /* __SSE4_1__ */
 
 
 /* Specialized variants of the <fenv.h> interfaces which only handle