aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/i386
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-11-23 12:54:51 +0000
committerUlrich Drepper <drepper@redhat.com>1998-11-23 12:54:51 +0000
commit33127459680e76c8d54ea46d4af24a672d8a1278 (patch)
treeacc1e276edd9ae07787a262b90552275cec91943 /sysdeps/i386
parenta42134a70be89e902efa6dfd1484e21aa040acb0 (diff)
downloadglibc-33127459680e76c8d54ea46d4af24a672d8a1278.tar
glibc-33127459680e76c8d54ea46d4af24a672d8a1278.tar.gz
glibc-33127459680e76c8d54ea46d4af24a672d8a1278.tar.bz2
glibc-33127459680e76c8d54ea46d4af24a672d8a1278.zip
Update.
1998-11-23 Ulrich Drepper <drepper@cygnus.com> * sysdeps/i386/fpu/bits/mathinline.h: Add optimizations for lrint and llrint.
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/fpu/bits/mathinline.h49
1 files changed, 48 insertions, 1 deletions
diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h
index 91dce771ab..463d481ce7 100644
--- a/sysdeps/i386/fpu/bits/mathinline.h
+++ b/sysdeps/i386/fpu/bits/mathinline.h
@@ -565,6 +565,52 @@ __inline_mathcode3 (fma, __x, __y, __z, return (__x * __y) + __z)
__inline_mathop(rint, "frndint")
+#define __lrint_code \
+ long int __lrintres; \
+ __asm__ __volatile__ \
+ ("fistpl %0" \
+ : "=m" (__lrintres) : "t" (__x) : "st"); \
+ return __lrintres
+__MATH_INLINE long int
+lrintf (float __x)
+{
+ __lrint_code;
+}
+__MATH_INLINE long int
+lrint (double __x)
+{
+ __lrint_code;
+}
+__MATH_INLINE long int
+lrintl (long double __x)
+{
+ __lrint_code;
+}
+#undef __lrint_code
+
+#define __llrint_code \
+ long long int __llrintres; \
+ __asm__ __volatile__ \
+ ("fistpll %0" \
+ : "=m" (__llrintres) : "t" (__x) : "st"); \
+ return __llrintres
+__MATH_INLINE long long int
+llrintf (float __x)
+{
+ __llrint_code;
+}
+__MATH_INLINE long long int
+llrint (double __x)
+{
+ __llrint_code;
+}
+__MATH_INLINE long long int
+llrintl (long double __x)
+{
+ __llrint_code;
+}
+#undef __llrint_code
+
#endif
@@ -572,12 +618,13 @@ __inline_mathop(rint, "frndint")
__inline_mathcode2 (drem, __x, __y, \
register double __value; \
+ register int __clobbered; \
__asm __volatile__ \
("1: fprem1\n\t" \
"fstsw %%ax\n\t" \
"sahf\n\t" \
"jp 1b" \
- : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); \
+ : "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); \
return __value)