diff options
Diffstat (limited to 'sysdeps/powerpc/bits')
-rw-r--r-- | sysdeps/powerpc/bits/endian.h | 2 | ||||
-rw-r--r-- | sysdeps/powerpc/bits/fenv.h | 11 | ||||
-rw-r--r-- | sysdeps/powerpc/bits/fenvinline.h | 18 | ||||
-rw-r--r-- | sysdeps/powerpc/bits/floatn.h | 122 | ||||
-rw-r--r-- | sysdeps/powerpc/bits/fp-fast.h | 39 | ||||
-rw-r--r-- | sysdeps/powerpc/bits/hwcap.h | 7 | ||||
-rw-r--r-- | sysdeps/powerpc/bits/link.h | 2 | ||||
-rw-r--r-- | sysdeps/powerpc/bits/mathdef.h | 46 | ||||
-rw-r--r-- | sysdeps/powerpc/bits/mathinline.h | 76 | ||||
-rw-r--r-- | sysdeps/powerpc/bits/setjmp.h | 2 |
10 files changed, 192 insertions, 133 deletions
diff --git a/sysdeps/powerpc/bits/endian.h b/sysdeps/powerpc/bits/endian.h index 9adaf0ce5e..5bf6d90247 100644 --- a/sysdeps/powerpc/bits/endian.h +++ b/sysdeps/powerpc/bits/endian.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. +/* Copyright (C) 1997-2018 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 diff --git a/sysdeps/powerpc/bits/fenv.h b/sysdeps/powerpc/bits/fenv.h index d2a6d34a99..39a75ebeec 100644 --- a/sysdeps/powerpc/bits/fenv.h +++ b/sysdeps/powerpc/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. +/* Copyright (C) 1997-2018 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 @@ -169,3 +169,12 @@ extern const fenv_t __fe_nonieee_env; # define FE_MASK_ENV FE_DFL_ENV #endif + +#if __GLIBC_USE (IEC_60559_BFP_EXT) +/* Type representing floating-point control modes. */ +typedef double femode_t; + +/* Default floating-point control modes. */ +extern const femode_t __fe_dfl_mode; +# define FE_DFL_MODE (&__fe_dfl_mode) +#endif diff --git a/sysdeps/powerpc/bits/fenvinline.h b/sysdeps/powerpc/bits/fenvinline.h index 4a7b2af6aa..41316386ba 100644 --- a/sysdeps/powerpc/bits/fenvinline.h +++ b/sysdeps/powerpc/bits/fenvinline.h @@ -1,5 +1,5 @@ /* Inline floating-point environment handling functions for powerpc. - Copyright (C) 1995-2016 Free Software Foundation, Inc. + Copyright (C) 1995-2018 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 @@ -32,8 +32,10 @@ warning when __excepts is not a constant. Otherwise, they mean the same as just plain 'i'. */ +# if __GNUC_PREREQ(3, 4) + /* Inline definition for feraiseexcept. */ -# define feraiseexcept(__excepts) \ +# define feraiseexcept(__excepts) \ (__extension__ ({ \ int __e = __excepts; \ int __ret; \ @@ -42,8 +44,8 @@ && __e != FE_INVALID) \ { \ if (__e != 0) \ - __asm__ __volatile__ ("mtfsb1 %s0" \ - : : "i#*X" (__builtin_ffs (__e))); \ + __asm__ __volatile__ ("mtfsb1 %0" \ + : : "i#*X" (__builtin_clz (__e))); \ __ret = 0; \ } \ else \ @@ -52,7 +54,7 @@ })) /* Inline definition for feclearexcept. */ -# define feclearexcept(__excepts) \ +# define feclearexcept(__excepts) \ (__extension__ ({ \ int __e = __excepts; \ int __ret; \ @@ -61,8 +63,8 @@ && __e != FE_INVALID) \ { \ if (__e != 0) \ - __asm__ __volatile__ ("mtfsb0 %s0" \ - : : "i#*X" (__builtin_ffs (__e))); \ + __asm__ __volatile__ ("mtfsb0 %0" \ + : : "i#*X" (__builtin_clz (__e))); \ __ret = 0; \ } \ else \ @@ -70,6 +72,8 @@ __ret; \ })) +# endif /* __GNUC_PREREQ(3, 4). */ + # endif /* !__NO_MATH_INLINES. */ #endif /* __GNUC__ && !_SOFT_FLOAT && !__NO_FPRS__ */ diff --git a/sysdeps/powerpc/bits/floatn.h b/sysdeps/powerpc/bits/floatn.h new file mode 100644 index 0000000000..c6d8b9b9b3 --- /dev/null +++ b/sysdeps/powerpc/bits/floatn.h @@ -0,0 +1,122 @@ +/* Macros to control TS 18661-3 glibc features on powerpc. + Copyright (C) 2017-2018 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/>. */ + +#ifndef _BITS_FLOATN_H +#define _BITS_FLOATN_H + +#include <features.h> +#include <bits/long-double.h> + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the IEEE 754 binary128 format, and this glibc + includes corresponding *f128 interfaces for it. */ +#if defined _ARCH_PWR8 && defined __LITTLE_ENDIAN__ && (_CALL_ELF == 2) \ + && defined __FLOAT128__ && !defined __NO_LONG_DOUBLE_MATH +# define __HAVE_FLOAT128 1 +#else +# define __HAVE_FLOAT128 0 +#endif + +/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct + from the default float, double and long double types in this glibc, i.e. + calls to the binary128 functions go to *f128 symbols instead of *l. */ +#if __HAVE_FLOAT128 +# define __HAVE_DISTINCT_FLOAT128 1 +#else +# define __HAVE_DISTINCT_FLOAT128 0 +#endif + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the right format for _Float64x, and this + glibc includes corresponding *f64x interfaces for it. */ +#define __HAVE_FLOAT64X __HAVE_FLOAT128 + +/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format + of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has + the format of _Float128, which must be different from that of long + double. */ +#define __HAVE_FLOAT64X_LONG_DOUBLE 0 + +#ifndef __ASSEMBLER__ + +/* Defined to concatenate the literal suffix to be used with _Float128 + types, if __HAVE_FLOAT128 is 1. */ +# if __HAVE_FLOAT128 +# if !__GNUC_PREREQ (7, 0) || defined __cplusplus +/* The literal suffix (f128) exist for powerpc only since GCC 7.0. */ +# if __LDBL_MANT_DIG__ == 113 +# define __f128(x) x##l +# else +# define __f128(x) x##q +# endif +# else +# define __f128(x) x##f128 +# endif +# endif + +/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */ +# if __HAVE_FLOAT128 +# if __LDBL_MANT_DIG__ == 113 && defined __cplusplus +typedef long double _Float128; +# define __CFLOAT128 _Complex long double +# elif !__GNUC_PREREQ (7, 0) || defined __cplusplus +/* The type _Float128 exist for powerpc only since GCC 7.0. */ +typedef __float128 _Float128; +/* Add a typedef for older GCC and C++ compilers which don't natively support + _Complex _Float128. */ +typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__KC__))); +# define __CFLOAT128 __cfloat128 +# else +# define __CFLOAT128 _Complex _Float128 +# endif +# endif + +/* The remaining of this file provides support for older compilers. */ +# if __HAVE_FLOAT128 +/* Builtin __builtin_huge_valf128 doesn't exist before GCC 7.0. */ +# if !__GNUC_PREREQ (7, 0) +# define __builtin_huge_valf128() ((_Float128) __builtin_huge_val ()) +# endif + +/* The following builtins (suffixed with 'q') are available in GCC >= 6.2, + which is the minimum version required for float128 support on powerpc64le. + Since GCC 7.0 the builtins suffixed with f128 are also available, then + there is no need to redefined them. */ +# if !__GNUC_PREREQ (7, 0) +# define __builtin_copysignf128 __builtin_copysignq +# define __builtin_fabsf128 __builtin_fabsq +# define __builtin_inff128 __builtin_infq +# define __builtin_nanf128 __builtin_nanq +# 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 /* !__ASSEMBLER__. */ + +#include <bits/floatn-common.h> + +#endif /* _BITS_FLOATN_H */ diff --git a/sysdeps/powerpc/bits/fp-fast.h b/sysdeps/powerpc/bits/fp-fast.h new file mode 100644 index 0000000000..40924a8a07 --- /dev/null +++ b/sysdeps/powerpc/bits/fp-fast.h @@ -0,0 +1,39 @@ +/* Define FP_FAST_* macros. PowerPC version. + Copyright (C) 2016-2018 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/>. */ + +#ifndef _MATH_H +# error "Never use <bits/fp-fast.h> directly; include <math.h> instead." +#endif + +#ifdef __USE_ISOC99 + +/* The GCC 4.6 compiler will define __FP_FAST_FMA{,F,L} if the fma{,f,l} + builtins are supported. */ +# if (!defined _SOFT_FLOAT && !defined __NO_FPRS__) || defined __FP_FAST_FMA +# define FP_FAST_FMA 1 +# endif + +# if (!defined _SOFT_FLOAT && !defined __NO_FPRS__) || defined __FP_FAST_FMAF +# define FP_FAST_FMAF 1 +# endif + +# ifdef __FP_FAST_FMAL +# define FP_FAST_FMAL 1 +# endif + +#endif diff --git a/sysdeps/powerpc/bits/hwcap.h b/sysdeps/powerpc/bits/hwcap.h index 40572d08fc..b35f5eddc1 100644 --- a/sysdeps/powerpc/bits/hwcap.h +++ b/sysdeps/powerpc/bits/hwcap.h @@ -1,5 +1,5 @@ /* Defines for bits in AT_HWCAP and AT_HWCAP2. - Copyright (C) 2012-2016 Free Software Foundation, Inc. + Copyright (C) 2012-2018 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 @@ -50,6 +50,7 @@ #define PPC_FEATURE_ARCH_2_06 0x00000100 /* ISA 2.06 */ #define PPC_FEATURE_HAS_VSX 0x00000080 /* P7 Vector Extension. */ #define PPC_FEATURE_PSERIES_PERFMON_COMPAT 0x00000040 +/* Reserved by the kernel. 0x00000004 Do not use. */ #define PPC_FEATURE_TRUE_LE 0x00000002 #define PPC_FEATURE_PPC_LE 0x00000001 @@ -69,3 +70,7 @@ #define PPC_FEATURE2_ARCH_3_00 0x00800000 /* ISA 3.0 */ #define PPC_FEATURE2_HAS_IEEE128 0x00400000 /* VSX IEEE Binary Float 128-bit */ +#define PPC_FEATURE2_DARN 0x00200000 /* darn instruction. */ +#define PPC_FEATURE2_SCV 0x00100000 /* scv syscall. */ +#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000 /* TM without suspended + state. */ diff --git a/sysdeps/powerpc/bits/link.h b/sysdeps/powerpc/bits/link.h index dc1a8de58f..a23bb3676d 100644 --- a/sysdeps/powerpc/bits/link.h +++ b/sysdeps/powerpc/bits/link.h @@ -1,5 +1,5 @@ /* Machine-specific declarations for dynamic linker interface. PowerPC version - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 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 diff --git a/sysdeps/powerpc/bits/mathdef.h b/sysdeps/powerpc/bits/mathdef.h deleted file mode 100644 index d4dd4b5c6a..0000000000 --- a/sysdeps/powerpc/bits/mathdef.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (C) 1997-2016 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/>. */ - -#if !defined _MATH_H && !defined _COMPLEX_H -# error "Never use <bits/mathdef.h> directly; include <math.h> instead" -#endif - - -/* FIXME! This file describes properties of the compiler, not the machine; - it should not be part of libc! - - FIXME! This file does not deal with the -fshort-double option of - gcc! */ - -#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF -# define _MATH_H_MATHDEF 1 - -/* PowerPC has both `float' and `double' arithmetic. */ -typedef float float_t; -typedef double double_t; - -/* The values returned by `ilogb' for 0 and NaN respectively. */ -# define FP_ILOGB0 (-2147483647) -# define FP_ILOGBNAN (2147483647) - -# if !defined _SOFT_FLOAT && !defined __NO_FPRS__ -/* The powerpc has a combined multiply/add instruction. */ -# define FP_FAST_FMA 1 -# define FP_FAST_FMAF 1 -# endif - -#endif /* ISO C99 */ diff --git a/sysdeps/powerpc/bits/mathinline.h b/sysdeps/powerpc/bits/mathinline.h index ac7d86af3a..e3e83865df 100644 --- a/sysdeps/powerpc/bits/mathinline.h +++ b/sysdeps/powerpc/bits/mathinline.h @@ -1,5 +1,5 @@ /* Inline math functions for powerpc. - Copyright (C) 1995-2016 Free Software Foundation, Inc. + Copyright (C) 1995-2018 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 @@ -28,66 +28,6 @@ #if defined __GNUC__ && !defined _SOFT_FLOAT && !defined __NO_FPRS__ -#ifdef __USE_ISOC99 -# if !__GNUC_PREREQ (2,97) -# define __unordered_cmp(x, y) \ - (__extension__ \ - ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ - unsigned __r; \ - __asm__("fcmpu 7,%1,%2 ; mfcr %0" : "=r" (__r) : "f" (__x), "f"(__y) \ - : "cr7"); \ - __r; })) - -# undef isgreater -# undef isgreaterequal -# undef isless -# undef islessequal -# undef islessgreater -# undef isunordered - -# define isgreater(x, y) (__unordered_cmp (x, y) >> 2 & 1) -# define isgreaterequal(x, y) ((__unordered_cmp (x, y) & 6) != 0) -# define isless(x, y) (__unordered_cmp (x, y) >> 3 & 1) -# define islessequal(x, y) ((__unordered_cmp (x, y) & 0xA) != 0) -# define islessgreater(x, y) ((__unordered_cmp (x, y) & 0xC) != 0) -# define isunordered(x, y) (__unordered_cmp (x, y) & 1) - -# endif /* __GNUC_PREREQ (2,97) */ - -/* The gcc, version 2.7 or below, has problems with all this inlining - code. So disable it for this version of the compiler. */ -# if __GNUC_PREREQ (2, 8) -/* Test for negative number. Used in the signbit() macro. */ -__MATH_INLINE int -__NTH (__signbitf (float __x)) -{ -#if __GNUC_PREREQ (4, 0) - return __builtin_signbitf (__x); -#else - __extension__ union { float __f; int __i; } __u = { __f: __x }; - return __u.__i < 0; -#endif -} -__MATH_INLINE int -__NTH (__signbit (double __x)) -{ -#if __GNUC_PREREQ (4, 0) - return __builtin_signbit (__x); -#else - __extension__ union { double __d; long long __i; } __u = { __d: __x }; - return __u.__i < 0; -#endif -} -# ifdef __LONG_DOUBLE_128__ -__MATH_INLINE int -__NTH (__signbitl (long double __x)) -{ - return __signbit ((double) __x); -} -# endif -# endif -#endif /* __USE_ISOC99 */ - #if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ #ifdef __USE_ISOC99 @@ -113,20 +53,6 @@ __NTH (lrintf (float __x)) } # endif -__MATH_INLINE double fdim (double __x, double __y) __THROW; -__MATH_INLINE double -__NTH (fdim (double __x, double __y)) -{ - return __x <= __y ? 0 : __x - __y; -} - -__MATH_INLINE float fdimf (float __x, float __y) __THROW; -__MATH_INLINE float -__NTH (fdimf (float __x, float __y)) -{ - return __x <= __y ? 0 : __x - __y; -} - #endif /* __USE_ISOC99 */ #endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */ #endif /* __GNUC__ && !_SOFT_FLOAT && !__NO_FPRS__ */ diff --git a/sysdeps/powerpc/bits/setjmp.h b/sysdeps/powerpc/bits/setjmp.h index 0a7e1d8bb2..48ff130947 100644 --- a/sysdeps/powerpc/bits/setjmp.h +++ b/sysdeps/powerpc/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2016 Free Software Foundation, Inc. +/* Copyright (C) 1997-2018 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 |