]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/x86_64/fpu/math_private.h
Provide internal optimizations on x86-64 with SSE4.1
[thirdparty/glibc.git] / sysdeps / x86_64 / fpu / math_private.h
index 523ec549ac6409dffe7203a440ebb23744cb6a6d..71eb41664f861752ee704fa695d6239d1a52cfc1 100644 (file)
@@ -90,3 +90,31 @@ do {                                                         \
   ({ long double __res;                                                              \
      asm ("fsqrt" : "=t" (__res) : "0" ((long double) d));                   \
      __res; })
+
+#ifdef __SSE4_1__
+# ifndef __rint
+#  define __rint(d) \
+  ({ double __res; \
+     asm ("roundsd $4, %1, %0" : "=x" (__res) : "x" ((double) d));           \
+     __res; })
+# endif
+# ifndef __rintf
+#  define __rintf(d) \
+  ({ float __res; \
+     asm ("roundss $4, %1, %0" : "=x" (__res) : "x" ((float) d));            \
+     __res; })
+# endif
+
+# ifndef __floor
+#  define __floor(d) \
+  ({ double __res; \
+     asm ("roundsd $1, %1, %0" : "=x" (__res) : "x" ((double) d));           \
+     __res; })
+# endif
+# ifndef __floorf
+#  define __floorf(d) \
+  ({ float __res; \
+     asm ("roundss $1, %1, %0" : "=x" (__res) : "x" ((float) d));            \
+     __res; })
+# endif
+#endif