From 0059122aa0e53ff77ee58c5ff7589a814f1228e5 Mon Sep 17 00:00:00 2001 From: Rajalakshmi Srinivasaraghavan Date: Mon, 28 May 2018 18:56:35 -0300 Subject: [PATCH] ldbl-128ibm-compat: Add tests for IBM long double functions This patch creates test-ibm128* tests from the long double function tests. In order to explicitly test IBM long double functions -mabi=ibmlongdouble is added to CFLAGS. Likewise, update the test headers to correct choose ULPs when redirects are enabled. Co-authored-by: Tulio Magno Quites Machado Filho Co-authored-by: Paul E. Murphy --- math/Makefile | 7 ++++++- math/{test-ldouble.h => test-ibm128.h} | 28 ++++----------------------- math/test-ldouble.h | 7 +++++++ sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig | 3 +++ 4 files changed, 20 insertions(+), 25 deletions(-) copy math/{test-ldouble.h => test-ibm128.h} (50%) create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig diff --git a/math/Makefile b/math/Makefile index 1d203e7ad5..84a8b94c74 100644 --- a/math/Makefile +++ b/math/Makefile @@ -145,10 +145,15 @@ type-float128-yes := float128 # _Float64x may be supported, only as an alias type. type-float64x-yes := float64x +# IBM long double support in additional to IEEE 128 long double support +type-ibm128-suffix := l +type-ibm128-yes := ibm128 + types = $(types-basic) $(type-float128-$(float128-fcts)) test-types = $(test-types-basic) $(type-float128-$(float128-fcts)) \ float32 float64 $(type-float128-$(float128-alias-fcts)) \ - float32x $(type-float64x-$(float64x-alias-fcts)) + float32x $(type-float64x-$(float64x-alias-fcts)) \ + $(type-ibm128-$(ibm128-fcts)) # Pairs of types for which narrowing functions should be tested (this # variable has more entries than libm-narrow-types because it includes diff --git a/math/test-ldouble.h b/math/test-ibm128.h similarity index 50% copy from math/test-ldouble.h copy to math/test-ibm128.h index 17c526bd71..fce6ef1376 100644 --- a/math/test-ldouble.h +++ b/math/test-ibm128.h @@ -1,5 +1,5 @@ -/* Common definitions for libm tests for long double. - Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Common definitions for libm tests for ibm long double. + Copyright (C) 2020 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 @@ -14,26 +14,6 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - . */ + . */ -#include - -#define FUNC(function) function##l -#define FLOAT long double -#define CFLOAT __complex__ long double -#define BUILD_COMPLEX(real, imag) (CMPLXL ((real), (imag))) -#define PREFIX LDBL -#if LDBL_MANT_DIG == DBL_MANT_DIG -# define TYPE_STR "double" -# define ULP_IDX ULP_DBL -# define ULP_I_IDX ULP_I_DBL -#else -# define TYPE_STR "ldouble" -# define ULP_IDX ULP_LDBL -# define ULP_I_IDX ULP_I_LDBL -#endif -#define LIT(x) (x ## L) -#define LITM(x) x ## l -#define FTOSTR strfroml -#define snan_value_MACRO SNANL -#define TEST_FLOATN 0 +#include "test-ldouble.h" diff --git a/math/test-ldouble.h b/math/test-ldouble.h index 17c526bd71..5b72915008 100644 --- a/math/test-ldouble.h +++ b/math/test-ldouble.h @@ -27,6 +27,13 @@ # define TYPE_STR "double" # define ULP_IDX ULP_DBL # define ULP_I_IDX ULP_I_DBL +/* On architectures which redirect long double to _Float128 ABI, we must + choose the float128 ulps. Similarly, on such architectures, the ABI + used may be dependent on how the compiler was invoked. */ +#elif __LONG_DOUBLE_USES_FLOAT128 == 1 +# define TYPE_STR "float128" +# define ULP_IDX ULP_FLT128 +# define ULP_I_IDX ULP_I_FLT128 #else # define TYPE_STR "ldouble" # define ULP_IDX ULP_LDBL diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig b/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig new file mode 100644 index 0000000000..997f632319 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makeconfig @@ -0,0 +1,3 @@ +# Include this earlier so it can be used earlier in Makefiles, +# and sysdep/ makefiles. +ibm128-fcts = yes -- 2.11.4.GIT