diff options
Diffstat (limited to 'sysdeps/s390/fpu')
31 files changed, 417 insertions, 379 deletions
diff --git a/sysdeps/s390/fpu/bits/fenv.h b/sysdeps/s390/fpu/bits/fenv.h index 6de74b9939..079e71f3a5 100644 --- a/sysdeps/s390/fpu/bits/fenv.h +++ b/sysdeps/s390/fpu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2016 Free Software Foundation, Inc. +/* Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow <djbarrow@de.ibm.com>. @@ -90,3 +90,11 @@ typedef struct /* Floating-point environment where none of the exceptions are masked. */ # define FE_NOMASK_ENV ((const fenv_t *) -2) #endif + +#if __GLIBC_USE (IEC_60559_BFP_EXT) +/* Type representing floating-point control modes. */ +typedef unsigned int femode_t; + +/* Default floating-point control modes. */ +# define FE_DFL_MODE ((const femode_t *) -1L) +#endif diff --git a/sysdeps/s390/fpu/bits/mathinline.h b/sysdeps/s390/fpu/bits/mathinline.h deleted file mode 100644 index 7c09a5c7da..0000000000 --- a/sysdeps/s390/fpu/bits/mathinline.h +++ /dev/null @@ -1,100 +0,0 @@ -/* Inline math functions for s390. - Copyright (C) 2004-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/>. */ - -#ifndef _MATH_H -# error "Never use <bits/mathinline.h> directly; include <math.h> instead." -#endif - -#ifndef __extern_inline -# define __MATH_INLINE __inline -#else -# define __MATH_INLINE __extern_inline -#endif - -#if (!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \ - && defined __OPTIMIZE__ - -#ifdef __USE_ISOC99 - -/* Test for negative number. Used in the signbit() macro. */ -__MATH_INLINE int -__NTH (__signbitf (float __x)) -{ - __extension__ union { float __f; int __i; } __u = { __f: __x }; - return __u.__i < 0; -} - -__MATH_INLINE int -__NTH (__signbit (double __x)) -{ - __extension__ union { double __d; long __i; } __u = { __d: __x }; - return __u.__i < 0; -} - -# ifndef __NO_LONG_DOUBLE_MATH -__MATH_INLINE int -__NTH (__signbitl (long double __x)) -{ - __extension__ union { long double __l; int __i[4]; } __u = { __l: __x }; - return __u.__i[0] < 0; -} -# else -__MATH_INLINE int -__NTH (__signbitl (long double __x)) -{ - return __signbit ((double) __x); -} -# endif - -#endif /* C99 */ - -/* This code is used internally in the GNU libc. */ -#ifdef __LIBC_INTERNAL_MATH_INLINES - -__MATH_INLINE double -__NTH (__ieee754_sqrt (double x)) -{ - double res; - - __asm__ ( "sqdbr %0,%1" : "=f" (res) : "f" (x) ); - return res; -} - -__MATH_INLINE float -__NTH (__ieee754_sqrtf (float x)) -{ - float res; - - __asm__ ( "sqebr %0,%1" : "=f" (res) : "f" (x) ); - return res; -} - -# if !defined __NO_LONG_DOUBLE_MATH -__MATH_INLINE long double -__NTH (sqrtl (long double __x)) -{ - long double res; - - __asm__ ( "sqxbr %0,%1" : "=f" (res) : "f" (__x) ); - return res; -} -# endif /* !__NO_LONG_DOUBLE_MATH */ - -#endif /* __LIBC_INTERNAL_MATH_INLINES */ - -#endif /* __NO_MATH_INLINES */ diff --git a/sysdeps/s390/fpu/e_sqrt.c b/sysdeps/s390/fpu/e_sqrt.c index efdb2865b9..b8b362a6bb 100644 --- a/sysdeps/s390/fpu/e_sqrt.c +++ b/sysdeps/s390/fpu/e_sqrt.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2004-2018 Free Software Foundation, Inc. Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>. This file is part of the GNU C Library. diff --git a/sysdeps/s390/fpu/e_sqrtf.c b/sysdeps/s390/fpu/e_sqrtf.c index 38160acc12..2c67e3e656 100644 --- a/sysdeps/s390/fpu/e_sqrtf.c +++ b/sysdeps/s390/fpu/e_sqrtf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2016 Free Software Foundation, Inc. +/* Copyright (C) 2004-2018 Free Software Foundation, Inc. Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>. This file is part of the GNU C Library. diff --git a/sysdeps/s390/fpu/e_sqrtl.c b/sysdeps/s390/fpu/e_sqrtl.c index add859a3a8..209242b516 100644 --- a/sysdeps/s390/fpu/e_sqrtl.c +++ b/sysdeps/s390/fpu/e_sqrtl.c @@ -1,5 +1,5 @@ /* Square root. S/390 FPU version. - Copyright (C) 2004-2016 Free Software Foundation, Inc. + Copyright (C) 2004-2018 Free Software Foundation, Inc. Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>. This file is part of the GNU C Library. diff --git a/sysdeps/s390/fpu/fclrexcpt.c b/sysdeps/s390/fpu/fclrexcpt.c index b19899a2eb..27b7255a79 100644 --- a/sysdeps/s390/fpu/fclrexcpt.c +++ b/sysdeps/s390/fpu/fclrexcpt.c @@ -1,5 +1,5 @@ /* Clear given exceptions in current floating-point environment. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-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/s390/fpu/fedisblxcpt.c b/sysdeps/s390/fpu/fedisblxcpt.c index d3b49789b9..fc0ac27cc3 100644 --- a/sysdeps/s390/fpu/fedisblxcpt.c +++ b/sysdeps/s390/fpu/fedisblxcpt.c @@ -1,5 +1,5 @@ /* Disable floating-point exceptions. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). diff --git a/sysdeps/s390/fpu/feenablxcpt.c b/sysdeps/s390/fpu/feenablxcpt.c index b9aab5976a..067d8e9fa3 100644 --- a/sysdeps/s390/fpu/feenablxcpt.c +++ b/sysdeps/s390/fpu/feenablxcpt.c @@ -1,5 +1,5 @@ /* Enable floating-point exceptions. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). diff --git a/sysdeps/s390/fpu/fegetenv.c b/sysdeps/s390/fpu/fegetenv.c index 3b912b66cf..709fbd9c19 100644 --- a/sysdeps/s390/fpu/fegetenv.c +++ b/sysdeps/s390/fpu/fegetenv.c @@ -1,5 +1,5 @@ /* Store current floating-point environment. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). diff --git a/sysdeps/s390/fpu/fegetexcept.c b/sysdeps/s390/fpu/fegetexcept.c index dc5033c550..0fd39f14e4 100644 --- a/sysdeps/s390/fpu/fegetexcept.c +++ b/sysdeps/s390/fpu/fegetexcept.c @@ -1,5 +1,5 @@ /* Get enabled floating-point exceptions. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). diff --git a/sysdeps/s390/fpu/fegetmode.c b/sysdeps/s390/fpu/fegetmode.c new file mode 100644 index 0000000000..d6a5feff3d --- /dev/null +++ b/sysdeps/s390/fpu/fegetmode.c @@ -0,0 +1,27 @@ +/* Store current floating-point control modes. S/390 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/>. */ + +#include <fenv.h> +#include <fpu_control.h> + +int +fegetmode (femode_t *modep) +{ + _FPU_GETCW (*modep); + return 0; +} diff --git a/sysdeps/s390/fpu/fegetround.c b/sysdeps/s390/fpu/fegetround.c index bca8517577..3c38bc9189 100644 --- a/sysdeps/s390/fpu/fegetround.c +++ b/sysdeps/s390/fpu/fegetround.c @@ -1,5 +1,5 @@ /* Return current rounding direction. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). diff --git a/sysdeps/s390/fpu/feholdexcpt.c b/sysdeps/s390/fpu/feholdexcpt.c index 2700028016..5daee5675d 100644 --- a/sysdeps/s390/fpu/feholdexcpt.c +++ b/sysdeps/s390/fpu/feholdexcpt.c @@ -1,5 +1,5 @@ /* Store current floating-point environment and clear exceptions. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). @@ -24,7 +24,7 @@ int __feholdexcept (fenv_t *envp) { fexcept_t fpc; /* Store the environment. */ - fegetenv (envp); + __fegetenv (envp); /* Clear the current sticky bits as more than one exception may be generated. */ fpc = envp->__fpc & ~(FPC_FLAGS_MASK | FPC_DXC_MASK); diff --git a/sysdeps/s390/fpu/fenv_libc.h b/sysdeps/s390/fpu/fenv_libc.h index dff8fd92e5..0b4b7aad99 100644 --- a/sysdeps/s390/fpu/fenv_libc.h +++ b/sysdeps/s390/fpu/fenv_libc.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2016 Free Software Foundation, Inc. +/* Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). diff --git a/sysdeps/s390/fpu/fesetenv.c b/sysdeps/s390/fpu/fesetenv.c index 694a538c1e..c6c275d79d 100644 --- a/sysdeps/s390/fpu/fesetenv.c +++ b/sysdeps/s390/fpu/fesetenv.c @@ -1,5 +1,5 @@ /* Install given floating-point environment. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). @@ -20,8 +20,6 @@ #include <fenv_libc.h> #include <fpu_control.h> #include <stddef.h> -#include <asm/ptrace.h> -#include <sys/ptrace.h> #include <unistd.h> int diff --git a/sysdeps/s390/fpu/fesetexcept.c b/sysdeps/s390/fpu/fesetexcept.c new file mode 100644 index 0000000000..e41853e25e --- /dev/null +++ b/sysdeps/s390/fpu/fesetexcept.c @@ -0,0 +1,33 @@ +/* Set given exception flags. S/390 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/>. */ + +#include <fenv.h> +#include <fpu_control.h> +#include <fenv_libc.h> + +int +fesetexcept (int excepts) +{ + fexcept_t temp; + + _FPU_GETCW (temp); + temp |= (excepts & FE_ALL_EXCEPT) << FPC_FLAGS_SHIFT; + _FPU_SETCW (temp); + + return 0; +} diff --git a/sysdeps/s390/fpu/fesetmode.c b/sysdeps/s390/fpu/fesetmode.c new file mode 100644 index 0000000000..37ede8f115 --- /dev/null +++ b/sysdeps/s390/fpu/fesetmode.c @@ -0,0 +1,39 @@ +/* Install given floating-point control modes. S/390 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/>. */ + +#include <fenv.h> +#include <fpu_control.h> +#include <fenv_libc.h> + +#define FPC_STATUS (FPC_FLAGS_MASK | FPC_DXC_MASK) + +int +fesetmode (const femode_t *modep) +{ + fpu_control_t fpc; + + _FPU_GETCW (fpc); + fpc &= FPC_STATUS; + if (modep == FE_DFL_MODE) + fpc |= _FPU_DEFAULT; + else + fpc |= *modep & ~FPC_STATUS; + _FPU_SETCW (fpc); + + return 0; +} diff --git a/sysdeps/s390/fpu/fesetround.c b/sysdeps/s390/fpu/fesetround.c index 5b15a1973d..d8a84d2c96 100644 --- a/sysdeps/s390/fpu/fesetround.c +++ b/sysdeps/s390/fpu/fesetround.c @@ -1,5 +1,5 @@ /* Set current rounding direction. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). diff --git a/sysdeps/s390/fpu/fetestexceptflag.c b/sysdeps/s390/fpu/fetestexceptflag.c new file mode 100644 index 0000000000..784d356f7b --- /dev/null +++ b/sysdeps/s390/fpu/fetestexceptflag.c @@ -0,0 +1,31 @@ +/* Test exception in saved exception state. S/390 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/>. */ + +#include <fenv.h> +#include <fenv_libc.h> + +int +fetestexceptflag (const fexcept_t *flagp, int excepts) +{ + /* As *flagp is obtained by an earlier call of fegetexceptflag the + bits 0-5 of dxc-byte are either zero or correspond to the + flag-bits. Evaluate flags and last dxc-exception-code. */ + return (((*flagp >> FPC_FLAGS_SHIFT) | (*flagp >> FPC_DXC_SHIFT)) + & excepts + & FE_ALL_EXCEPT); +} diff --git a/sysdeps/s390/fpu/feupdateenv.c b/sysdeps/s390/fpu/feupdateenv.c index 1aad35ec13..4888e1a864 100644 --- a/sysdeps/s390/fpu/feupdateenv.c +++ b/sysdeps/s390/fpu/feupdateenv.c @@ -1,5 +1,5 @@ /* Install given floating-point environment and raise exceptions. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). diff --git a/sysdeps/s390/fpu/fgetexcptflg.c b/sysdeps/s390/fpu/fgetexcptflg.c index 09b7cfd99c..2a0f6dc77c 100644 --- a/sysdeps/s390/fpu/fgetexcptflg.c +++ b/sysdeps/s390/fpu/fgetexcptflg.c @@ -1,5 +1,5 @@ /* Store current representation for exceptions. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). diff --git a/sysdeps/s390/fpu/fix-fp-int-compare-invalid.h b/sysdeps/s390/fpu/fix-fp-int-compare-invalid.h new file mode 100644 index 0000000000..2ad36817c7 --- /dev/null +++ b/sysdeps/s390/fpu/fix-fp-int-compare-invalid.h @@ -0,0 +1,36 @@ +/* Fix for missing "invalid" exceptions from floating-point + comparisons. s390 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 FIX_FP_INT_COMPARE_INVALID_H +#define FIX_FP_INT_COMPARE_INVALID_H 1 + +/* GCC uses unordered comparison instructions like cebr (Short BFP COMPARE) + when it should use ordered comparison instructions like kebr + (Short BFP COMPARE AND SIGNAL) in order to raise invalid exceptions if + any operand is quiet (or signaling) NAN. See gcc bugzilla: + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77918>. + There exists an equivalent gcc bugzilla for Intel: + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52451>. + Once the s390 gcc bug is fixed, the definition of FIX_COMPARE_INVALID + should have a __GNUC_PREREQ conditional added so that e.g. the workaround + to call feraiseexcept (FE_INVALID) in math/s_iseqsig_template.c can be + avoided. */ +#define FIX_COMPARE_INVALID 1 + +#endif /* fix-fp-int-compare-invalid.h */ diff --git a/sysdeps/s390/fpu/fpu_control.h b/sysdeps/s390/fpu/fpu_control.h index e0266a703e..cb8bca2c56 100644 --- a/sysdeps/s390/fpu/fpu_control.h +++ b/sysdeps/s390/fpu/fpu_control.h @@ -1,5 +1,5 @@ /* FPU control word definitions. Stub version. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com) and Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. diff --git a/sysdeps/s390/fpu/fraiseexcpt.c b/sysdeps/s390/fpu/fraiseexcpt.c index 92a1a7db68..c1edf7a732 100644 --- a/sysdeps/s390/fpu/fraiseexcpt.c +++ b/sysdeps/s390/fpu/fraiseexcpt.c @@ -1,5 +1,5 @@ /* Raise given exceptions. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com) and Martin Schwidefsky (schwidefsky@de.ibm.com). @@ -35,6 +35,23 @@ fexceptadd (float d, float e) __asm__ __volatile__ ("aebr %0,%1" : : "f" (d), "f" (e) ); } +#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT +static __inline__ void +fexceptround (double e) +{ + float d; + /* Load rounded from double to float with M3 = round toward 0, M4 = Suppress + IEEE-inexact exception. + In case of e=0x1p128 and the overflow-mask bit is zero, only the + IEEE-overflow flag is set. If overflow-mask bit is one, DXC field is set to + 0x20 "IEEE overflow, exact". + In case of e=0x1p-150 and the underflow-mask bit is zero, only the + IEEE-underflow flag is set. If underflow-mask bit is one, DXC field is set + to 0x10 "IEEE underflow, exact". + This instruction is available with a zarch machine >= z196. */ + __asm__ __volatile__ ("ledbra %0,5,%1,4" : "=f" (d) : "f" (e) ); +} +#endif int __feraiseexcept (int excepts) @@ -54,13 +71,29 @@ __feraiseexcept (int excepts) /* Next: overflow. */ if (FE_OVERFLOW & excepts) - /* I don't think we can do the same trick as intel so we will have - to live with inexact coming also. */ - fexceptadd (FLT_MAX, 1.0e32); + { +#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT + fexceptround (0x1p128); +#else + /* If overflow-mask bit is zero, both IEEE-overflow and IEEE-inexact flags + are set. If overflow-mask bit is one, DXC field is set to 0x2C "IEEE + overflow, inexact and incremented". */ + fexceptadd (FLT_MAX, 1.0e32); +#endif + } /* Next: underflow. */ if (FE_UNDERFLOW & excepts) - fexceptdiv (FLT_MIN, 3.0); + { +#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT + fexceptround (0x1p-150); +#else + /* If underflow-mask bit is zero, both IEEE-underflow and IEEE-inexact + flags are set. If underflow-mask bit is one, DXC field is set to 0x1C + "IEEE underflow, inexact and incremented". */ + fexceptdiv (FLT_MIN, 3.0); +#endif + } /* Last: inexact. */ if (FE_INEXACT & excepts) diff --git a/sysdeps/s390/fpu/fsetexcptflg.c b/sysdeps/s390/fpu/fsetexcptflg.c index 25ade854bd..e50684c574 100644 --- a/sysdeps/s390/fpu/fsetexcptflg.c +++ b/sysdeps/s390/fpu/fsetexcptflg.c @@ -1,5 +1,5 @@ /* Set floating-point environment exception handling. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). @@ -45,8 +45,7 @@ fesetexceptflag (const fexcept_t *flagp, int excepts) & newexcepts; /* Store the new status word (along with the rest of the environment. - Possibly new exceptions are set but they won't get executed unless - the next floating-point instruction. */ + Possibly new exceptions are set but they won't get executed. */ _FPU_SETCW (temp); /* Success. */ diff --git a/sysdeps/s390/fpu/ftestexcept.c b/sysdeps/s390/fpu/ftestexcept.c index 45cfcb52d0..727b9b342d 100644 --- a/sysdeps/s390/fpu/ftestexcept.c +++ b/sysdeps/s390/fpu/ftestexcept.c @@ -1,5 +1,5 @@ /* Test exception in current environment. - Copyright (C) 2000-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). diff --git a/sysdeps/s390/fpu/get-rounding-mode.h b/sysdeps/s390/fpu/get-rounding-mode.h index 5150b0ab25..ae40791af6 100644 --- a/sysdeps/s390/fpu/get-rounding-mode.h +++ b/sysdeps/s390/fpu/get-rounding-mode.h @@ -1,5 +1,5 @@ /* Determine floating-point rounding mode within libc. S/390 version. - 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 diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps index bc5795b361..fec59c7d60 100644 --- a/sysdeps/s390/fpu/libm-test-ulps +++ b/sysdeps/s390/fpu/libm-test-ulps @@ -40,9 +40,9 @@ ildouble: 2 ldouble: 2 Function: "acosh_downward": -double: 1 +double: 2 float: 2 -idouble: 1 +idouble: 2 ifloat: 2 ildouble: 3 ldouble: 3 @@ -126,9 +126,7 @@ ildouble: 4 ldouble: 4 Function: "atan": -double: 1 float: 1 -idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -252,42 +250,42 @@ ildouble: 2 ldouble: 2 Function: Imaginary part of "cacos": -double: 1 +double: 2 float: 2 -idouble: 1 +idouble: 2 ifloat: 2 ildouble: 2 ldouble: 2 Function: Real part of "cacos_downward": -double: 2 +double: 3 float: 2 -idouble: 2 +idouble: 3 ifloat: 2 -ildouble: 2 -ldouble: 2 +ildouble: 3 +ldouble: 3 Function: Imaginary part of "cacos_downward": double: 5 float: 3 idouble: 5 ifloat: 3 -ildouble: 5 -ldouble: 5 +ildouble: 6 +ldouble: 6 Function: Real part of "cacos_towardzero": -double: 2 +double: 3 float: 2 -idouble: 2 +idouble: 3 ifloat: 2 -ildouble: 2 -ldouble: 2 +ildouble: 3 +ldouble: 3 Function: Imaginary part of "cacos_towardzero": -double: 5 -float: 3 -idouble: 5 -ifloat: 3 +double: 4 +float: 2 +idouble: 4 +ifloat: 2 ildouble: 5 ldouble: 5 @@ -300,17 +298,17 @@ ildouble: 3 ldouble: 3 Function: Imaginary part of "cacos_upward": -double: 4 -float: 4 -idouble: 4 -ifloat: 4 -ildouble: 5 -ldouble: 5 +double: 5 +float: 5 +idouble: 5 +ifloat: 5 +ildouble: 7 +ldouble: 7 Function: Real part of "cacosh": -double: 1 +double: 2 float: 2 -idouble: 1 +idouble: 2 ifloat: 2 ildouble: 2 ldouble: 2 @@ -324,57 +322,55 @@ ildouble: 2 ldouble: 2 Function: Real part of "cacosh_downward": -double: 5 -float: 3 -idouble: 5 -ifloat: 3 +double: 4 +float: 2 +idouble: 4 +ifloat: 2 ildouble: 5 ldouble: 5 Function: Imaginary part of "cacosh_downward": -double: 2 -float: 2 -idouble: 2 -ifloat: 2 -ildouble: 2 -ldouble: 2 - -Function: Real part of "cacosh_towardzero": -double: 5 +double: 3 float: 3 -idouble: 5 +idouble: 3 ifloat: 3 +ildouble: 4 +ldouble: 4 + +Function: Real part of "cacosh_towardzero": +double: 4 +float: 2 +idouble: 4 +ifloat: 2 ildouble: 5 ldouble: 5 Function: Imaginary part of "cacosh_towardzero": -double: 2 +double: 3 float: 2 -idouble: 2 +idouble: 3 ifloat: 2 -ildouble: 2 -ldouble: 2 +ildouble: 3 +ldouble: 3 Function: Real part of "cacosh_upward": double: 4 -float: 4 +float: 3 idouble: 4 -ifloat: 4 -ildouble: 5 -ldouble: 5 +ifloat: 3 +ildouble: 6 +ldouble: 6 Function: Imaginary part of "cacosh_upward": -double: 2 +double: 3 float: 2 -idouble: 2 +idouble: 3 ifloat: 2 -ildouble: 3 -ldouble: 3 +ildouble: 4 +ldouble: 4 Function: "carg": -double: 1 float: 1 -idouble: 1 ifloat: 1 ildouble: 2 ldouble: 2 @@ -412,18 +408,18 @@ ildouble: 2 ldouble: 2 Function: Imaginary part of "casin": -double: 1 +double: 2 float: 2 -idouble: 1 +idouble: 2 ifloat: 2 ildouble: 2 ldouble: 2 Function: Real part of "casin_downward": double: 3 -float: 1 +float: 2 idouble: 3 -ifloat: 1 +ifloat: 2 ildouble: 3 ldouble: 3 @@ -432,8 +428,8 @@ double: 5 float: 3 idouble: 5 ifloat: 3 -ildouble: 5 -ldouble: 5 +ildouble: 6 +ldouble: 6 Function: Real part of "casin_towardzero": double: 3 @@ -444,33 +440,33 @@ ildouble: 3 ldouble: 3 Function: Imaginary part of "casin_towardzero": -double: 5 -float: 3 -idouble: 5 -ifloat: 3 +double: 4 +float: 2 +idouble: 4 +ifloat: 2 ildouble: 5 ldouble: 5 Function: Real part of "casin_upward": -double: 2 -float: 1 -idouble: 2 -ifloat: 1 +double: 3 +float: 2 +idouble: 3 +ifloat: 2 ildouble: 3 ldouble: 3 Function: Imaginary part of "casin_upward": -double: 4 -float: 4 -idouble: 4 -ifloat: 4 -ildouble: 5 -ldouble: 5 +double: 5 +float: 5 +idouble: 5 +ifloat: 5 +ildouble: 7 +ldouble: 7 Function: Real part of "casinh": -double: 1 +double: 2 float: 2 -idouble: 1 +idouble: 2 ifloat: 2 ildouble: 2 ldouble: 2 @@ -488,22 +484,22 @@ double: 5 float: 3 idouble: 5 ifloat: 3 -ildouble: 5 -ldouble: 5 +ildouble: 6 +ldouble: 6 Function: Imaginary part of "casinh_downward": double: 3 -float: 1 +float: 2 idouble: 3 -ifloat: 1 +ifloat: 2 ildouble: 3 ldouble: 3 Function: Real part of "casinh_towardzero": -double: 5 -float: 3 -idouble: 5 -ifloat: 3 +double: 4 +float: 2 +idouble: 4 +ifloat: 2 ildouble: 5 ldouble: 5 @@ -516,23 +512,25 @@ ildouble: 3 ldouble: 3 Function: Real part of "casinh_upward": -double: 4 -float: 4 -idouble: 4 -ifloat: 4 -ildouble: 5 -ldouble: 5 +double: 5 +float: 5 +idouble: 5 +ifloat: 5 +ildouble: 7 +ldouble: 7 Function: Imaginary part of "casinh_upward": -double: 2 +double: 3 float: 2 -idouble: 2 +idouble: 3 ifloat: 2 ildouble: 3 ldouble: 3 Function: Real part of "catan": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -547,9 +545,9 @@ ldouble: 1 Function: Real part of "catan_downward": double: 1 -float: 1 +float: 2 idouble: 1 -ifloat: 1 +ifloat: 2 ildouble: 2 ldouble: 2 @@ -558,36 +556,38 @@ double: 2 float: 2 idouble: 2 ifloat: 2 -ildouble: 3 -ldouble: 3 +ildouble: 2 +ldouble: 2 Function: Real part of "catan_towardzero": double: 1 -float: 1 +float: 2 idouble: 1 -ifloat: 1 +ifloat: 2 ildouble: 2 ldouble: 2 Function: Imaginary part of "catan_towardzero": double: 2 -float: 1 +float: 2 idouble: 2 -ifloat: 1 -ildouble: 3 -ldouble: 3 +ifloat: 2 +ildouble: 2 +ldouble: 2 Function: Real part of "catan_upward": +double: 1 float: 1 +idouble: 1 ifloat: 1 -ildouble: 1 -ldouble: 1 +ildouble: 2 +ldouble: 2 Function: Imaginary part of "catan_upward": -double: 3 -float: 3 -idouble: 3 -ifloat: 3 +double: 2 +float: 2 +idouble: 2 +ifloat: 2 ildouble: 3 ldouble: 3 @@ -600,7 +600,9 @@ ildouble: 1 ldouble: 1 Function: Imaginary part of "catanh": +double: 1 float: 1 +idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -610,8 +612,8 @@ double: 2 float: 2 idouble: 2 ifloat: 2 -ildouble: 3 -ldouble: 3 +ildouble: 2 +ldouble: 2 Function: Imaginary part of "catanh_downward": double: 1 @@ -623,11 +625,11 @@ ldouble: 2 Function: Real part of "catanh_towardzero": double: 2 -float: 1 +float: 2 idouble: 2 -ifloat: 1 -ildouble: 3 -ldouble: 3 +ifloat: 2 +ildouble: 2 +ldouble: 2 Function: Imaginary part of "catanh_towardzero": double: 1 @@ -639,17 +641,19 @@ ldouble: 2 Function: Real part of "catanh_upward": double: 4 -float: 3 +float: 4 idouble: 4 -ifloat: 3 +ifloat: 4 ildouble: 4 ldouble: 4 Function: Imaginary part of "catanh_upward": +double: 1 float: 1 +idouble: 1 ifloat: 1 -ildouble: 1 -ldouble: 1 +ildouble: 2 +ldouble: 2 Function: "cbrt": double: 3 @@ -765,9 +769,9 @@ ldouble: 1 Function: Real part of "ccosh_downward": double: 1 -float: 3 +float: 2 idouble: 1 -ifloat: 3 +ifloat: 2 ildouble: 2 ldouble: 2 @@ -884,9 +888,7 @@ ildouble: 2 ldouble: 2 Function: Imaginary part of "clog": -double: 1 float: 1 -idouble: 1 ifloat: 1 ildouble: 1 ldouble: 1 @@ -900,18 +902,18 @@ ildouble: 2 ldouble: 2 Function: Imaginary part of "clog10": -double: 1 +double: 2 float: 2 -idouble: 1 +idouble: 2 ifloat: 2 ildouble: 2 ldouble: 2 Function: Real part of "clog10_downward": double: 5 -float: 4 +float: 5 idouble: 5 -ifloat: 4 +ifloat: 5 ildouble: 3 ldouble: 3 @@ -1004,32 +1006,26 @@ ildouble: 2 ldouble: 2 Function: "cos": -float: 1 -ifloat: 1 +double: 1 +idouble: 1 ildouble: 1 ldouble: 1 Function: "cos_downward": double: 1 -float: 2 idouble: 1 -ifloat: 2 ildouble: 3 ldouble: 3 Function: "cos_towardzero": double: 1 -float: 1 idouble: 1 -ifloat: 1 ildouble: 1 ldouble: 1 Function: "cos_upward": double: 1 -float: 2 idouble: 1 -ifloat: 2 ildouble: 2 ldouble: 2 @@ -1203,9 +1199,9 @@ ldouble: 1 Function: Real part of "csinh_downward": double: 2 -float: 2 +float: 1 idouble: 2 -ifloat: 2 +ifloat: 1 ildouble: 2 ldouble: 2 @@ -1323,9 +1319,9 @@ ldouble: 3 Function: Imaginary part of "ctan": double: 2 -float: 1 +float: 2 idouble: 2 -ifloat: 1 +ifloat: 2 ildouble: 3 ldouble: 3 @@ -1339,9 +1335,9 @@ ldouble: 4 Function: Imaginary part of "ctan_downward": double: 2 -float: 1 +float: 2 idouble: 2 -ifloat: 1 +ifloat: 2 ildouble: 5 ldouble: 5 @@ -1363,17 +1359,17 @@ ldouble: 5 Function: Real part of "ctan_upward": double: 2 -float: 3 +float: 4 idouble: 2 -ifloat: 3 +ifloat: 4 ildouble: 5 ldouble: 5 Function: Imaginary part of "ctan_upward": double: 2 -float: 3 +float: 2 idouble: 2 -ifloat: 3 +ifloat: 2 ildouble: 5 ldouble: 5 @@ -1395,9 +1391,9 @@ ldouble: 3 Function: Real part of "ctanh_downward": double: 4 -float: 1 +float: 2 idouble: 4 -ifloat: 1 +ifloat: 2 ildouble: 5 ldouble: 5 @@ -1427,9 +1423,9 @@ ldouble: 3 Function: Real part of "ctanh_upward": double: 2 -float: 3 +float: 2 idouble: 2 -ifloat: 3 +ifloat: 2 ildouble: 5 ldouble: 5 @@ -1506,8 +1502,6 @@ ildouble: 5 ldouble: 5 Function: "exp": -float: 1 -ifloat: 1 ildouble: 1 ldouble: 1 @@ -1543,25 +1537,19 @@ ldouble: 3 Function: "exp2": double: 1 -float: 1 idouble: 1 -ifloat: 1 ildouble: 1 ldouble: 1 Function: "exp2_downward": double: 1 -float: 1 idouble: 1 -ifloat: 1 ildouble: 1 ldouble: 1 Function: "exp2_towardzero": double: 1 -float: 1 idouble: 1 -ifloat: 1 ildouble: 1 ldouble: 1 @@ -1575,15 +1563,21 @@ ldouble: 2 Function: "exp_downward": double: 1 +float: 1 idouble: 1 +ifloat: 1 Function: "exp_towardzero": double: 1 +float: 1 idouble: 1 +ifloat: 1 Function: "exp_upward": double: 1 +float: 1 idouble: 1 +ifloat: 1 Function: "expm1": double: 1 @@ -1619,9 +1613,9 @@ ldouble: 3 Function: "gamma": double: 3 -float: 4 +float: 3 idouble: 3 -ifloat: 4 +ifloat: 3 ildouble: 5 ldouble: 5 @@ -1683,9 +1677,9 @@ ldouble: 2 Function: "j0_downward": double: 2 -float: 3 +float: 4 idouble: 2 -ifloat: 3 +ifloat: 4 ildouble: 4 ldouble: 4 @@ -1771,9 +1765,9 @@ ldouble: 7 Function: "lgamma": double: 3 -float: 4 +float: 3 idouble: 3 -ifloat: 4 +ifloat: 3 ildouble: 5 ldouble: 5 @@ -1802,8 +1796,6 @@ ildouble: 8 ldouble: 8 Function: "log": -float: 1 -ifloat: 1 ildouble: 1 ldouble: 1 @@ -1825,9 +1817,9 @@ ldouble: 1 Function: "log10_towardzero": double: 2 -float: 2 +float: 1 idouble: 2 -ifloat: 2 +ifloat: 1 ildouble: 1 ldouble: 1 @@ -1881,84 +1873,40 @@ ldouble: 2 Function: "log2_downward": double: 3 -float: 3 idouble: 3 -ifloat: 3 ildouble: 3 ldouble: 3 Function: "log2_towardzero": double: 2 -float: 2 idouble: 2 -ifloat: 2 ildouble: 1 ldouble: 1 Function: "log2_upward": double: 3 -float: 3 idouble: 3 -ifloat: 3 ildouble: 1 ldouble: 1 Function: "log_downward": -float: 2 -ifloat: 2 ildouble: 1 ldouble: 1 Function: "log_towardzero": -float: 1 -ifloat: 1 ildouble: 2 ldouble: 2 Function: "log_upward": -double: 1 -float: 1 -idouble: 1 -ifloat: 1 ildouble: 1 ldouble: 1 Function: "pow": -float: 1 -ifloat: 1 -ildouble: 2 -ldouble: 2 - -Function: "pow10": -double: 2 -idouble: 2 +double: 1 +idouble: 1 ildouble: 2 ldouble: 2 -Function: "pow10_downward": -double: 2 -float: 1 -idouble: 2 -ifloat: 1 -ildouble: 3 -ldouble: 3 - -Function: "pow10_towardzero": -double: 2 -float: 1 -idouble: 2 -ifloat: 1 -ildouble: 3 -ldouble: 3 - -Function: "pow10_upward": -double: 2 -float: 1 -idouble: 2 -ifloat: 1 -ildouble: 3 -ldouble: 3 - Function: "pow_downward": double: 1 float: 1 @@ -1984,62 +1932,50 @@ ildouble: 2 ldouble: 2 Function: "sin": -float: 1 -ifloat: 1 +double: 1 +idouble: 1 ildouble: 1 ldouble: 1 Function: "sin_downward": double: 1 -float: 2 idouble: 1 -ifloat: 2 ildouble: 3 ldouble: 3 Function: "sin_towardzero": double: 1 -float: 1 idouble: 1 -ifloat: 1 ildouble: 2 ldouble: 2 Function: "sin_upward": double: 1 -float: 2 idouble: 1 -ifloat: 2 ildouble: 3 ldouble: 3 Function: "sincos": -float: 1 -ifloat: 1 +double: 1 +idouble: 1 ildouble: 1 ldouble: 1 Function: "sincos_downward": double: 1 -float: 2 idouble: 1 -ifloat: 2 ildouble: 3 ldouble: 3 Function: "sincos_towardzero": double: 1 -float: 1 idouble: 1 -ifloat: 1 ildouble: 2 ldouble: 2 Function: "sincos_upward": double: 1 -float: 2 idouble: 1 -ifloat: 2 ildouble: 3 ldouble: 3 @@ -2179,9 +2115,9 @@ ldouble: 3 Function: "y0_downward": double: 3 -float: 2 +float: 4 idouble: 3 -ifloat: 2 +ifloat: 4 ildouble: 4 ldouble: 4 @@ -2195,9 +2131,9 @@ ldouble: 3 Function: "y0_upward": double: 2 -float: 3 +float: 5 idouble: 2 -ifloat: 3 +ifloat: 5 ildouble: 3 ldouble: 3 @@ -2235,17 +2171,17 @@ ldouble: 5 Function: "yn": double: 3 -float: 2 +float: 3 idouble: 3 -ifloat: 2 +ifloat: 3 ildouble: 5 ldouble: 5 Function: "yn_downward": double: 3 -float: 2 +float: 4 idouble: 3 -ifloat: 2 +ifloat: 4 ildouble: 5 ldouble: 5 @@ -2259,9 +2195,9 @@ ldouble: 5 Function: "yn_upward": double: 4 -float: 3 +float: 5 idouble: 4 -ifloat: 3 +ifloat: 5 ildouble: 5 ldouble: 5 diff --git a/sysdeps/s390/fpu/libm-test-ulps-name b/sysdeps/s390/fpu/libm-test-ulps-name new file mode 100644 index 0000000000..4a55100a0e --- /dev/null +++ b/sysdeps/s390/fpu/libm-test-ulps-name @@ -0,0 +1 @@ +S/390 diff --git a/sysdeps/s390/fpu/s_fma.c b/sysdeps/s390/fpu/s_fma.c index 7d7e563b7e..93405d0662 100644 --- a/sysdeps/s390/fpu/s_fma.c +++ b/sysdeps/s390/fpu/s_fma.c @@ -1,5 +1,5 @@ /* Compute x * y + z as ternary operation. S/390 version. - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2010. @@ -18,6 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <math.h> +#include <libm-alias-double.h> double __fma (double x, double y, double z) @@ -27,10 +28,5 @@ __fma (double x, double y, double z) return r; } #ifndef __fma -weak_alias (__fma, fma) -#endif - -#ifdef NO_LONG_DOUBLE -strong_alias (__fma, __fmal) -weak_alias (__fmal, fmal) +libm_alias_double (__fma, fma) #endif diff --git a/sysdeps/s390/fpu/s_fmaf.c b/sysdeps/s390/fpu/s_fmaf.c index 50af2bbc5b..0768495f16 100644 --- a/sysdeps/s390/fpu/s_fmaf.c +++ b/sysdeps/s390/fpu/s_fmaf.c @@ -1,5 +1,5 @@ /* Compute x * y + z as ternary operation. S/390 version. - Copyright (C) 2010-2016 Free Software Foundation, Inc. + Copyright (C) 2010-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2010. @@ -18,6 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <math.h> +#include <libm-alias-float.h> float __fmaf (float x, float y, float z) @@ -27,5 +28,5 @@ __fmaf (float x, float y, float z) return r; } #ifndef __fmaf -weak_alias (__fmaf, fmaf) +libm_alias_float (__fma, fma) #endif |