diff options
author | Ulrich Drepper <drepper@redhat.com> | 2009-08-24 10:20:58 -0700 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2009-08-24 10:20:58 -0700 |
commit | ef72d5f1b95fe91b032de0ad1ee777d7cf4fb49f (patch) | |
tree | 01e1c04b230edff01629be1e3a806b3b4323e6df /sysdeps/x86_64 | |
parent | 4b6bf3f205cd4908019e03ac097f847e63677c32 (diff) | |
download | glibc-ef72d5f1b95fe91b032de0ad1ee777d7cf4fb49f.tar.gz glibc-ef72d5f1b95fe91b032de0ad1ee777d7cf4fb49f.tar.xz glibc-ef72d5f1b95fe91b032de0ad1ee777d7cf4fb49f.zip |
Optimize x86-64 signbit{,f} a bit.
Diffstat (limited to 'sysdeps/x86_64')
-rw-r--r-- | sysdeps/x86_64/fpu/bits/mathinline.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sysdeps/x86_64/fpu/bits/mathinline.h b/sysdeps/x86_64/fpu/bits/mathinline.h index e8a919fe92..8d4850dfc0 100644 --- a/sysdeps/x86_64/fpu/bits/mathinline.h +++ b/sysdeps/x86_64/fpu/bits/mathinline.h @@ -1,5 +1,5 @@ /* Inline math functions for x86-64. - Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2007, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>, 2002. @@ -35,14 +35,16 @@ __MATH_INLINE int __NTH (__signbitf (float __x)) { - __extension__ union { float __f; int __i; } __u = { __f: __x }; - return __u.__i < 0; + int __m; + asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x)); + return __m & 0x8; } __MATH_INLINE int __NTH (__signbit (double __x)) { - __extension__ union { double __d; int __i[2]; } __u = { __d: __x }; - return __u.__i[1] < 0; + int __m; + asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x)); + return __m & 0x80; } __MATH_INLINE int __NTH (__signbitl (long double __x)) |