diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/ia64/bits/floatn.h | 8 | ||||
-rw-r--r-- | sysdeps/ieee754/float128/s_signbitf128.c | 37 | ||||
-rw-r--r-- | sysdeps/powerpc/bits/floatn.h | 8 | ||||
-rw-r--r-- | sysdeps/x86/bits/floatn.h | 8 |
4 files changed, 60 insertions, 1 deletions
diff --git a/sysdeps/ia64/bits/floatn.h b/sysdeps/ia64/bits/floatn.h index c7b1df6d2c..dbb6eb2325 100644 --- a/sysdeps/ia64/bits/floatn.h +++ b/sysdeps/ia64/bits/floatn.h @@ -89,6 +89,14 @@ typedef __float128 _Float128; # define __builtin_nansf128(x) ((_Float128) __builtin_nans (x)) # endif +/* In math/math.h, __MATH_TG will expand signbit to __builtin_signbit*, + e.g.: __builtin_signbitf128, before GCC 6. However, there has never + been a __builtin_signbitf128 in GCC and the type-generic builtin is + only available since GCC 6. */ +# if !__GNUC_PREREQ (6, 0) +# define __builtin_signbitf128 __signbitf128 +# endif + #endif #endif /* _BITS_FLOATN_H */ diff --git a/sysdeps/ieee754/float128/s_signbitf128.c b/sysdeps/ieee754/float128/s_signbitf128.c index 71c1ca3a34..4ea010365a 100644 --- a/sysdeps/ieee754/float128/s_signbitf128.c +++ b/sysdeps/ieee754/float128/s_signbitf128.c @@ -1,2 +1,37 @@ +/* Return nonzero value if number is negative. + Copyright (C) 2017 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + #include <float128_private.h> -#include "../ldbl-128/s_signbitl.c" +#include <math.h> +#include <math_private.h> + +/* Once GCC >= 6.0 is required for building glibc, this implementation can + be removed and replaced with an inclusion of ldbl-128/s_signbitl.c. */ +int +__signbitf128 (_Float128 x) +{ +#if __GNUC_PREREQ (6, 0) + return __builtin_signbit (x); +#else + int64_t e; + + GET_FLOAT128_MSW64 (e, x); + return e < 0; +#endif +} +hidden_def (__signbitf128) diff --git a/sysdeps/powerpc/bits/floatn.h b/sysdeps/powerpc/bits/floatn.h index be57e7015f..0ce997c68c 100644 --- a/sysdeps/powerpc/bits/floatn.h +++ b/sysdeps/powerpc/bits/floatn.h @@ -87,6 +87,14 @@ typedef __float128 _Float128; # define __builtin_nansf128 __builtin_nansq # endif +/* In math/math.h, __MATH_TG will expand signbit to __builtin_signbit*, + e.g.: __builtin_signbitf128, before GCC 6. However, there has never + been a __builtin_signbitf128 in GCC and the type-generic builtin is + only available since GCC 6. */ +# if !__GNUC_PREREQ (6, 0) +# define __builtin_signbitf128 __signbitf128 +# endif + #endif #endif /* _BITS_FLOATN_H */ diff --git a/sysdeps/x86/bits/floatn.h b/sysdeps/x86/bits/floatn.h index 23f74782ea..f93a9f8dbb 100644 --- a/sysdeps/x86/bits/floatn.h +++ b/sysdeps/x86/bits/floatn.h @@ -91,6 +91,14 @@ typedef __float128 _Float128; # define __builtin_nansf128(x) ((_Float128) __builtin_nans (x)) # endif +/* In math/math.h, __MATH_TG will expand signbit to __builtin_signbit*, + e.g.: __builtin_signbitf128, before GCC 6. However, there has never + been a __builtin_signbitf128 in GCC and the type-generic builtin is + only available since GCC 6. */ +# if !__GNUC_PREREQ (6, 0) +# define __builtin_signbitf128 __signbitf128 +# endif + #endif #endif /* _BITS_FLOATN_H */ |