Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Optimize x86-64 signbit{,f} a bit.
  • Loading branch information
Ulrich Drepper committed Aug 24, 2009
1 parent 4b6bf3f commit ef72d5f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
2009-08-24 Ulrich Drepper <drepper@redhat.com>

* sysdeps/x86_64/fpu/bits/mathinline.h (__signbit): Optimize.
(__signbitf): Likewise.

2009-08-23 Ulrich Drepper <drepper@redhat.com>

* posix/regcomp.c (parse_dup_op): Verify the expression is correctly
Expand Down
12 changes: 7 additions & 5 deletions 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.
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit ef72d5f

Please sign in to comment.