about summary refs log tree commit diff
path: root/math/test-ldouble.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-10-11 17:46:19 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-10-11 17:46:19 +0000
commitbc9620d040b7494f457ccb750c9797b47ed76ada (patch)
treeb2a800a1b6bc16ee769881d38b4c160a4bd8b92b /math/test-ldouble.h
parent09c76a74099826f4c6e1c4c431d7659f78112862 (diff)
downloadglibc-bc9620d040b7494f457ccb750c9797b47ed76ada.tar.gz
glibc-bc9620d040b7494f457ccb750c9797b47ed76ada.tar.xz
glibc-bc9620d040b7494f457ccb750c9797b47ed76ada.zip
Run libm long double tests for long double = double.
All interfaces in the glibc API ought to be covered by the testsuite,
even where they alias other interfaces.  This patch arranges for libm
tests to be run for long double when it aliases double; previously
those tests were run only for the floating-point types with distinct
formats.  The long double tests are made to use the double ulps values
in this case, as having a separate duplicate set of ulps for them
seems unnecessary; to accommodate that, the test-<type>.h headers now
specify the macro indexing into the ulps array explicitly instead of
having it computed from PREFIX.

Nothing special is done about vector function tests.  None are
supported for any long double = double platforms, and supporting
vector functions for a type alias such as _Float32 would not simply
fall out of adding the scalar aliases for that type - it would require
vector function wrappers like those for *_finite (or, better, a new
GCC feature to allow specifying the asm name for vector functions
independently of that for scalar ones, as previously discussed), so it
seems reasonable to require the sysdeps makefile setting of
libmvec-tests to be updated if any such tests are to be run for type
aliases.

Tested for x86_64 and arm.

	* math/Makefile (test-types-basic): New variable.
	(test-types): Likewise.
	(libm-test-support): Use $(test-types) instead of $(types).
	(libm-tests-base-normal): Likewise.
	(libm-tests-base-finite): Likewise.
	(libm-tests-base-inline): Likewise.
	(generated): Likewise.
	($(objpfx)libm-test-support-$(t).c): Likewise.
	(libm-tests-for-type iterator): Likewise.
	(libm-test-support iterator): Likewise.
	* math/libm-test-support.c (ulp_i_idx): Use ULP_I_IDX.
	(ulp_idx): Use ULP_IDX.
	* math/test-ldouble.h: Include <float.h>.
	(TYPE_STR): Define conditional on [LDBL_MANT_DIG == DBL_MANT_DIG].
	(ULP_IDX): New macro.
	(ULP_I_IDX): Likewise.
	* math/test-double.h (ULP_IDX): Likewise.
	(ULP_I_IDX): Likewise.
	* math/test-float.h (ULP_IDX): Likewise.
	(ULP_I_IDX): Likewise.
	* math/test-float128.h (ULP_IDX): Likewise.
	(ULP_I_IDX): Likewise.
Diffstat (limited to 'math/test-ldouble.h')
-rw-r--r--math/test-ldouble.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/math/test-ldouble.h b/math/test-ldouble.h
index 89d4940117..90a293386c 100644
--- a/math/test-ldouble.h
+++ b/math/test-ldouble.h
@@ -16,12 +16,22 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <float.h>
+
 #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
-#define TYPE_STR "ldouble"
+#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