diff options
Diffstat (limited to 'sysdeps/x86_64/fpu/bits')
-rw-r--r-- | sysdeps/x86_64/fpu/bits/fenv.h | 35 | ||||
-rw-r--r-- | sysdeps/x86_64/fpu/bits/mathinline.h | 3 |
2 files changed, 36 insertions, 2 deletions
diff --git a/sysdeps/x86_64/fpu/bits/fenv.h b/sysdeps/x86_64/fpu/bits/fenv.h index 11859f00c8..be2518dac3 100644 --- a/sysdeps/x86_64/fpu/bits/fenv.h +++ b/sysdeps/x86_64/fpu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2000,2001,2004 Free Software Foundation, Inc. +/* Copyright (C) 1997-2001,2004,2011 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 @@ -95,3 +95,36 @@ fenv_t; /* Floating-point environment where none of the exception is masked. */ # define FE_NOMASK_ENV ((__const fenv_t *) -2) #endif + + +#ifdef __OPTIMIZE__ +/* Optimized versions. */ +extern int __feraiseexcept_renamed (int) __asm__ ("feraiseexcept"); +__extern_inline int feraiseexcept (int __excepts) +{ + if (__builtin_constant_p (__excepts) + && (__excepts & ~(FE_INVALID | FE_DIVBYZERO)) == 0) + { + if ((FE_INVALID & __excepts) != 0) + { + /* One example of a invalid operation is 0.0 / 0.0. */ + float __f = 0.0; + + __asm__ __volatile__ ("divss %0, %0 " : : "x" (__f)); + (void) &__f; + } + if ((FE_DIVBYZERO & __excepts) != 0) + { + float f = 1.0; + float g = 0.0; + + __asm__ __volatile__ ("divss %1, %0" : : "x" (f), "x" (g)); + (void) &f; + } + + return 0; + } + + return __feraiseexcept_renamed (__excepts); +} +#endif diff --git a/sysdeps/x86_64/fpu/bits/mathinline.h b/sysdeps/x86_64/fpu/bits/mathinline.h index 780f8786dd..5bdf47ecbf 100644 --- a/sysdeps/x86_64/fpu/bits/mathinline.h +++ b/sysdeps/x86_64/fpu/bits/mathinline.h @@ -103,7 +103,8 @@ __NTH (llrint (double __x)) } # endif -# if __FINITE_MATH_ONLY__ == 1 && (__WORDSIZE == 64 || defined __SSE2_MATH__) +# if defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0 \ + && (__WORDSIZE == 64 || defined __SSE2_MATH__) /* Determine maximum of two values. */ __MATH_INLINE float __NTH (fmaxf (float __x, float __y)) |