about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-04-12 03:39:30 +0000
committerUlrich Drepper <drepper@redhat.com>2008-04-12 03:39:30 +0000
commitc3a0ead420b4b2a4098cf0afea8f927094f5abbc (patch)
treed2f8c0fdf848bc25f1eb6ef417bae609cd3da8db /sysdeps
parent3cc56f9208123c12aaf9fdd96de9d880749cfd8f (diff)
downloadglibc-c3a0ead420b4b2a4098cf0afea8f927094f5abbc.tar.gz
glibc-c3a0ead420b4b2a4098cf0afea8f927094f5abbc.tar.xz
glibc-c3a0ead420b4b2a4098cf0afea8f927094f5abbc.zip
* sysdeps/powerpc/fpu/e_sqrt.c: Avoid call to fetestexcept.
	* sysdeps/powerpc/fpu/e_sqrtf.c: Likewise.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/powerpc/fpu/e_sqrt.c8
-rw-r--r--sysdeps/powerpc/fpu/e_sqrtf.c8
2 files changed, 10 insertions, 6 deletions
diff --git a/sysdeps/powerpc/fpu/e_sqrt.c b/sysdeps/powerpc/fpu/e_sqrt.c
index 540b924656..24e0dd3523 100644
--- a/sysdeps/powerpc/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/fpu/e_sqrt.c
@@ -1,5 +1,5 @@
 /* Double-precision floating point square root.
-   Copyright (C) 1997, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2002, 2003, 2004, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -150,7 +150,9 @@ __slow_ieee754_sqrt (x)
          FE_INVALID_SQRT.  */
 #ifdef FE_INVALID_SQRT
       feraiseexcept (FE_INVALID_SQRT);
-      if (!fetestexcept (FE_INVALID))
+
+      fenv_union_t u = { .fenv = fegetenv_register () };
+      if ((u.l[1] & FE_INVALID) == 0)
 #endif
 	feraiseexcept (FE_INVALID);
       x = a_nan.value;
@@ -172,7 +174,7 @@ __ieee754_sqrt (x)
   /* If the CPU is 64-bit we can use the optional FP instructions.  */
   if (__CPU_HAS_FSQRT)
     {
-      /* Volatile is required to prevent the compiler from moving the 
+      /* Volatile is required to prevent the compiler from moving the
          fsqrt instruction above the branch.  */
       __asm __volatile ("	fsqrt	%0,%1\n"
 				:"=f" (z):"f" (x));
diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c
index b63d31472b..8e8138a17d 100644
--- a/sysdeps/powerpc/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/fpu/e_sqrtf.c
@@ -1,5 +1,5 @@
 /* Single-precision floating point square root.
-   Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2003, 2004, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -126,7 +126,9 @@ __slow_ieee754_sqrtf (x)
          FE_INVALID_SQRT.  */
 #ifdef FE_INVALID_SQRT
       feraiseexcept (FE_INVALID_SQRT);
-      if (!fetestexcept (FE_INVALID))
+
+      fenv_union_t u = { .fenv = fegetenv_register () };
+      if ((u.l[1] & FE_INVALID) == 0)
 #endif
 	feraiseexcept (FE_INVALID);
       x = a_nan.value;
@@ -149,7 +151,7 @@ __ieee754_sqrtf (x)
   /* If the CPU is 64-bit we can use the optional FP instructions.  */
   if (__CPU_HAS_FSQRT)
     {
-      /* Volatile is required to prevent the compiler from moving the 
+      /* Volatile is required to prevent the compiler from moving the
          fsqrt instruction above the branch.  */
       __asm __volatile ("	fsqrts	%0,%1\n"
 				:"=f" (z):"f" (x));