Commit Graph

1214 Commits

Author SHA1 Message Date
Paul E. Murphy 302bb1a3c3 float128: Add wrappers to override ldbl-128 as float128.
This change defines float128_private.h which contains
macros used to override long double naming conventions
when building a ldbl file.

	* math/math.h [__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
	(SNANF128): New macro.
	* math/e_sqrtf128.c: New file.
	* math/s_fmaxmag_template.c: Include math_private.h in order to
	make inline expansion of fabs128().
	* math/s_fminmag_template.c: Likewise.

	* sysdeps/ieee754/float128/e_acosf128.c: New file.
	* sysdeps/ieee754/float128/e_acoshf128.c: New file.
	* sysdeps/ieee754/float128/e_asinf128.c: New file.
	* sysdeps/ieee754/float128/e_atan2f128.c: New file.
	* sysdeps/ieee754/float128/e_atanhf128.c: New file.
	* sysdeps/ieee754/float128/e_coshf128.c: New file.
	* sysdeps/ieee754/float128/e_exp10f128.c: New file.
	* sysdeps/ieee754/float128/e_expf128.c: New file.
	* sysdeps/ieee754/float128/e_fmodf128.c: New file.
	* sysdeps/ieee754/float128/e_gammaf128_r.c: New file.
	* sysdeps/ieee754/float128/e_hypotf128.c: New file.
	* sysdeps/ieee754/float128/e_ilogbf128.c: New file.
	* sysdeps/ieee754/float128/e_j0f128.c: New file.
	* sysdeps/ieee754/float128/e_j1f128.c: New file.
	* sysdeps/ieee754/float128/e_jnf128.c: New file.
	* sysdeps/ieee754/float128/e_lgammaf128_r.c: New file.
	* sysdeps/ieee754/float128/e_log10f128.c: New file.
	* sysdeps/ieee754/float128/e_log2f128.c: New file.
	* sysdeps/ieee754/float128/e_logf128.c: New file.
	* sysdeps/ieee754/float128/e_powf128.c: New file.
	* sysdeps/ieee754/float128/e_rem_pio2f128.c: New file.
	* sysdeps/ieee754/float128/e_remainderf128.c: New file.
	* sysdeps/ieee754/float128/e_scalbf128.c: New file.
	* sysdeps/ieee754/float128/e_sinhf128.c: New file.
	* sysdeps/ieee754/float128/float128_private.h: New file.
	* sysdeps/ieee754/float128/gamma_productf128.c: New file.
	* sysdeps/ieee754/float128/ieee754_float128.h: New file.
	* sysdeps/ieee754/float128/k_cosf128.c: New file.
	* sysdeps/ieee754/float128/k_sincosf128.c: New file.
	* sysdeps/ieee754/float128/k_sinf128.c: New file.
	* sysdeps/ieee754/float128/k_tanf128.c: New file.
	* sysdeps/ieee754/float128/lgamma_negf128.c: New file.
	* sysdeps/ieee754/float128/lgamma_productf128.c: New file.
	* sysdeps/ieee754/float128/s_asinhf128.c: New file.
	* sysdeps/ieee754/float128/s_atanf128.c: New file.
	* sysdeps/ieee754/float128/s_cbrtf128.c: New file.
	* sysdeps/ieee754/float128/s_ceilf128.c: New file.
	* sysdeps/ieee754/float128/s_copysignf128.c: New file.
	* sysdeps/ieee754/float128/s_cosf128.c: New file.
	* sysdeps/ieee754/float128/s_erff128.c: New file.
	* sysdeps/ieee754/float128/s_expm1f128.c: New file.
	* sysdeps/ieee754/float128/s_fabsf128.c: New file.
	* sysdeps/ieee754/float128/s_finitef128.c: New file.
	* sysdeps/ieee754/float128/s_floorf128.c: New file.
	* sysdeps/ieee754/float128/s_fmaf128.c: New file.
	* sysdeps/ieee754/float128/s_fpclassifyf128.c: New file.
	* sysdeps/ieee754/float128/s_frexpf128.c: New file.
	* sysdeps/ieee754/float128/s_fromfpf128.c: New file.
	* sysdeps/ieee754/float128/s_fromfpxf128.c: New file.
	* sysdeps/ieee754/float128/s_getpayloadf128.c: New file.
	* sysdeps/ieee754/float128/s_isinff128.c: New file.
	* sysdeps/ieee754/float128/s_isnanf128.c: New file.
	* sysdeps/ieee754/float128/s_issignalingf128.c: New file.
	* sysdeps/ieee754/float128/s_llrintf128.c: New file.
	* sysdeps/ieee754/float128/s_llroundf128.c: New file.
	* sysdeps/ieee754/float128/s_log1pf128.c: New file.
	* sysdeps/ieee754/float128/s_logbf128.c: New file.
	* sysdeps/ieee754/float128/s_lrintf128.c: New file.
	* sysdeps/ieee754/float128/s_lroundf128.c: New file.
	* sysdeps/ieee754/float128/s_modff128.c: New file.
	* sysdeps/ieee754/float128/s_nearbyintf128.c: New file.
	* sysdeps/ieee754/float128/s_nextafterf128.c: New file.
	* sysdeps/ieee754/float128/s_nexttowardf128.c: New file.
	* sysdeps/ieee754/float128/s_nextupf128.c: New file.
	* sysdeps/ieee754/float128/s_remquof128.c: New file.
	* sysdeps/ieee754/float128/s_rintf128.c: New file.
	* sysdeps/ieee754/float128/s_roundevenf128.c: New file.
	* sysdeps/ieee754/float128/s_roundf128.c: New file.
	* sysdeps/ieee754/float128/s_scalblnf128.c: New file.
	* sysdeps/ieee754/float128/s_scalbnf128.c: New file.
	* sysdeps/ieee754/float128/s_setpayloadf128.c: New file.
	* sysdeps/ieee754/float128/s_setpayloadsigf128.c: New file.
	* sysdeps/ieee754/float128/s_signbitf128.c: New file.
	* sysdeps/ieee754/float128/s_significandf128.c: New file.
	* sysdeps/ieee754/float128/s_sincosf128.c: New file.
	* sysdeps/ieee754/float128/s_sinf128.c: New file.
	* sysdeps/ieee754/float128/s_tanf128.c: New file.
	* sysdeps/ieee754/float128/s_tanhf128.c: New file.
	* sysdeps/ieee754/float128/s_totalorderf128.c: New file.
	* sysdeps/ieee754/float128/s_totalordermagf128.c: New file.
	* sysdeps/ieee754/float128/s_truncf128.c: New file.
	* sysdeps/ieee754/float128/s_ufromfpf128.c: New file.
	* sysdeps/ieee754/float128/s_ufromfpxf128.c: New file.
	* sysdeps/ieee754/float128/t_sincosf128.c: New file.
	* sysdeps/ieee754/float128/x2y2m1f128.c: New file.

	* sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h:
	(__iscanonicalf128): Define as a macro.
2017-05-25 09:01:37 -03:00
Gabriel F. T. Gomes 477bf19a59 float128: Extend __MATH_TG for float128 support
* math/math.h (__MATH_TG): Extend the conditions to add
	_Float128 support.
	* misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): New macro.
2017-05-17 18:59:23 -03:00
Gabriel F. T. Gomes 7620dc1235 Convert e_exp2l.c into a template
This patch converts the implementation of exp2l in math/e_exp2l.c into
a template in math/e_exp2_template.c, then adjusts Makefile to use
this template for long double (the implementations for float and
double in sysdeps have higher precedence and are not used).  This
template can also be used for float128, thus reducing the amount of
duplicated code that gets added when adding support the new type.

Tested for powerpc64le and s390x.

	* math/Makefile (libm-calls): Move e_exp2F to gen-libm-calls.
	(gen-libm-calls): Add e_exp2F to use the template.
	* math/e_exp2l.c: Rename to math/e_exp2_template.c.
	* math/e_exp2_template.c: New file, renamed from
	math/e_exp2l.c, and made into a template.
	* sysdeps/generic/math-type-macros.h (M_MIN_EXP): New macro.
2017-05-17 14:44:08 -03:00
Gabriel F. T. Gomes 33d523d7f8 float128: Include math-finite.h for _Float128
All the declarations in math-finite.h are macroized by floating-point
type.  This patch includes it for float128 and protects the
declarations of functions that need not be declared for float128.

	* math/math.h: Include bits/math-finite.h for float128.
	(__MATH_DECLARING_FLOATN): Define to control declaration of
	float128 functions.
	* math/bits/math-finite.h (pow10): Do not declare for float128.
	(gamma): Likewise.
	(scalb): Likewise.
2017-05-15 10:09:08 -03:00
Paul E. Murphy fcee5905d3 float128: Add public _Float128 declarations to libm.
This introduces the machine-dependent bits/floatn.h to control
the inclusion of _Float128 ABI.

	* bits/floatn.h: New file.
	* bits/huge_val_flt128.h: Likewise.

	* bits/libm-simd-decl-stubs.h (__DECL_SIMD_cosf128): New macro.
	(__DECL_SIMD_sinf128): Likewise.
	(__DECL_SIMD_sincosf128): Likewise.
	(__DECL_SIMD_logf128): Likewise.
	(__DECL_SIMD_expf128): Likewise.
	(__DECL_SIMD_powf128): Likewise.

	* math/Makefile (headers): Install bits/floatn.h and
	bits/huge_val_flt128.h.

	* math/bits/cmathcalls.h (_Mdouble_complex_): Only define if not
	defined.

	* math/bits/mathcalls.h (pow10, isinf, finite, drem, significand)
	(isnan, gamma, nexttoward, scalb): Only define if not
	__MATH_DECLARING_FLOATN.
	(nextdown, nextup, llogb, roundeven, fromfp, ufromfp, fromfpx)
	(ufromfpx, fmaxmag, fminmag, totalorder, totalordermag)
	(canonicalize, getpayload, setpayload, setpayloadsig): Declare for
	_FloatN even if	__STDC_WANT_IEC_60559_BFP_EXT__ is not defined.

	* math/complex.h: Include bits/libc-header-start.h and bits/floatn.h.
	Include bits/cmathcalls.h to get the declarations of _Float128
	versions of complex functions.
	[__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (CMPLXF128):
	Define macro.

	* math/math.h: Include bits/floatn.h and bits/huge_val_flt128.h.
	Include bits/mathcalls-helper-functions.h and bits/mathcalls.h to
	get the declarations of _Float128 versions of math functions.
	(__MATH_DECLARING_FLOATN): New macro to control declaration of
	_FloatN types.
	[__GNUC_PREREQ (6,0)] (signbit): Since GCC 6.0, __builtin_signbit
	is type-generic, so use it without __MATH_TG.
	[__HAVE_DISTINCT_FLOAT128] (isinf): This builtin is broken for
	_Float128 type on GCC < 7.0.  Explicitly call __isinff128 for
	_Float128 type and GCC < 7.0, otherwise use the builtin.
	[__HAVE_FLOAT128 && defined __USE_GNU] (M_Ef128, M_LOG2Ef128)
	(M_LOG10Ef128, M_LN2f128, M_LN10f128, M_PIf128, M_PI_2f128)
	(M_PI_4f128, M_1_PIf128, M_2_PIf128, M_SQRT2f128, M_SQRT1_2f128):
	New _GNU_SOURCE enabled macros.
2017-05-15 10:08:56 -03:00
Zack Weinberg 7c3018f9e4 Suppress internal declarations for most of the testsuite.
This patch adds a new build module called 'testsuite'.
IS_IN (testsuite) implies _ISOMAC, as do IS_IN_build and __cplusplus
(which means several ad-hoc tests for __cplusplus can go away).
libc-symbols.h now suppresses almost all of *itself* when _ISOMAC is
defined; in particular, _ISOMAC mode does not get config.h
automatically anymore.

There are still quite a few tests that need to see internal gunk of
one variety or another.  For them, we now have 'tests-internal' and
'test-internal-extras'; files in this category will still be compiled
with MODULE_NAME=nonlib, and everything proceeds as it always has.
The bulk of this patch is moving tests from 'tests' to
'tests-internal'.  There is also 'tests-static-internal', which has
the same effect on files in 'tests-static', and 'modules-names-tests',
which has the *inverse* effect on files in 'modules-names' (it's
inverted because most of the things in modules-names are *not* tests).
For both of these, the file must appear in *both* the new variable and
the old one.

There is also now a special case for when libc-symbols.h is included
without MODULE_NAME being defined at all.  (This happens during the
creation of libc-modules.h, and also when preprocessing Versions
files.)  When this happens, IS_IN is set to be always false and
_ISOMAC is *not* defined, which was the status quo, but now it's
explicit.

The remaining changes to C source files in this patch seemed likely to
cause problems in the absence of the main change.  They should be
relatively self-explanatory.  In a few cases I duplicated a definition
from an internal header rather than move the test to tests-internal;
this was a judgement call each time and I'm happy to change those
however reviewers feel is more appropriate.

	* Makerules: New subdir configuration variables 'tests-internal'
	and 'test-internal-extras'.  Test files in these categories will
	still be compiled with MODULE_NAME=nonlib.  Test files in the
	existing categories (tests, xtests, test-srcs, test-extras) are
	now compiled with MODULE_NAME=testsuite.
	New subdir configuration variable 'modules-names-tests'.  Files
	which are in both 'modules-names' and 'modules-names-tests' will
	be compiled with MODULE_NAME=testsuite instead of
	MODULE_NAME=extramodules.
	(gen-as-const-headers): Move to tests-internal.
	(do-tests-clean, common-mostlyclean): Support tests-internal.
	* Makeconfig (built-modules): Add testsuite.
	* Makefile: Change libof-check-installed-headers-c and
	libof-check-installed-headers-cxx to 'testsuite'.
	* Rules: Likewise.  Support tests-internal.
	* benchtests/strcoll-inputs/filelist#en_US.UTF-8:
	Remove extra-modules.mk.

	* config.h.in: Don't check for __OPTIMIZE__ or __FAST_MATH__ here.
	* include/libc-symbols.h: Move definitions of _GNU_SOURCE,
	PASTE_NAME, PASTE_NAME1, IN_MODULE, IS_IN, and IS_IN_LIB to the
	very top of the file and rationalize their order.
	If MODULE_NAME is not defined at all, define IS_IN to always be
	false, and don't define _ISOMAC.
	If any of IS_IN (testsuite), IS_IN_build, or __cplusplus are
	true, define _ISOMAC and suppress everything else in this file,
	starting with the inclusion of config.h.
	Do check for inappropriate definitions of __OPTIMIZE__ and
	__FAST_MATH__ here, but only if _ISOMAC is not defined.
        Correct some out-of-date commentary.

	* include/math.h: If _ISOMAC is defined, undefine NO_LONG_DOUBLE
	and _Mlong_double_ before including math.h.
	* include/string.h: If _ISOMAC is defined, don't expose
	_STRING_ARCH_unaligned. Move a comment to a more appropriate
	location.

	* include/errno.h, include/stdio.h, include/stdlib.h, include/string.h
	* include/time.h, include/unistd.h, include/wchar.h: No need to
	check __cplusplus nor use __BEGIN_DECLS/__END_DECLS.

	* misc/sys/cdefs.h (__NTHNL): New macro.
	* sysdeps/m68k/m680x0/fpu/bits/mathinline.h
	(__m81_defun): Use __NTHNL to avoid errors with GCC 6.

	* elf/tst-env-setuid-tunables.c: Include config.h with _LIBC
	defined, for HAVE_TUNABLES.
	* inet/tst-checks-posix.c: No need to define _ISOMAC.
	* intl/tst-gettext2.c: Provide own definition of N_.
	* math/test-signgam-finite-c99.c: No need to define _ISOMAC.
	* math/test-signgam-main.c: No need to define _ISOMAC.
	* stdlib/tst-strtod.c: Convert to test-driver. Split locale_test to...
	* stdlib/tst-strtod1i.c: ...this new file.
	* stdlib/tst-strtod5.c: Convert to test-driver and add copyright notice.
        Split tests of __strtod_internal to...
	* stdlib/tst-strtod5i.c: ...this new file.
	* string/test-string.h: Include stdint.h. Duplicate definition of
	inhibit_loop_to_libcall here (from libc-symbols.h).
	* string/test-strstr.c: Provide dummy definition of
	libc_hidden_builtin_def when including strstr.c.
	* sysdeps/ia64/fpu/libm-symbols.h: Suppress entire file in _ISOMAC
	mode; no need to test __STRICT_ANSI__ nor __cplusplus as well.
	* sysdeps/x86_64/fpu/math-tests-arch.h: Include cpu-features.h.
	Don't include init-arch.h.
	* sysdeps/x86_64/multiarch/test-multiarch.h: Include cpu-features.h.
	Don't include init-arch.h.

	* elf/Makefile: Move tst-ptrguard1-static, tst-stackguard1-static,
	tst-tls1-static, tst-tls2-static, tst-tls3-static, loadtest,
	unload, unload2, circleload1, neededtest, neededtest2,
	neededtest3, neededtest4, tst-tls1, tst-tls2, tst-tls3,
	tst-tls6, tst-tls7, tst-tls8, tst-dlmopen2, tst-ptrguard1,
	tst-stackguard1, tst-_dl_addr_inside_object, and all of the
	ifunc tests to tests-internal.
	Don't add $(modules-names) to test-extras.
	* inet/Makefile: Move tst-inet6_scopeid_pton to tests-internal.
	Add tst-deadline to tests-static-internal.
	* malloc/Makefile: Move tst-mallocstate and tst-scratch_buffer to
	tests-internal.
	* misc/Makefile: Move tst-atomic and tst-atomic-long to tests-internal.
	* nptl/Makefile: Move tst-typesizes, tst-rwlock19, tst-sem11,
	tst-sem12, tst-sem13, tst-barrier5, tst-signal7, tst-tls3,
	tst-tls3-malloc, tst-tls5, tst-stackguard1, tst-sem11-static,
	tst-sem12-static, and tst-stackguard1-static to tests-internal.
        Link tests-internal with libpthread also.
	Don't add $(modules-names) to test-extras.
	* nss/Makefile: Move tst-field to tests-internal.
	* posix/Makefile: Move bug-regex5, bug-regex20, bug-regex33,
	tst-rfc3484, tst-rfc3484-2, and tst-rfc3484-3 to tests-internal.
	* stdlib/Makefile: Move tst-strtod1i, tst-strtod3, tst-strtod4,
	tst-strtod5i, tst-tls-atexit, and tst-tls-atexit-nodelete to
	tests-internal.
        * sunrpc/Makefile: Move tst-svc_register to tests-internal.
	* sysdeps/powerpc/Makefile: Move test-get_hwcap and
	test-get_hwcap-static to tests-internal.
	* sysdeps/unix/sysv/linux/Makefile: Move tst-setgetname to
	tests-internal.
	* sysdeps/x86_64/fpu/Makefile: Add all libmvec test modules to
	modules-names-tests.
2017-05-11 19:27:59 -04:00
Paul E. Murphy 26265c3bce float128: Add _Float128 make bits to libm.
This adds the appropriate common bits for a platform to
enable float128 and expose ABI.

	* math/Makefile:
	(type-float128-suffix): New variable
	(type-float128-routines): Likewise
	(type-float128-yes): Likewise
	(types): Append float128 if supported
	(types-basic): New variable to control the use of templates for
	float, double, and long double, but not for float128 or newer types.
	(type-basic-foreach): Likewise.

	* sysdeps/ieee754/float128/Makeconfig: New file.
	* sysdeps/ieee754/float128/Versions: New file.
2017-05-09 11:40:28 -03:00
Gabriel F. T. Gomes 1361e98d56 Fix condition for inclusion of math-finite.h for long double
The condition for declaration of long double functions in
math-finite.h was #ifdef __MATH_DECLARE_LDOUBLE before the
macroization of this file.  After the macroization, it was incorreclty
changed to #if __MATH_DECLARE_LDOUBLE, which broke the build for arm.

	* math/math.h: Fix check for __MATH_DECLARE_LDOUBLE.
	* math/bits/math-finite.h: Likewise.
2017-03-31 14:50:00 -03:00
Gabriel F. T. Gomes 10614335d1 Change return type in the declaration of __ieee754_rem_pio2l
The implementation of __ieee754_rem_pio2l in ldbl-128, ldbl-128ibm,
and ldbl-96 return the type int32_t, whereas math_private.h declares
it as returning int.  This patch changes the declaration to match the
declaration in thoses directories, as well as it changes the stub
implementation in math/e_rem_pio2l.c, similarly.

	* math/e_rem_pio2l.c (__ieee754_rem_pio2l): Change return type
	to int32_t.
	* sysdeps/generic/math_private.h: Declare __ieee754_rem_pio2l
	as returning int32_t.
2017-03-30 15:22:27 -03:00
Gabriel F. T. Gomes f264cca593 Macroize inclusion of math-finite.h
This patch macroizes the declarations in math/bits/math-finite.h
similarly to what math/bits/mathcalls.h does.  For each floating-point
type, the file is included once in math/math.h.  This will reduce the
amount of repetitive boilerplate required when adding float128
versions of these declarations.

Tested for powerpc64le and s390x.

	* math/math.h: Include bits/math-finite.h once per
	floating-point type.
	* math/bits/math-finite.h: Macroize all declarations by
	floating-point type.
2017-03-30 09:59:25 -03:00
Tulio Magno Quites Machado Filho 598fe6d9f4 XFAIL catan and catanh tests on ibm128
Mark 4 catan and catanh tests as xfail-rounding:ibm128-libgcc.
After this patch all catan and catanh tests pass on ibm128.

Regenerated auto-libm-test-out using gmp 6.1.2, mpfr 3.1.5 and upstream
mpc (9ef8030e50),

Tested on powerpc, powerpc64 and powerpc64le.

	* math/auto-libm-test-in: Mark some catan and catanh as
	xfail-rounding:ibm128-libgcc.
	* math/auto-libm-test-out-catan: Regenerate.
	* math/auto-libm-test-out-catanh: Likewise.
2017-03-16 10:36:37 -03:00
Joseph Myers 2072f5c34e Remove C++ namespace handling from glibc headers.
glibc headers include some code (not particularly consistent or
systematic) to put various declarations in C++ namespaces std and
__c99, if _GLIBCPP_USE_NAMESPACES is defined.

As noted in <https://gcc.gnu.org/ml/libstdc++/2017-03/msg00025.html>,
this macro was removed from libstdc++ in 2000.  I don't expect
compilation with such old versions of libstdc++ to work with current
glibc headers anyway (whereas old *binaries* are expected to stay
working with current glibc); this patch (which should be a no-op with
any libstdc++ version postdating that removal) removes all this code
from the glibc headers.

The begin-end-check.pl test, whose comments say it is about checking
these namespace macro calls, is also removed.  The code in that test
would have covered __BEGIN_DECLS / __END_DECLS as well, but if those
weren't properly matched it would show up with the
check-installed-headers-cxx tests, so I don't think there is an actual
use for keeping begin-end-check.pl with the namespace code removed.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	* misc/sys/cdefs.h (__BEGIN_NAMESPACE_STD): Remove macro.
	(__END_NAMESPACE_STD): Likewise.
	(__USING_NAMESPACE_STD): Likewise.
	(__BEGIN_NAMESPACE_C99): Likewise.
	(__END_NAMESPACE_C99): Likewise.
	(__USING_NAMESPACE_C99): Likewise.
	* math/math.h (_Mdouble_BEGIN_NAMESPACE): Do not define and
	undefine macro.
	(_Mdouble_END_NAMESPACE): Likewise.
	* ctype/ctype.h: Do not handle C++ namespaces.
	* libio/bits/stdio-ldbl.h: Likewise.
	* libio/stdio.h: Likewise.
	* locale/locale.h: Likewise.
	* math/bits/mathcalls.h: Likewise.
	* setjmp/setjmp.h: Likewise.
	* signal/signal.h: Likewise.
	* stdlib/bits/stdlib-float.h: Likewise.
	* stdlib/bits/stdlib-ldbl.h: Likewise.
	* stdlib/stdlib.h: Likewise.
	* string/string.h: Likewise.
	* sysdeps/x86/fpu/bits/mathinline.h: Likewise.
	* time/bits/types/clock_t.h: Likewise.
	* time/bits/types/struct_tm.h: Likewise.
	* time/bits/types/time_t.h: Likewise.
	* time/time.h: Likewise.
	* wcsmbs/bits/wchar-ldbl.h: Likewise.
	* wcsmbs/uchar.h: Likewise.
	* wcsmbs/wchar.h: Likewise.
	[_GLIBCPP_USE_NAMESPACES] (wint_t): Remove conditional definition.
	* wctype/wctype.h: Do not handle C++ namespaces.
	* scripts/begin-end-check.pl: Remove.
	* Makefile (installed-headers): Likewise.
	(tests-special): Do not add $(objpfx)begin-end-check.out.
	($(objpfx)begin-end-check.out): Remove.
2017-03-16 13:31:57 +00:00
Joseph Myers e4e52ff059 Improve float range reduction accuracy near pi/2 (bug 21094).
Bug 21094 reports 3ulp errors of cosf and tanf for certain arguments
near pi/2 arising from the use of an insufficiently accurate range
reduction.  (To be clear, this is a quality-of-implementation issue
relating to the apparent intent of those particular cosf and tanf
implementations; 3ulp is within the general glibc accuracy goals, so
not inherently a bug.)

This patch fixes that error by making a wider range of cases use the
existing more accurate range reduction for arguments close to pi/2.
The wider range of values is still narrow enough for the "z -=
pio2_2;" in the more accurate case to be exact, as the code expects.

Tested for x86_64, x86 and mips64; no ulps updates needed (but at
least on mips64, the larger ulps were seen if the tests were added
without the substantive fix).

	[BZ #21094]
	* sysdeps/ieee754/flt-32/e_rem_pio2f.c (__ieee754_rem_pio2f): Use
	24+24+24-bit pi for wider range of values around pi/2.
	* math/auto-libm-test-in: Add more tests of cos and tan.
	* math/auto-libm-test-out-cos: Regenerated.
	* math/auto-libm-test-out-tan: Likewise.
2017-03-15 22:00:54 +00:00
Gabriel F. T. Gomes ff80ec4283 Split helper classification macros from mathcalls.h
The classification macros: finite, fpclassify, iseqsig, isinf, isnan,
issignaling, and signbit are defined by ISO C11 and declared in
mathcalls.h for each of the floating-point types: float, double, and
long double.

TS 18661-3 does not mention these macros for float128, however support
for them must be present when _Float128 is present.  This is true,
even when the feature test macro __STDC_WANT_IEC_60559_TYPES_EXT__ is
false.  Other function declarations in mathcalls.h, on the other hand,
depend on __STDC_WANT_IEC_60559_TYPES_EXT__.

This patch splits the helper functions (__finite, __fpclassify,
__iseqsig, __isinf, __isnan, __issignaling, and __signbit) from
mathcalls.h, so that these helper functions can be declared for
_Float128, even when __STDC_WANT_IEC_60559_TYPES_EXT__ is false.

Tested for powerpc64le, s390x, and x86_64.

	* include/bits/mathcalls-helper-functions.h: New file.
	* math/Makefile (headers): Add bits/mathcalls-helper-functions.h.
	* math/bits/mathcalls.h (__finite, __fpclassify, __iseqsig)
	(__isinf, __isnan, __issignaling, __signbit): Move declarations to
	math/bits/mathcalls-helper-functions.h.
	* math/bits/mathcalls-helper-functions.h: New file.
	* math/math.h: Include bits/mathcalls-helper-functions.h for
	float, double, and long double.
2017-03-15 09:39:16 -03:00
Gabriel F. T. Gomes 826aa1346f Use internal __feraiseexcept in __iseqsig
Replace the use of feraiseexcept with __feraiseexcept in the helper
function __iseqsig (math/s_iseqsig_template.c).

Tested for powerpc64le, s390x, and x86_64.

	* math/s_iseqsig_template.c (__iseqsig): Use __feraiseexcept
	instead of feraiseexcept.
2017-03-15 09:39:16 -03:00
Stefan Liebler 93adfe2d79 Update auto-libm-test-out for catan / catanh.
I've used gmp 6.1.2, mpfr 3.1.5 and upstream mpc with fix in mpc_atan
(https://scm.gforge.inria.fr/anonscm/gitweb?p=mpc/mpc.git;a=commit;h=958aac9b15a659d6fb5edcb11778123f8a35b14f)
to build gen-auto-libm-tests and regenerated  catan / catanh out files.
Regenerated ULPs for s390 from scratch.  Now the catan / catanh tests
are passing.

ChangeLog:

	* math/auto-libm-test-out-catan: Regenerated.
	* math/auto-libm-test-out-catanh: Likewise.
	* sysdeps/s390/fpu/libm-test-ulps: Likewise.
2017-03-10 08:45:29 +01:00
Zack Weinberg 5e4e10636c Miscellaneous low-risk changes preparing for _ISOMAC testsuite.
These are a grab bag of changes where the testsuite was using internal
symbols of some variety, but this was straightforward to fix, and the
fixed code should work with or without the change to compile the
testsuite under _ISOMAC.

Four of these are just more #include adjustments, but I want to highlight
sysdeps/powerpc/fpu/tst-setcontext-fpscr.c, which appears to have been
written before the advent of sys/auxv.h.  I think a big chunk of this file
could be replaced by a simple call to getauxval, but I'll let someone who
actually has a powerpc machine to test on do that.

dlfcn/tst-dladdr.c was including ldsodefs.h just so it could use
DL_LOOKUP_ADDRESS to print an additional diagnostic; as requested by Carlos,
I have removed this.

math/test-misc.c was using #ifndef NO_LONG_DOUBLE, which is an internal
configuration macro, to decide whether to do certain tests involving
'long double'.  I changed the test to #if LDBL_MANT_DIG > DBL_MANT_DIG
instead, which uses only public float.h macros and is equivalent on
all supported platforms.  (Note that NO_LONG_DOUBLE doesn't mean 'the
compiler doesn't support long double', it means 'long double is the
same as double'.)

tst-writev.c has a configuration macro 'ARTIFICIAL_LIMIT' that the
Makefiles are expected to define, and sysdeps/unix/sysv/linux/Makefile
was using the internal __getpagesize in the definition; changed to
sysconf(_SC_PAGESIZE) which is the POSIX equivalent.

ia64-linux doesn't supply 'clone', only '__clone2', which is not
defined in the public headers(!)  All the other clone tests have local
extern declarations of __clone2, but tst-clone.c doesn't; it was
getting away with this because include/sched.h does declare __clone2.

	* nss/tst-cancel-getpwuid_r.c: Include nss.h.
	* string/strcasestr.c: No need to include config.h.
	* sysdeps/powerpc/fpu/tst-setcontext-fpscr.c: Include
	sys/auxv.h. Don't include sysdep.h.
	* sysdeps/powerpc/tst-set_ppr.c: Don't include dl-procinfo.h.

	* dlfcn/tst-dladdr.c: Don't include ldsodefs.h.	 Don't use
	DL_LOOKUP_ADDRESS.
	* math/test-misc.c: Instead of testing NO_LONG_DOUBLE, test whether
	LDBL_MANT_DIG is greater than DBL_MANT_DIG.
	* sysdeps/unix/sysv/linux/Makefile (CFLAGS-tst-writev.c): Use
	sysconf (_SC_PAGESIZE) instead of __getpagesize in definition
	of ARTIFICIAL_LIMIT.
	* sysdeps/unix/sysv/linux/tst-clone.c [__ia64__]: Add extern
	declaration of __clone2.
2017-03-01 20:32:50 -05:00
Tulio Magno Quites Machado Filho 4f5a9afffb Use independent type literals in libm-test-support.c
* math/libm-test-support.c (check_ulp): Use LIT() around literal
	numbers.
2017-02-24 21:14:09 -03:00
Joseph Myers 92061bb033 Run libm tests separately for each function.
At present, libm tests for each function get built into a single
executable (for each floating point type, for each of normal / inline
/ finite-math-only functions, plus vector variants) and run together,
resulting in a single PASS or FAIL (for each of those nine variants
plus vector variants).  Building this executable involves reading
over 50 MB of libm-test-*.c sources.

This patch arranges for tests of each function to be run separately
from the makefiles instead.  There are 121 functions being tested for
each (type, variant pair) (actually 126, but run as 121 from the
Makefile because each of the pairs (exp10, pow10), (isfinite, finite),
(lgamma, gamma), (remainder, drem), (scalbn, ldexp), shares a table of
test results and so is run together), so 1089 separate tests run from
the Makefile, plus 48 vector tests on x86_64 (six functions for eight
vector variants).  Each test only involves a libm-test-<func>.c file
of no more than about 4 MB, rather than all such files taking about 50
MB.  With tests run separately, test summaries will indicate which
functions actually have problems (of course, those problems may just
be out-of-date libm-test-ulps files if the file hasn't been updated
for the architecture in question recently).

All the .c files for the 1089+48 tests are generated automatically
from the Makefiles.  Various checked-in boilerplate .c files are
removed as no longer needed.  CFLAGS definitions for the different
kinds of tests are generated using makefile iterators to apply
target-specific variable settings.  libm-have-vector-test.h is no
longer needed; the list of functions to test for each vector type is
now in the sysdeps Makefile.

This should reduce the amount of boilerplate needed for float128
testing support; test-float128.h will still be needed, but not various
.c files or Makefile CFLAGS definitions.  The logic for creating
dependencies on libm-test-support-*.o files should also render
<https://sourceware.org/ml/libc-alpha/2017-02/msg00279.html>
unnecessary.

Tested for x86_64 and x86.

	* math/Makefile (libm-tests-generated): Remove variable.
	(libm-tests-base-normal): New variable.
	(libm-tests-base-finite): Likewise.
	(libm-tests-base-inline): Likewise.
	(libm-tests-base): Likewise.
	(libm-tests-normal): Likewise.
	(libm-tests-finite): Likewise.
	(libm-tests-inline): Likewise.
	(libm-tests-vector): Likewise.
	(libm-tests): Define in terms of these new variables.
	(libm-tests-for-type): New variable.
	(libm-tests.o): Move definition.
	(tests): Move addition of $(libm-tests).
	(generated): Update for new and removed libm test files.
	($(objpfx)libm-test.c): Remove target.
	($(objpfx)libm-have-vector-test.h): Likewise.
	(CFLAGS-test-double-vlen2.c): Remove variable.
	(CFLAGS-test-double-vlen4.c): Likewise.
	(CFLAGS-test-double-vlen8.c): Likewise.
	(CFLAGS-test-float-vlen4.c): Likewise.
	(CFLAGS-test-float-vlen8.c): Likewise.
	(CFLAGS-test-float-vlen16.c): Likewise.
	(CFLAGS-test-float.c): Likewise.
	(CFLAGS-test-float-finite.c): Likewise.
	(CFLAGS-libm-test-support-float.c): Likewise.
	(CFLAGS-test-double.c): Likewise.
	(CFLAGS-test-double-finite.c): Likewise.
	(CFLAGS-libm-test-support-double.c): Likewise.
	(CFLAGS-test-ldouble.c): Likewise.
	(CFLAGS-test-ldouble-finite.c): Likewise.
	(CFLAGS-libm-test-support-ldouble.c): Likewise.
	(libm-test-inline-cflags): New variable.
	(CFLAGS-test-ifloat.c): Remove variable.
	(CFLAGS-test-idouble.c): Likewise.
	(CFLAGS-test-ildouble.c): Likewise.
	($(addprefix $(objpfx), $(libm-tests.o))): Move target and update
	dependencies.
	($(foreach t,$(libm-tests-normal),$(objpfx)$(t).c)): New rule.
	($(foreach t,$(libm-tests-finite),$(objpfx)$(t).c)): Likewise.
	($(foreach t,$(libm-tests-inline),$(objpfx)$(t).c)): Likewise.
	($(foreach t,$(libm-tests-vector),$(objpfx)$(t).c)): Likewise.
	($(foreach t,$(types),$(objpfx)libm-test-support-$(t).c)):
	Likewise.
	(dependencies on libm-test-support-*.o): Remove.
	($(foreach f,$(libm-test-funcs-all),$(objpfx)$(o)-$(f).o)): New
	rules using iterators.
	($(addprefix $(objpfx),$(call libm-tests-for-type,$(o)))):
	Likewise.
	($(objpfx)libm-test-support-$(o).o): Likewise.
	($(addprefix $(objpfx),$(filter-out $(tests-static)
	$(libm-vec-tests),$(tests)))): Filter out $(libm-tests-vector)
	instead.
	($(addprefix $(objpfx), $(libm-vec-tests))): Use iterator to
	define rule instead.
	* math/README.libm-test: Update.
	* math/libm-test-acos.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-acosh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-asin.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-asinh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-atan.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-atan2.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-atanh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cabs.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cacos.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cacosh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-canonicalize.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-carg.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-casin.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-casinh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-catan.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-catanh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cbrt.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-ccos.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-ccosh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-ceil.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cexp.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cimag.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-clog.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-clog10.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-conj.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-copysign.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cos.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cosh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cpow.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cproj.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-creal.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-csin.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-csinh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-csqrt.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-ctan.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-ctanh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-erf.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-erfc.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-exp.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-exp10.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-exp2.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-expm1.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fabs.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fdim.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-floor.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fma.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fmax.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fmaxmag.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fmin.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fminmag.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fmod.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fpclassify.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-frexp.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fromfp.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fromfpx.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-getpayload.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-hypot.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-ilogb.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-iscanonical.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-iseqsig.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-isfinite.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-isgreater.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-isgreaterequal.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-isinf.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-isless.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-islessequal.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-islessgreater.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-isnan.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-isnormal.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-issignaling.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-issubnormal.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-isunordered.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-iszero.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-j0.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-j1.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-jn.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-lgamma.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-llogb.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-llrint.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-llround.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-log.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-log10.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-log1p.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-log2.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-logb.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-lrint.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-lround.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-modf.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-nearbyint.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-nextafter.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-nextdown.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-nexttoward.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-nextup.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-pow.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-remainder.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-remquo.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-rint.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-round.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-roundeven.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-scalb.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-scalbln.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-scalbn.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-setpayload.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-setpayloadsig.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-signbit.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-significand.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-sin.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-sincos.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-sinh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-sqrt.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-tan.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-tanh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-tgamma.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-totalorder.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-totalordermag.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-trunc.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-ufromfp.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-ufromfpx.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-y0.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-y1.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-yn.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-driver.c: Do not include libm-have-vector-test.h.
	(HAVE_VECTOR): Remove macro.
	(START): Do not call HAVE_VECTOR.
	* math/test-double-vlen2.h (FUNC_TEST): Remove macro.
	* math/test-double-vlen4.h (FUNC_TEST): Remove macro.
	* math/test-double-vlen8.h (FUNC_TEST): Remove macro.
	* math/test-float-vlen16.h (FUNC_TEST): Remove macro.
	* math/test-float-vlen4.h (FUNC_TEST): Remove macro.
	* math/test-float-vlen8.h (FUNC_TEST): Remove macro.
	* math/test-math-vector.h (FUNC_TEST): New macro.
	(WRAPPER_DECL): Rename to WRAPPER_DECL_f.
	* sysdeps/x86_64/fpu/Makefile (double-vlen2-funcs): New variable.
	(double-vlen4-funcs): Likewise.
	(double-vlen4-avx2-funcs): Likewise.
	(double-vlen8-funcs): Likewise.
	(float-vlen4-funcs): Likewise.
	(float-vlen8-funcs): Likewise.
	(float-vlen8-avx2-funcs): Likewise.
	(float-vlen16-funcs): Likewise.
	(CFLAGS-test-double-vlen4-avx2.c): Remove variable.
	(CFLAGS-test-float-vlen8-avx2.c): Likewise.
	* sysdeps/x86_64/fpu/test-double-vlen4.h (TEST_VECTOR_cos): Remove
	macro.
	(TEST_VECTOR_sin): Likewise.
	(TEST_VECTOR_sincos): Likewise.
	(TEST_VECTOR_log): Likewise.
	(TEST_VECTOR_exp): Likewise.
	(TEST_VECTOR_pow): Likewise.
	* sysdeps/x86_64/fpu/test-double-vlen8.h (TEST_VECTOR_cos):
	Likewise.
	(TEST_VECTOR_sin): Likewise.
	(TEST_VECTOR_sincos): Likewise.
	(TEST_VECTOR_log): Likewise.
	(TEST_VECTOR_exp): Likewise.
	(TEST_VECTOR_pow): Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen16.h (TEST_VECTOR_cosf):
	Likewise.
	(TEST_VECTOR_sinf): Likewise.
	(TEST_VECTOR_sincosf): Likewise.
	(TEST_VECTOR_logf): Likewise.
	(TEST_VECTOR_expf): Likewise.
	(TEST_VECTOR_powf): Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen8.h (TEST_VECTOR_cosf):
	Likewise.
	(TEST_VECTOR_sinf): Likewise.
	(TEST_VECTOR_sincosf): Likewise.
	(TEST_VECTOR_logf): Likewise.
	(TEST_VECTOR_expf): Likewise.
	(TEST_VECTOR_powf): Likewise.
	* math/gen-libm-have-vector-test.sh: Remove file.
	* math/libm-test.inc: Likewise.
	* math/libm-test-support-double.c: Likewise.
	* math/libm-test-support-float.c: Likewise.
	* math/libm-test-support-ldouble.c: Likewise.
	* math/test-double-finite.c: Likewise.: Likewise.
	* math/test-double.c: Likewise.
	* math/test-float-finite.c: Likewise.
	* math/test-float.c: Likewise.
	* math/test-idouble.c: Likewise.
	* math/test-ifloat.c: Likewise.
	* math/test-ildouble.c: Likewise.
	* math/test-ldouble-finite.c: Likewise.
	* math/test-ldouble.c: Likewise.
	* sysdeps/x86_64/fpu/test-double-vlen2.c: Likewise.
	* sysdeps/x86_64/fpu/test-double-vlen2.h: Likewise.
	* sysdeps/x86_64/fpu/test-double-vlen4-avx2.c: Likewise.
	* sysdeps/x86_64/fpu/test-double-vlen4.c: Likewise.
	* sysdeps/x86_64/fpu/test-double-vlen8.c: Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen16.c: Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen4.c: Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen4.h: Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen8-avx2.c: Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen8.c: Likewise.
2017-02-24 00:52:49 +00:00
Gabriel F. T. Gomes aec0821ce7 Add new templates for IEEE wrappers
Several wrappers for IEEE functions use _LIB_VERSION / matherr /
__kernel_standard functionality, which we want to obsolete.  New
wrappers, such as for float128, must not use this functionality.

This patch adds new wrappers that only __set_errno and can be used by
the new float128 wrappers.

Tested for powerpc64le.

	* math/Makefile: Add wrappers to gen-libm-calls.
	* math/w_acos_template.c: New file.
	* math/w_acosh_template.c: Likewise.
	* math/w_asin_template.c: Likewise.
	* math/w_atan2_template.c: Likewise.
	* math/w_atanh_template.c: Likewise.
	* math/w_cosh_template.c: Likewise.
	* math/w_exp10_template.c: Likewise.
	* math/w_exp2_template.c: Likewise.
	* math/w_exp_template.c: Likewise.
	* math/w_fmod_template.c: Likewise.
	* math/w_hypot_template.c: Likewise.
	* math/w_j0_template.c: Likewise.
	* math/w_j1_template.c: Likewise.
	* math/w_jn_template.c: Likewise.
	* math/w_lgamma_r_template.c: Likewise.
	* math/w_lgamma_template.c: Likewise.
	* math/w_log10_template.c: Likewise.
	* math/w_log2_template.c: Likewise.
	* math/w_log_template.c: Likewise.
	* math/w_pow_template.c: Likewise.
	* math/w_remainder_template.c: Likewise.
	* math/w_sinh_template.c: Likewise.
	* math/w_sqrt_template.c: Likewise.
	* math/w_tgamma_template.c: Likewise.: Likewise.
	* sysdeps/generic/math-type-macros-double.h
	(__USE_WRAPPER_TEMPLATE): New macro to control inclusion of
	the new wrappers.
	* sysdeps/generic/math-type-macros-float.h: Likewise.
	* sysdeps/generic/math-type-macros-ldouble.h: Likewise.
2017-02-23 11:28:50 -03:00
Joseph Myers 24b2a1b122 Remove some unused libm-test exception macros.
This patch removes some libm-test-support.h macros for exceptions that
are no longer used.  EXCEPTIONS_OK has been unused for some time.  The
macros for underflow exceptions with some types only were used when
the results for complex inverse trig and hyperbolic functions were
manually maintained, but are no longer needed now the auto-libm-test
machinery is used to determine the correct result and exceptions for
every floating-point format and rounding mode.

Tested for x86_64.

	* math/libm-test-support.h (EXCEPTIONS_OK): Remove macro.
	(UNDERFLOW_EXCEPTION_FLOAT): Likewise.
	(UNDERFLOW_EXCEPTION_OK_FLOAT): Likewise.
	(UNDERFLOW_EXCEPTION_DOUBLE): Likewise.
	(UNDERFLOW_EXCEPTION_OK_DOUBLE): Likewise.
	(UNDERFLOW_EXCEPTION_LDOUBLE_IBM): Likewise.
2017-02-20 17:53:51 +00:00
Joseph Myers 2c51dfd05d Move tests of catan, catanh to auto-libm-test-*.
This patch moves tests of catan and catanh with finite inputs (other
than the divide-by-zero cases producing an exact infinity) to using
the auto-libm-test machinery.  Each of auto-libm-test-out-catan and
auto-libm-test-out-catanh takes about three seconds to generate on my
system (so in fact it wasn't necessary after all to defer the move to
auto-libm-test-* until the output files were split up by function).

Tested for x86_64 and x86 and ulps updated accordingly.

	* math/auto-libm-test-in: Add tests of catan and catanh.
	* math/auto-libm-test-out-catan: New generated file.
	* math/auto-libm-test-out-catanh: Likewise.
	* math/libm-test-catan.inc (catan_test_data): Use AUTO_TESTS_c_c.
	Move tests with finite inputs, except divide-by-zero cases, to
	auto-libm-test-in.
	* math/libm-test-catanh.inc (catanh_test_data): Likewise.
	* math/Makefile (libm-test-funcs-auto): Add catan and catanh.
	(libm-test-funcs-noauto): Remove catan and catanh.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2017-02-17 18:42:37 +00:00
Joseph Myers fa2a3dd7a3 Move tests of casin, casinh to auto-libm-test-*.
This patch moves tests of casin and casinh with finite inputs to using
the auto-libm-test machinery.  Each of auto-libm-test-out-casin and
auto-libm-test-out-casinh takes about 38 minutes to generate on my
system because of MPC slowness on special cases that appear in the
tests (with MPC 1.0.3; I don't know to what extent current MPC master
might speed it up).

Tested for x86_64 and x86 and ulps updated accordingly.

	* math/auto-libm-test-in: Add tests of casin and casinh.
	* math/auto-libm-test-out-casin: New generated file.
	* math/auto-libm-test-out-casinh: Likewise.
	* math/libm-test-casin.inc (casin_test_data): Use AUTO_TESTS_c_c.
	Move tests with finite inputs to auto-libm-test-in.
	* math/libm-test-casinh.inc (casinh_test_data): Likewise.
	* math/Makefile (libm-test-funcs-auto): Add casin and casinh.
	(libm-test-funcs-noauto): Remove casin and casinh.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2017-02-17 18:14:02 +00:00
Joseph Myers 6b8303a383 Move tests of cacos, cacosh to auto-libm-test-*.
This patch moves tests of cacos and cacosh with finite inputs to using
the auto-libm-test machinery.  Each of auto-libm-test-out-cacos and
auto-libm-test-out-cacosh takes about 80 minutes to generate on my
system because of MPC slowness on special cases that appear in the
tests (with MPC 1.0.3; I don't know to what extent current MPC master
might speed it up).

Tested for x86_64 and x86 and ulps updated accordingly.

	* math/auto-libm-test-in: Add tests of cacos and cacosh.
	* math/auto-libm-test-out-cacos: New generated file.
	* math/auto-libm-test-out-cacosh: Likewise.
	* math/libm-test-cacos.inc (cacos_test_data): Use AUTO_TESTS_c_c.
	Move tests with finite inputs to auto-libm-test-in.
	* math/libm-test-cacosh.inc (cacosh_test_data): Likewise.
	* math/Makefile (libm-test-funcs-auto): Add cacos and cacosh.
	(libm-test-funcs-noauto): Remove cacos and cacosh.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2017-02-17 17:44:23 +00:00
Joseph Myers b4e4172da6 Move INIT_ARCH_EXT call from libm-test-support to libm-test-driver.
libmvec tests involve calling INIT_ARCH_EXT during initialization then
CHECK_ARCH_EXT before testing each function to see if the processor
being used for testing supports the required instruction set
extensions.

After my refactoring of libm-test infrastructure, the INIT_ARCH_EXT
call is in libm-test-support.c, built only once per floating-point
type.  Now, in fact all definitions of this macro are empty, but given
that the definitions in sysdeps/x86_64/fpu/math-tests-arch.h are
conditional on REQUIRE_* macros defined in particular vector tests, it
seems more correct for the INIT_ARCH_EXT call to go instead in
libm-test-driver.c which gets built separately with those REQUIRE_*
macros properly defined.  This patch moves the call there.

Tested for x86_64 and x86.

	* math/libm-test-support.h: Do not include <math-tests-arch.h>
	here.
	* math/libm-test-support.c (libm_test_init): Do not call
	INIT_ARCH_EXT here.
	* math/libm-test-driver.c: Include <math-tests-arch.h>.
	(main): Call INIT_ARCH_EXT.
2017-02-14 00:15:48 +00:00
Joseph Myers 1266b9361a Move more csin, csinh tests to auto-libm-test-in.
When I moved tests of csin and csinh to auto-libm-test-in, I didn't
move a few tests for which gen-auto-libm-tests was very slow because
of MPC slowness on certain inputs.

Now that auto-libm-test-out has been split up, such slowness only
affects regenerating the test expectations for the individual
functions in question, rather than any addition of tests for any
function to auto-libm-test-in.  Thus, I no longer consider it a
problem to have these inputs in auto-libm-test-in, and this patch
moves them there.  This results in test generation for csin and csinh
taking 5m43s (for each of csin and csinh) on my system, while other
functions are unaffected.

I expect the test generation to be much faster in MPC 1.1 (the
relevant performance improvements went in MPC mainline in Dec 2013,
but there hasn't been a release from mainline since then).

Tested for x86_64 and x86.

	* math/auto-libm-test-in: Add more tests of csin and csinh.
	* math/auto-libm-test-out-csin: Regenerated.
	* math/auto-libm-test-out-csinh: Likewise.
	* math/libm-test-csin.inc (csin_test_data): Remove tests moved to
	auto-libm-test-in.
	* math/libm-test-csinh.inc (csinh_test_data): Likewise.
2017-02-09 18:30:41 +00:00
Gabriel F. T. Gomes 3789e2fd9d Merge libm-compat-calls-auto and libm-compat-calls
Both libm-compat-calls and libm-compat-calls-auto list the functions
that must be built for the types float, double, and long double, but
not for other floating-point types that get added to libm.  Besides
that, the use of libm-compat-calls-ldouble-yes to select if
w_lgamma_compatl and k_standardl should be built for long-double (in
libm-compat-calls) has the same effect of the use of type-foreach
(in libm-compat-calls-auto).

This patch merges the contents of libm-compat-calls into
libm-compat-calls-auto, then renames the latter to libm-compat-calls.

Tested for powerpc64le, s390, and x86_64.

	* math/Makefile (libm-compat-calls-ldouble-yes): Merge into
	libm-compat-calls-auto.
	(libm-compat-calls): Likewise.
	(libm-compat-calls-auto): Rename to libm-compat-calls and add
	w_lgamma_compatF and k_standardF (merged from the items above).
	(libm-routines): Use libm-compat-calls, instead of
	libm-compat-calls-auto, with type-foreach.
2017-02-09 15:58:41 -02:00
Joseph Myers 9b40563c8b Move -U__LIBC_INTERNAL_MATH_INLINES to test-math-inline.h.
The libm tests of inline functions undefine __NO_MATH_INLINES (from
math-CPPFLAGS) in test-math-inline.h, but __LIBC_INTERNAL_MATH_INLINES
via -U options in the makefile.

This is an odd inconsistency between the handling of the two macros.
It also depends on the ordering (in compilation commands) of the
various variables providing compiler options (which I think is why
it's using CPPFLAGS-*.c instead of CFLAGS-*.c).

This patch moves the undefine to test-math-inline.h, so improving
consistency and eliminating the dependency on the order in which
variables go in the compilation commands.  The CPPFLAGS-*.c variables
are renamed to CFLAGS-*.c, matching those for the non-inline libm
function tests.

By moving the -U option to the header file, this should ensure that
ordering issues don't arise with a subsequent move of the options to
these tests to target-specific CFLAGS += ... variable settings (for
when tests for each function are build separately and so compilation
options need setting for many more makefile targets, for which
target-specific variable settings seem to be the most convenient form
to generate with iterators).

Tested for x86_64.

	* math/test-math-inline.h (__LIBC_INTERNAL_MATH_INLINES): Undefine
	macro.
	* math/Makefile (CPPFLAGS-test-ifloat.c): Rename to ...
	(CFLAGS-test-ifloat.c): ... this.  Remove
	-U__LIBC_INTERNAL_MATH_INLINES.
	* math/Makefile (CPPFLAGS-test-idouble.c): Rename to ...
	(CFLAGS-test-idouble.c): ... this.  Remove
	-U__LIBC_INTERNAL_MATH_INLINES.
	* math/Makefile (CPPFLAGS-test-ildouble.c): Rename to ...
	(CFLAGS-test-ildouble.c): ... this.  Remove
	-U__LIBC_INTERNAL_MATH_INLINES.
2017-02-09 17:32:48 +00:00
Joseph Myers 3b2f60328e Build most libm-test support code once per type.
libm-test-driver.c contains various functions used in the course of
libm testing, which are built as part of each test using this
machinery.

Currently, these functions get built for three tests for each type
(e.g. test-float, test-ifloat, test-float-finite), plus the vector
function tests.  All these tests are huge and thus slow to build; the
output of gen-libm-test.pl totals around 40 MB across all functions.
To make the individual tests built from the Makefile smaller, it makes
sense to split these tests up so the tests for each function are built
separately (thus, three tests for each (function, type) pair, plus
vector tests built only for functions that actually have vector
versions).  This improves parallelism and means that if tests fail,
the summary of failed tests makes it more obvious where the problem
might be without needing to look in the .out files to see which
functions' tests failed (though architecture maintainers still need to
keep libm-test-ulps up to date to avoid spurious failures of little
interest).

Simply including libm-test-driver.c as-is in such individual-function
tests does not work because of unused static check_* functions (those
functions only being used for the types of the outputs of the function
under test).  It also means the common code gets built over 1000 times
instead of nine (plus vector tests).  To avoid that issue, this patch
splits out the bulk of the libm-test-driver.c code into a separate
file libm-test-support.c (with a few functions made non-static).  That
separate file is built only once for each floating-point type (so at
present three times, or twice on architectures with long double =
double).  Definitions needed in both libm-test-support.c and
libm-test-driver.c go in libm-test-support.h (it's possible some of
those are in fact only needed in one of the two files).
libm-test-driver.c keeps definitions of a limited number of variables
used to configure how libm-test-support.c behaves, various macros and
structures needed by individual-function tests, and the main function.

This move is also consistent in spirit with the move away from
test-skeleton.c having all the test support code, to a small
support/test-driver.c included in individual tests with most of the
code built separately.

Tested for x86_64 and x86.

	* math/libm-test-support.c: New file.  Content from
	math/libm-test-driver.c.
	* math/libm-test-support.h: Likewise.
	* math/libm-test-support-double.c: New file.
	* math/libm-test-support-float.c: Likewise.
	* math/libm-test-support-ldouble.c: Likewise.
	* math/libm-test-driver.c: Remove main comment and header
	includes.  Include libm-test-support.h.
	[!_GNU_SOURCE] (_GNU_SOURCE): Do not define.
	(flag_test_errno): Remove static.
	(flag_test_exceptions): Likewise.
	(flag_test_finite): Likewise.
	(flag_test_inline): Likewise.
	(flag_test_mathvec): Likewise.
	(test_msg): Likewise.
	(NO_EXCEPTION): Remove.
	(INVALID_EXCEPTION): Likewise.
	(DIVIDE_BY_ZERO_EXCEPTION): Likewise.
	(OVERFLOW_EXCEPTION): Likewise.
	(UNDERFLOW_EXCEPTION): Likewise.
	(INEXACT_EXCEPTION): Likewise.
	(INVALID_EXCEPTION_OK): Likewise.
	(DIVIDE_BY_ZERO_EXCEPTION_OK): Likewise.
	(OVERFLOW_EXCEPTION_OK): Likewise.
	(UNDERFLOW_EXCEPTION_OK): Likewise.
	(NO_INEXACT_EXCEPTION): Likewise.
	(EXCEPTIONS_OK): Likewise.
	(IGNORE_ZERO_INF_SIGN): Likewise.
	(TEST_NAN_SIGN): Likewise.
	(TEST_NAN_PAYLOAD): Likewise.
	(NO_TEST_INLINE): Likewise.
	(XFAIL_TEST): Likewise.
	(ERRNO_UNCHANGED): Likewise.
	(ERRNO_EDOM): Likewise.
	(ERRNO_ERANGE): Likewise.
	(IGNORE_RESULT): Likewise.
	(NON_FINITE): Likewise.
	(TEST_SNAN): Likewise.
	(NO_TEST_MATHVEC): Likewise.
	(__CONCATX): Likewise.
	(TYPE_MIN): Likewise.
	(TYPE_TRUE_MIN): Likewise.
	(TYPE_MAX): Likewise.
	(MIN_EXP): Likewise.
	(MAX_EXP): Likewise.
	(MANT_DIG): Likewise.
	(FSTR_MAX): Likewise.
	(ulp_idx): Likewise.
	(qtype_str): Remove static.
	(TEST_COND_binary32): Remove.
	(TEST_COND_binary64): Likewise.
	(TEST_COND_binary128): Likewise.
	(TEST_COND_ibm128): Likewise.
	(TEST_COND_intel96): Likewise.
	(TEST_COND_m68k96): Likewise.
	(TEST_COND_ibm128_libgcc): Likewise.
	(XFAIL_IBM128_LIBGCC): Likewise.
	(PAYLOAD_DIG): Likewise.
	(UNDERFLOW_EXCEPTION_FLOAT): Likewise.
	(UNDERFLOW_EXCEPTION_OK_FLOAT): Likewise.
	(UNDERFLOW_EXCEPTION_DOUBLE): Likewise.
	(UNDERFLOW_EXCEPTION_OK_DOUBLE): Likewise.
	(UNDERFLOW_EXCEPTION_LDOUBLE_IBM): Likewise.
	(UNDERFLOW_EXCEPTION_BEFORE_ROUNDING): Likewise.
	(TEST_COND_long32): Likewise.
	(TEST_COND_long64): Likewise.
	(TEST_COND_before_rounding): Likewise.
	(TEST_COND_after_rounding): Likewise.
	(ulps_file_name): Likewise.
	(ulps_file): Likewise.
	(output_ulps): Likewise.
	(output_dir): Likewise.
	(noErrors): Likewise.
	(noTests): Likewise.
	(noExcTests): Likewise.
	(noErrnoTests): Likewise.
	(verbose): Likewise.
	(output_max_error): Likewise.
	(output_points): Likewise.
	(ignore_max_ulp): Likewise.
	(max_error): Likewise.
	(real_max_error): Likewise.
	(imag_max_error): Likewise.
	(prev_max_error): Likewise.
	(prev_real_max_error): Likewise.
	(prev_imag_max_error): Likewise.
	(max_valid_error): Likewise.
	(TYPE_DECIMAL_DIG): Likewise.
	(TYPE_HEX_DIG): Likewise.
	(fmt_ftostr): Likewise.
	(compare_ulp_data): Likewise.
	(find_ulps): Likewise.
	(init_max_error): Likewise.
	(set_max_error): Likewise.
	(print_float): Likewise.
	(print_screen): Likewise.
	(print_screen_max_error): Likewise.
	(update_stats): Likewise.
	(print_function_ulps): Likewise.
	(print_complex_function_ulps): Likewise.
	(fpstack_test): Likewise.
	(print_max_error): Likewise.
	(print_complex_max_error): Likewise.
	(test_single_exception): Likewise.
	(test_exceptions): Likewise.
	(test_single_errno): Likewise.
	(test_errno): Likewise.
	(ULPDIFF): Likewise.
	(ulp): Likewise.
	(check_float_internal): Likewise.
	(check_float): Likewise.
	(check_complex): Likewise.
	(check_int): Likewise.
	(check_long): Likewise.
	(check_bool): Likewise.
	(check_longlong): Likewise.
	(check_intmax_t): Likewise.
	(check_uintmax_t): Likewise.
	(enable_test): Likewise.
	(matherr): Likewise.
	(initialize): Likewise.
	(options): Likewise.
	(doc): Remove static.
	(argp): Likewise.
	(parse_opt): Remove.
	(check_ulp): Likewise.
	(libm_test_init): Likewise.
	(libm_test_finish): Likewise.
	* math/Makefile (libm-test-support): New variable.
	(test-extras): Add libm-test-support files.
	(extra-test-objs): Likewise.
	(CFLAGS-libm-test-support-float.c): New variable.
	(CFLAGS-libm-test-support-double.c): Likewise.
	(CFLAGS-libm-test-support-ldouble.c): Likewise.
	($(addprefix $(objpfx),$(libm-tests)): Depend on appropriate
	libm-test-support objects.
2017-02-08 21:11:49 +00:00
Gabriel F. T. Gomes 5ab621c347 Move w_exp to libm-compat-call-auto
This patch adds the "_compat" suffix to the wrappers of the function
exp, which use _LIB_VERSION / matherr / __kernel_standard
functionality.

Tested for powerpc64le, s390, and x86_64.

	* math/Makefile (libm-calls): Move w_exp...
	(libm-compat-calls-auto): Here.

	* math/w_expl.c: Add suffix "_compat" to filename.
	* sysdeps/ia64/fpu/w_expl.c: Likewise.
	* sysdeps/ia64/fpu/w_expf.c: Likewise.
	* sysdeps/ia64/fpu/w_exp.c: Likewise.
	* sysdeps/ieee754/dbl-64/w_exp.c: Likewise.
	* sysdeps/ieee754/flt-32/w_expf.c: Likewise.
	* sysdeps/ieee754/ldbl-128/w_expl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/w_expl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/w_expl.c: Likewise.

	* math/w_expl_compat.c: New file, copied from above.
	* sysdeps/ia64/fpu/w_exp_compat.c: Likewise.
	* sysdeps/ia64/fpu/w_expf_compat.c: Likewise.
	* sysdeps/ia64/fpu/w_expl_compat.c: Likewise.
	* sysdeps/ieee754/dbl-64/w_exp_compat.c: Likewise.
	* sysdeps/ieee754/flt-32/w_expf_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-128/w_expl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-96/w_expl_compat.c: Likewise.

	* sysdeps/ieee754/ldbl-64-128/w_expl.c: Add suffix "_compat"
	to filename.
	* sysdeps/ieee754/ldbl-opt/w_exp.c: Likewise.

	* sysdeps/ieee754/ldbl-64-128/w_expl_compat.c: New file,
	copied from above and adjusted for the new filenames.
	* sysdeps/ieee754/ldbl-opt/w_exp_compat.c: Likewise.
2017-02-08 17:44:20 -02:00
Gabriel F. T. Gomes 163f65e28c Move w_lgamma to libm-compat-calls-auto
This patch adds the suffix "_compat2" to the wrappers for lgamma,
which use _LIB_VERSION / matherr / __kernel_standard functionality.
The suffix "_compat2" is used because the suffix "_compat" is already
used.

Tested for powerpc64le, s390, and x86_64.

	* math/Makefile (libm-calls): Move w_lgammaF...
	(libm-compat-calls-auto): Here.

	* math/w_lgamma.c: Add suffix "_compat2" to filename.
	* math/w_lgammaf.c: Likewise.
	* math/w_lgammal.c: Likewise.

	* math/w_lgamma_compat2.c: New file, copied from above.
	* math/w_lgammaf_compat2.c: Likewise.
	* math/w_lgammal_compat2.c: Likewise.
2017-02-08 17:40:11 -02:00
Gabriel F. T. Gomes ea814db27a Move w_lgamma_r to libm-compat-calls-auto
This patch adds the suffix "_compat" to lgamma_r wrappers and make
some adjustments to #includes and Makefiles.  This is a step towards
deprecation of wrappers that use _LIB_VERSION / matherr /
__kernel_standard functionality.

Tested for powerpc64le, s390, and x86_64.

	* math/Makefile (libm-calls): Move w_lgammaF_r...
	(libm-compat-calls-auto): Here.

	* math/w_lgamma_r.c: Add suffix "_compat" to filename.
	* math/w_lgammaf_r.c: Likewise.
	* math/w_lgammal_r.c: Likewise.
	* sysdeps/ia64/fpu/w_lgammal_r.c: Likewise.
	* sysdeps/ia64/fpu/w_lgammaf_r.c: Likewise.
	* sysdeps/ia64/fpu/w_lgamma_r.c: Likewise.

	* math/w_lgamma_r_compat.c: New file, copied from above.
	* math/w_lgammaf_r_compat.c: Likewise.
	* math/w_lgammal_r_compat.c: Likewise.
	* sysdeps/ia64/fpu/w_lgamma_r_compat.c: Likewise.
	* sysdeps/ia64/fpu/w_lgammaf_r_compat.c: Likewise.
	* sysdeps/ia64/fpu/w_lgammal_r_compat.c: Likewise.

	* sysdeps/ieee754/ldbl-opt/w_lgamma_r.c: Add suffix "_compat"
	to filename.
	* sysdeps/ieee754/ldbl-opt/w_lgammal_r.c: Likewise.

	* sysdeps/ieee754/ldbl-opt/w_lgamma_r_compat.c: New file
	copied from above and adjusted for the new filenames.
	* sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c: Likewise.
2017-02-08 17:36:09 -02:00
Joseph Myers 12d6284c0e Clean up libm vector tests exception test disabling.
The libm vector tests disable tests of exception raising via defining
macros EXCEPTION_TESTS_float and EXCEPTION_TESTS_double to 0 in the
headers for individual vector lengths.

As EXCEPTION_TESTS is used in code in libm-test-driver.c that is
otherwise ready to be built only once per type, this is not a good
idea; it's better to define TEST_EXCEPTIONS appropriately so that
flag_test_exceptions then gets initialized appropriately.
Furthermore, it's better to do this just once, in test-math-vector.h,
since there is no actual dependence on the vector length or type.
This patch duly makes that change.

Tested for x86_64.

	* math/test-math-finite.h (TEST_EXCEPTIONS): New macro.
	* math/test-math-no-finite.h (TEST_EXCEPTIONS): Likewise.
	* math/test-math-vector.h (TEST_EXCEPTIONS): Likewise.
	* math/test-math-no-inline.h (TEST_EXCEPTIONS): Remove macro.
	* math/test-double-vlen2.h (EXCEPTION_TESTS_double): Likewise.
	* math/test-double-vlen4.h (EXCEPTION_TESTS_double): Likewise.
	* math/test-double-vlen8.h (EXCEPTION_TESTS_double): Likewise.
	* math/test-float-vlen4.h (EXCEPTION_TESTS_float): Likewise.
	* math/test-float-vlen8.h (EXCEPTION_TESTS_float): Likewise.
	* math/test-float-vlen16.h (EXCEPTION_TESTS_float): Likewise.
2017-02-07 23:06:19 +00:00
Joseph Myers edbbdb1855 Fix powf inaccuracy (bug 21112).
Bug 21112 reports a case where powf is substantially inaccurate.  This
results from a multiplication where cp_h*p_h is required to be exact,
and p_h is masked to have only 12 leading nonzero bits in its
mantissa, but the value of cp_h has the 13th bit nonzero, leading to
inexact multiplication results in some cases that can result in large
errors in the final result of powf.  This patch fixes this by using a
value of cp_h correctly rounded to nearest to 12 bits, with a
corresponding updated value of cp_l.

Tested for x86_64 and x86.

	[BZ #21112]
	* sysdeps/ieee754/flt-32/e_powf.c (cp_h): Use value with trailing
	12 bits zero.
	(cp_l): Update for new value of cp_h.
	* math/auto-libm-test-in: Add another test of pow.
	* math/auto-libm-test-out-pow: Regenerated.
2017-02-07 17:15:47 +00:00
Joseph Myers dcd4cd5756 Refactor some code in libm-test-driver.c.
Splitting libm tests by function will mean about a thousand such tests
built separately instead of the present nine (plus vector variants).

When this is done, it's desirable to avoid needing to build all the
test infrastructure so many times.  Also, simply including
libm-test-driver.c as-is into per-function tests doesn't actually
work, because the various check_* functions are not used by all tests
and so generate errors for unused static functions.

Although some pieces of infrastructure depend on the type being tested
while others don't, building once per type seems the simplest
approach.  This patch makes changes to libm-test-driver.c in
preparation for that.  Various cases where functions directly use
macros such as TEST_ERRNO (that may vary depending on things other
than the type under test) are changed to use variables initialized
using those macros, while most of the code in main is moved out to
functions libm_test_init and libm_test_fini.

The idea is that all the functions in libm-test-driver.c will be moved
out in a subsequent patch to be built once per type (and be no longer
static when they are used from per-function tests), while
libm-test-driver.c remains containing definitions of various variables
(no longer static, of course, because they'll be used in the per-type
code) and the main function.  Declarations / macros relevant to both
the once-per-type code and the per-function tests will go in a shared
header.

Tested for x86_64.

	* math/libm-test-driver.c (flag_test_errno): New variable.
	(flag_test_exceptions): Likewise.
	(flag_test_finite): Likewise.
	(flag_test_inline): Likewise.
	(flag_test_mathvec): Likewise.
	(test_msg): Likewise.
	(ulp_idx): Likewise.
	(qtype_str): Likewise.
	(ULP_IDX): Remove macro.
	(QTYPE_STR): Likewise.
	(find_ulps): Use ulp_idx not ULP_IDX.
	(print_function_ulps): Use qtype_str, printed with %s, not
	QTYPE_STR, printed with concatentation to format string.
	(print_complex_function_ulps): Likewise.
	(test_exceptions): Use flag_test_exceptions not TEST_EXCEPTIONS.
	(test_errno): Use flag_test_errno not TEST_ERRNO.
	(enable_test): Use flag_test_inline, flag_test_finite and
	flag_test_mathvec instead of TEST_INLINE, TEST_FINITE and
	TEST_MATHVEC.
	(libm_test_init): New function.  Factored out of main.
	(libm_test_finish): Likewise.
	(main): Call libm_test_init and libm_test_finish and move most
	code to those functions.
2017-02-06 23:23:54 +00:00
Joseph Myers a622c2db55 Move libm-test TEST_MSG definitions to libm-test-driver.c.
Various files using the libm-test infrastructure define a TEST_MSG
macro with an informal description of the tests being run.

This patch moves this macro to libm-test-driver.c (the definition
depending on other macros already defined), so files specific to
(type, choice of whether to test inline functions or finite-math-only
functions, vector length) no longer need to define it.  This is in
preparation for replacing files such as test-float.c with per-function
test-float-<func>.c etc. automatically generated in the build
directory when tests are run.

Tested for x86_64.

	* math/libm-test-driver.c (STRX): New macro.
	(STR): Likewise.
	(STR_FLOAT): Likewise.
	(STR_VEC_LEN): Likewise.
	(TEST_MSG): Likewise.  Define here instead of expecting to be
	defined by including file.
	* math/test-double-finite.c (TEST_MSG): Remove macro.
	* math/test-double-vlen2.h (TEST_MSG): Likewise.
	* math/test-double-vlen4.h (TEST_MSG): Likewise.
	* math/test-double-vlen8.h (TEST_MSG): Likewise.
	* math/test-double.c (TEST_MSG): Likewise.
	* math/test-float-finite.c (TEST_MSG): Likewise.
	* math/test-float-vlen16.h (TEST_MSG): Likewise.
	* math/test-float-vlen4.h (TEST_MSG): Likewise.
	* math/test-float-vlen8.h (TEST_MSG): Likewise.
	* math/test-float.c (TEST_MSG): Likewise.
	* math/test-idouble.c (TEST_MSG): Likewise.
	* math/test-ifloat.c (TEST_MSG): Likewise.
	* math/test-ildouble.c (TEST_MSG): Likewise.
	* math/test-ldouble-finite.c (TEST_MSG): Likewise.
	* math/test-ldouble.c (TEST_MSG): Likewise.
2017-02-06 23:07:22 +00:00
Joseph Myers 5cbb58493d Split libm-test.inc by function.
Continuing the process of splitting up libm tests into more reasonably
sized units, this patch splits libm-test.inc into 121 separate
libm-test-<function>.inc files, one per array of test data.  (There
are 126 libm *_test functions, but five of those are for functions
that are aliases for test purposes and so share arrays of test data.)

In the present patch, the 121 files get processed separately by
gen-libm-test.pl, each using only the auto-libm-test-out-<function>
file that is relevant (/dev/null for functions not using
auto-libm-test-* at all).  This effectively eliminates the
serialization on running gen-libm-test.pl.  However, the resulting .c
files still all get #included together, so compiling the limited
number of libm tests using libm-test.inc may still act as a
serialization point (the compilations still all have 40 MB of code to
process).  libm-test.inc doesn't actually have anything in it any more
that needs gen-libm-test.pl processing, but is left as a .inc file
that gets processed to produce a .c file, rather than being renamed,
since the intent of this patch is as an intermediate step before
libm-test.inc gets removed and tests get compiled separately for each
function being tested.

Tested for x86_64.

	* math/libm-test.inc: Move all tests of individual functions to
	libm-test-*.inc and #include libm-test-*.c files.
	(acos_test_data): Remove.
	(acos_test): Likewise.
	(acosh_test_data): Likewise.
	(acosh_test): Likewise.
	(asin_test_data): Likewise.
	(asin_test): Likewise.
	(asinh_test_data): Likewise.
	(asinh_test): Likewise.
	(atan_test_data): Likewise.
	(atan_test): Likewise.
	(atanh_test_data): Likewise.
	(atanh_test): Likewise.
	(atan2_test_data): Likewise.
	(atan2_test): Likewise.
	(cabs_test_data): Likewise.
	(cabs_test): Likewise.
	(cacos_test_data): Likewise.
	(cacos_test): Likewise.
	(cacosh_test_data): Likewise.
	(cacosh_test): Likewise.
	(canonicalize_test_data): Likewise.
	(canonicalize_test): Likewise.
	(carg_test_data): Likewise.
	(carg_test): Likewise.
	(casin_test_data): Likewise.
	(casin_test): Likewise.
	(casinh_test_data): Likewise.
	(casinh_test): Likewise.
	(catan_test_data): Likewise.
	(catan_test): Likewise.
	(catanh_test_data): Likewise.
	(catanh_test): Likewise.
	(cbrt_test_data): Likewise.
	(cbrt_test): Likewise.
	(ccos_test_data): Likewise.
	(ccos_test): Likewise.
	(ccosh_test_data): Likewise.
	(ccosh_test): Likewise.
	(ceil_test_data): Likewise.
	(ceil_test): Likewise.
	(cexp_test_data): Likewise.
	(cexp_test): Likewise.
	(cimag_test_data): Likewise.
	(cimag_test): Likewise.
	(clog_test_data): Likewise.
	(clog_test): Likewise.
	(clog10_test_data): Likewise.
	(clog10_test): Likewise.
	(conj_test_data): Likewise.
	(conj_test): Likewise.
	(copysign_test_data): Likewise.
	(copysign_test): Likewise.
	(cos_test_data): Likewise.
	(cos_test): Likewise.
	(cosh_test_data): Likewise.
	(cosh_test): Likewise.
	(cpow_test_data): Likewise.
	(cpow_test): Likewise.
	(cproj_test_data): Likewise.
	(cproj_test): Likewise.
	(creal_test_data): Likewise.
	(creal_test): Likewise.
	(csin_test_data): Likewise.
	(csin_test): Likewise.
	(csinh_test_data): Likewise.
	(csinh_test): Likewise.
	(csqrt_test_data): Likewise.
	(csqrt_test): Likewise.
	(ctan_test_data): Likewise.
	(ctan_test): Likewise.
	(ctanh_test_data): Likewise.
	(ctanh_test): Likewise.
	(erf_test_data): Likewise.
	(erf_test): Likewise.
	(erfc_test_data): Likewise.
	(erfc_test): Likewise.
	(exp_test_data): Likewise.
	(exp_test): Likewise.
	(exp10_test_data): Likewise.
	(exp10_test): Likewise.
	(pow10_test): Likewise.
	(exp2_test_data): Likewise.
	(exp2_test): Likewise.
	(expm1_test_data): Likewise.
	(expm1_test): Likewise.
	(fabs_test_data): Likewise.
	(fabs_test): Likewise.
	(fdim_test_data): Likewise.
	(fdim_test): Likewise.
	(floor_test_data): Likewise.
	(floor_test): Likewise.
	(fma_test_data): Likewise.
	(fma_test): Likewise.
	(fmax_test_data): Likewise.
	(fmax_test): Likewise.
	(fmaxmag_test_data): Likewise.
	(fmaxmag_test): Likewise.
	(fmin_test_data): Likewise.
	(fmin_test): Likewise.
	(fminmag_test_data): Likewise.
	(fminmag_test): Likewise.
	(fmod_test_data): Likewise.
	(fmod_test): Likewise.
	(fpclassify_test_data): Likewise.
	(fpclassify_test): Likewise.
	(frexp_test_data): Likewise.
	(frexp_test): Likewise.
	(fromfp_test_data): Likewise.
	(fromfp_test): Likewise.
	(fromfpx_test_data): Likewise.
	(fromfpx_test): Likewise.
	(getpayload_test_data): Likewise.
	(getpayload_test): Likewise.
	(hypot_test_data): Likewise.
	(hypot_test): Likewise.
	(ilogb_test_data): Likewise.
	(ilogb_test): Likewise.
	(iscanonical_test_data): Likewise.
	(iscanonical_test): Likewise.
	(iseqsig_test_data): Likewise.
	(iseqsig_test): Likewise.
	(isfinite_test_data): Likewise.
	(isfinite_test): Likewise.
	(finite_test): Likewise.
	(isgreater_test_data): Likewise.
	(isgreater_test): Likewise.
	(isgreaterequal_test_data): Likewise.
	(isgreaterequal_test): Likewise.
	(isinf_test_data): Likewise.
	(isinf_test): Likewise.
	(isless_test_data): Likewise.
	(isless_test): Likewise.
	(islessequal_test_data): Likewise.
	(islessequal_test): Likewise.
	(islessgreater_test_data): Likewise.
	(islessgreater_test): Likewise.
	(isnan_test_data): Likewise.
	(isnan_test): Likewise.
	(isnormal_test_data): Likewise.
	(isnormal_test): Likewise.
	(issignaling_test_data): Likewise.
	(issignaling_test): Likewise.
	(issubnormal_test_data): Likewise.
	(issubnormal_test): Likewise.
	(isunordered_test_data): Likewise.
	(isunordered_test): Likewise.
	(iszero_test_data): Likewise.
	(iszero_test): Likewise.
	(j0_test_data): Likewise.
	(j0_test): Likewise.
	(j1_test_data): Likewise.
	(j1_test): Likewise.
	(jn_test_data): Likewise.
	(jn_test): Likewise.
	(lgamma_test_data): Likewise.
	(lgamma_test): Likewise.
	(gamma_test): Likewise.
	(llogb_test_data): Likewise.
	(llogb_test): Likewise.
	(lrint_test_data): Likewise.
	(lrint_test): Likewise.
	(llrint_test_data): Likewise.
	(llrint_test): Likewise.
	(log_test_data): Likewise.
	(log_test): Likewise.
	(log10_test_data): Likewise.
	(log10_test): Likewise.
	(log1p_test_data): Likewise.
	(log1p_test): Likewise.
	(log2_test_data): Likewise.
	(log2_test): Likewise.
	(logb_test_data): Likewise.
	(logb_test): Likewise.
	(lround_test_data): Likewise.
	(lround_test): Likewise.
	(llround_test_data): Likewise.
	(llround_test): Likewise.
	(modf_test_data): Likewise.
	(modf_test): Likewise.
	(nearbyint_test_data): Likewise.
	(nearbyint_test): Likewise.
	(nextafter_test_data): Likewise.
	(nextafter_test): Likewise.
	(nextup_test_data): Likewise.
	(nextup_test): Likewise.
	(nextdown_test_data): Likewise.
	(nextdown_test): Likewise.
	(nexttoward_test_data): Likewise.
	(nexttoward_test): Likewise.
	(pow_test_data): Likewise.
	(pow_test): Likewise.
	(remainder_test_data): Likewise.
	(remainder_test): Likewise.
	(drem_test): Likewise.
	(remquo_test_data): Likewise.
	(remquo_test): Likewise.
	(rint_test_data): Likewise.
	(rint_test): Likewise.
	(round_test_data): Likewise.
	(round_test): Likewise.
	(roundeven_test_data): Likewise.
	(roundeven_test): Likewise.
	(scalb_test_data): Likewise.
	(scalb_test): Likewise.
	(scalbn_test_data): Likewise.
	(scalbn_test): Likewise.
	(ldexp_test): Likewise.
	(scalbln_test_data): Likewise.
	(scalbln_test): Likewise.
	(setpayload_test_data): Likewise.
	(setpayload_test): Likewise.
	(setpayloadsig_test_data): Likewise.
	(setpayloadsig_test): Likewise.
	(signbit_test_data): Likewise.
	(signbit_test): Likewise.
	(sin_test_data): Likewise.
	(sin_test): Likewise.
	(sincos_test_data): Likewise.
	(sincos_test): Likewise.
	(sinh_test_data): Likewise.
	(sinh_test): Likewise.
	(sqrt_test_data): Likewise.
	(sqrt_test): Likewise.
	(tan_test_data): Likewise.
	(tan_test): Likewise.
	(tanh_test_data): Likewise.
	(tanh_test): Likewise.
	(tgamma_test_data): Likewise.
	(tgamma_test): Likewise.
	(totalorder_test_data): Likewise.
	(totalorder_test): Likewise.
	(totalordermag_test_data): Likewise.
	(totalordermag_test): Likewise.
	(trunc_test_data): Likewise.
	(trunc_test): Likewise.
	(ufromfp_test_data): Likewise.
	(ufromfp_test): Likewise.
	(ufromfpx_test_data): Likewise.
	(ufromfpx_test): Likewise.
	(y0_test_data): Likewise.
	(y0_test): Likewise.
	(y1_test_data): Likewise.
	(y1_test): Likewise.
	(yn_test_data): Likewise.
	(yn_test): Likewise.
	(significand_test_data): Likewise.
	(significand_test): Likewise.
	* math/Makefile (auto-libm-test-out-files): Remove variable.
	(libm-test-funcs-noauto): New variable.
	(libm-test-funcs-all): Likewise.
	(libm-test-c-auto): Likewise.
	(libm-test-c-noauto): Likewise.
	(libm-tests-generated): Add $(libm-test-c-auto) and
	$(libm-test-c-noauto).
	(generated): Do not add auto-libm-test-out.
	(libm-test-c-auto-obj): New variable.
	(libm-test-c-noauto-obj): Likewise.
	($(objpfx)libm-test.c): Do not generate or use auto-libm-test-out.
	($(libm-test-c-noauto-obj)): New static pattern rule.
	($(libm-test-c-auto-obj)): Likewise.
	(libm-test-incs): New variable.
	($(objpfx)libm-have-vector-test.h): Depend on $(libm-test-incs)
	and pass it to gen-libm-have-vector-test.sh.
	* math/gen-libm-have-vector-test.sh: Expect list of .inc files to
	be passed on command line.
	* math/libm-test-acos.inc: New file.  Content from
	math/libm-test.inc.
	* math/libm-test-acosh.inc: Likewise.
	* math/libm-test-asin.inc: Likewise.
	* math/libm-test-asinh.inc: Likewise.
	* math/libm-test-atan.inc: Likewise.
	* math/libm-test-atan2.inc: Likewise.
	* math/libm-test-atanh.inc: Likewise.
	* math/libm-test-cabs.inc: Likewise.
	* math/libm-test-cacos.inc: Likewise.
	* math/libm-test-cacosh.inc: Likewise.
	* math/libm-test-canonicalize.inc: Likewise.
	* math/libm-test-carg.inc: Likewise.
	* math/libm-test-casin.inc: Likewise.
	* math/libm-test-casinh.inc: Likewise.
	* math/libm-test-catan.inc: Likewise.
	* math/libm-test-catanh.inc: Likewise.
	* math/libm-test-cbrt.inc: Likewise.
	* math/libm-test-ccos.inc: Likewise.
	* math/libm-test-ccosh.inc: Likewise.
	* math/libm-test-ceil.inc: Likewise.
	* math/libm-test-cexp.inc: Likewise.
	* math/libm-test-cimag.inc: Likewise.
	* math/libm-test-clog.inc: Likewise.
	* math/libm-test-clog10.inc: Likewise.
	* math/libm-test-conj.inc: Likewise.
	* math/libm-test-copysign.inc: Likewise.
	* math/libm-test-cos.inc: Likewise.
	* math/libm-test-cosh.inc: Likewise.
	* math/libm-test-cpow.inc: Likewise.
	* math/libm-test-cproj.inc: Likewise.
	* math/libm-test-creal.inc: Likewise.
	* math/libm-test-csin.inc: Likewise.
	* math/libm-test-csinh.inc: Likewise.
	* math/libm-test-csqrt.inc: Likewise.
	* math/libm-test-ctan.inc: Likewise.
	* math/libm-test-ctanh.inc: Likewise.
	* math/libm-test-erf.inc: Likewise.
	* math/libm-test-erfc.inc: Likewise.
	* math/libm-test-exp.inc: Likewise.
	* math/libm-test-exp10.inc: Likewise.
	* math/libm-test-exp2.inc: Likewise.
	* math/libm-test-expm1.inc: Likewise.
	* math/libm-test-fabs.inc: Likewise.
	* math/libm-test-fdim.inc: Likewise.
	* math/libm-test-floor.inc: Likewise.
	* math/libm-test-fma.inc: Likewise.
	* math/libm-test-fmax.inc: Likewise.
	* math/libm-test-fmaxmag.inc: Likewise.
	* math/libm-test-fmin.inc: Likewise.
	* math/libm-test-fminmag.inc: Likewise.
	* math/libm-test-fmod.inc: Likewise.
	* math/libm-test-fpclassify.inc: Likewise.
	* math/libm-test-frexp.inc: Likewise.
	* math/libm-test-fromfp.inc: Likewise.
	* math/libm-test-fromfpx.inc: Likewise.
	* math/libm-test-getpayload.inc: Likewise.
	* math/libm-test-hypot.inc: Likewise.
	* math/libm-test-ilogb.inc: Likewise.
	* math/libm-test-iscanonical.inc: Likewise.
	* math/libm-test-iseqsig.inc: Likewise.
	* math/libm-test-isfinite.inc: Likewise.
	* math/libm-test-isgreater.inc: Likewise.
	* math/libm-test-isgreaterequal.inc: Likewise.
	* math/libm-test-isinf.inc: Likewise.
	* math/libm-test-isless.inc: Likewise.
	* math/libm-test-islessequal.inc: Likewise.
	* math/libm-test-islessgreater.inc: Likewise.
	* math/libm-test-isnan.inc: Likewise.
	* math/libm-test-isnormal.inc: Likewise.
	* math/libm-test-issignaling.inc: Likewise.
	* math/libm-test-issubnormal.inc: Likewise.
	* math/libm-test-isunordered.inc: Likewise.
	* math/libm-test-iszero.inc: Likewise.
	* math/libm-test-j0.inc: Likewise.
	* math/libm-test-j1.inc: Likewise.
	* math/libm-test-jn.inc: Likewise.
	* math/libm-test-lgamma.inc: Likewise.
	* math/libm-test-llogb.inc: Likewise.
	* math/libm-test-llrint.inc: Likewise.
	* math/libm-test-llround.inc: Likewise.
	* math/libm-test-log.inc: Likewise.
	* math/libm-test-log10.inc: Likewise.
	* math/libm-test-log1p.inc: Likewise.
	* math/libm-test-log2.inc: Likewise.
	* math/libm-test-logb.inc: Likewise.
	* math/libm-test-lrint.inc: Likewise.
	* math/libm-test-lround.inc: Likewise.
	* math/libm-test-modf.inc: Likewise.
	* math/libm-test-nearbyint.inc: Likewise.
	* math/libm-test-nextafter.inc: Likewise.
	* math/libm-test-nextdown.inc: Likewise.
	* math/libm-test-nexttoward.inc: Likewise.
	* math/libm-test-nextup.inc: Likewise.
	* math/libm-test-pow.inc: Likewise.
	* math/libm-test-remainder.inc: Likewise.
	* math/libm-test-remquo.inc: Likewise.
	* math/libm-test-rint.inc: Likewise.
	* math/libm-test-round.inc: Likewise.
	* math/libm-test-roundeven.inc: Likewise.
	* math/libm-test-scalb.inc: Likewise.
	* math/libm-test-scalbln.inc: Likewise.
	* math/libm-test-scalbn.inc: Likewise.
	* math/libm-test-setpayload.inc: Likewise.
	* math/libm-test-setpayloadsig.inc: Likewise.
	* math/libm-test-signbit.inc: Likewise.
	* math/libm-test-significand.inc: Likewise.
	* math/libm-test-sin.inc: Likewise.
	* math/libm-test-sincos.inc: Likewise.
	* math/libm-test-sinh.inc: Likewise.
	* math/libm-test-sqrt.inc: Likewise.
	* math/libm-test-tan.inc: Likewise.
	* math/libm-test-tanh.inc: Likewise.
	* math/libm-test-tgamma.inc: Likewise.
	* math/libm-test-totalorder.inc: Likewise.
	* math/libm-test-totalordermag.inc: Likewise.
	* math/libm-test-trunc.inc: Likewise.
	* math/libm-test-ufromfp.inc: Likewise.
	* math/libm-test-ufromfpx.inc: Likewise.
	* math/libm-test-y0.inc: Likewise.
	* math/libm-test-y1.inc: Likewise.
	* math/libm-test-yn.inc: Likewise.
	* math/README.libm-test: Update.
2017-02-06 18:57:25 +00:00
Joseph Myers 4f1bc131db Split auto-libm-test-out by function.
math/auto-libm-test-out is, at over 30 MB, by far the largest file in
the glibc source tree.  This patch splits it by function, so reducing
it to auto-libm-test-out-<func> files that are all under 5 MB in size.

This is preliminary to splitting up libm-test.inc as well so that each
function's tests can also be processed separately by
gen-libm-test.pl.  As a preliminary patch it doesn't actually
implement that step; rather, all the separate files get concatenated
by the Makefile to produce the monolithic auto-libm-test-out file
again as an input to gen-libm-test.pl.  (The concatentation is
identical to the file in the source tree before this patch.)

Even this preliminary step, however, is of use independent of
splitting up libm-test.inc: some tests for csin and csinh have not
been moved to auto-libm-test-in because they result in
auto-libm-test-out generation taking several minutes rather than a few
seconds (all released MPC versions are very slow for certain sin /
sinh inputs; there are some old improvements in MPC mainline which
should eventually become MPC 1.1, but the complex inverse trig and
hyperbolic functions are slow even in MPC mainline and have yet to be
moved to auto-libm-test-in at all), and it seems much more reasonable
to add such inputs to auto-libm-test-in when it will only slow down
regeneration for particular functions than when it will slow down
regeneration globally.

gen-auto-libm-tests still parses the whole input file, but only
generates output for the requested function.  This ensures bad syntax
in the file is always detected, and parsing the whole file is quick;
it's output generation that is comparatively slow for some functions.

Tested for x86_64.

	* math/gen-auto-libm-tests.c: Update comment about use of program.
	(generate_output): Add argument FUNCTION.
	(main): Require extra argument.  Pass function name to
	generate_output.
	* math/Makefile (generated): Add auto-libm-test-out.
	(libm-test-funcs-auto): New variable.
	(auto-libm-test-out-files): New variable.
	($(objpfx)libm-test.c): Depend on $(auto-libm-test-out-files).
	Concatenate those files to form $(objpfx)auto-libm-test-out and
	use it as input to gen-libm-test.pl.
	* math/README.libm-test: Update.
	* math/auto-libm-test-out: Remove.
	* math/auto-libm-test-out-acos: New generated file.
	* math/auto-libm-test-out-acosh: Likewise.
	* math/auto-libm-test-out-asin: Likewise.
	* math/auto-libm-test-out-asinh: Likewise.
	* math/auto-libm-test-out-atan: Likewise.
	* math/auto-libm-test-out-atan2: Likewise.
	* math/auto-libm-test-out-atanh: Likewise.
	* math/auto-libm-test-out-cabs: Likewise.
	* math/auto-libm-test-out-carg: Likewise.
	* math/auto-libm-test-out-cbrt: Likewise.
	* math/auto-libm-test-out-ccos: Likewise.
	* math/auto-libm-test-out-ccosh: Likewise.
	* math/auto-libm-test-out-cexp: Likewise.
	* math/auto-libm-test-out-clog: Likewise.
	* math/auto-libm-test-out-clog10: Likewise.
	* math/auto-libm-test-out-cos: Likewise.
	* math/auto-libm-test-out-cosh: Likewise.
	* math/auto-libm-test-out-cpow: Likewise.
	* math/auto-libm-test-out-csin: Likewise.
	* math/auto-libm-test-out-csinh: Likewise.
	* math/auto-libm-test-out-csqrt: Likewise.
	* math/auto-libm-test-out-ctan: Likewise.
	* math/auto-libm-test-out-ctanh: Likewise.
	* math/auto-libm-test-out-erf: Likewise.
	* math/auto-libm-test-out-erfc: Likewise.
	* math/auto-libm-test-out-exp: Likewise.
	* math/auto-libm-test-out-exp10: Likewise.
	* math/auto-libm-test-out-exp2: Likewise.
	* math/auto-libm-test-out-expm1: Likewise.
	* math/auto-libm-test-out-fma: Likewise.
	* math/auto-libm-test-out-hypot: Likewise.
	* math/auto-libm-test-out-j0: Likewise.
	* math/auto-libm-test-out-j1: Likewise.
	* math/auto-libm-test-out-jn: Likewise.
	* math/auto-libm-test-out-lgamma: Likewise.
	* math/auto-libm-test-out-log: Likewise.
	* math/auto-libm-test-out-log10: Likewise.
	* math/auto-libm-test-out-log1p: Likewise.
	* math/auto-libm-test-out-log2: Likewise.
	* math/auto-libm-test-out-pow: Likewise.
	* math/auto-libm-test-out-sin: Likewise.
	* math/auto-libm-test-out-sincos: Likewise.
	* math/auto-libm-test-out-sinh: Likewise.
	* math/auto-libm-test-out-sqrt: Likewise.
	* math/auto-libm-test-out-tan: Likewise.
	* math/auto-libm-test-out-tanh: Likewise.
	* math/auto-libm-test-out-tgamma: Likewise.
	* math/auto-libm-test-out-y0: Likewise.
	* math/auto-libm-test-out-y1: Likewise.
	* math/auto-libm-test-out-yn: Likewise.
2017-02-06 18:41:20 +00:00
Joseph Myers 5cd81881e2 Eliminate libm-test.stmp.
math/Makefile uses libm-test.stmp to handle dependencies involving
multiple generated files all generated by a single sequence of
commands in a single Makefile rule.

Having separated the libm-test-ulps.h and libm-test.c generation into
separate runs of gen-libm-test.pl, there is now no need for a single
rule to generate multiple target files; each of the three target files
involved can be generated by a separate Makefile rule, meaning normal
dependencies on the individual files can be used and so libm-test.stmp
is not needed at all.  This patch does just that, eliminating the
.stmp file, in further preparation for when there are many separate
libm-test-<func>.c files generated from libm-test-<func>.inc and the
dependencies are on just the relevant .c file in each case.

Tested for x86_64.

	* math/Makefile (generated): Do not include libm-test.stmp.
	($(addprefix $(objpfx), $(libm-tests-generated))): Do not depend
	on $(objpfx)libm-test.stmp.
	($(objpfx)libm-test.stmp): Remove rule.
	($(objpfx)libm-test-ulps.h): New rule.
	($(objpfx)libm-test.c): Likewise.
	($(objpfx)libm-have-vector-test.h): Likewise.
	($(addprefix $(objpfx), $(libm-tests.o)): Depend directly on
	individual generated files, not libm-test.stmp.
2017-02-06 18:28:33 +00:00
Joseph Myers 7e1e68b45c Rework gen-libm-test.pl input/output handling.
This patch reworks how input and output files are specified for
gen-libm-test.pl.

Previously, the script had names of various inputs and outputs
hardcoded, with a -o option to specify an output directory.  This
patch replaces this with all inputs and outputs being specified
explicitly as the arguments of options passed to the script.  Outputs
are only generated if the relevant option is passed, and only the
processing required for the indicated outputs is done.  The Makefile
is made to pass options for generating libm-test-ulps.h in a separate
invocation of gen-libm-test.pl from that generating libm-test.c.

This is all in preparation for splitting up libm-test.inc and
auto-libm-test-out and running tests separately for each function,
when gen-libm-test.pl will be run separately for each function to
generate the .c file but only once to generate libm-test-ulps.h (and
those runs will be able to be in parallel).

Tested for x86_64.  The generated libm-test.c and libm-test-ulps.h are
identical before and after the patch.  Also tested the "make
regen-ulps" case.

	* math/gen-libm-test.pl ($output_dir): Remove variable.
	($srcdir): Likewise.
	($opt_a): New variable.
	($opt_c): Likewise.
	($opt_C): Likewise.
	($opt_H): Likewise.
	(-n): Make option take argument and use it as NewUlps output.
	(-a): New option.  Use its argument for auto-libm-test-out input.
	(-c): New option.  Use its argument for libm-test.inc input.
	(-C): New option.  Use its argument for libm-test.c output.
	(-H): New option.  Use its argument for libm-test-ulps.h output.
	(top level): Only process inputs needed to generate outputs
	specified by command-line options.  Only generate outputs
	specified by command-line options.
	* math/README.libm-test: Update example gen-libm-test.pl command.
	* math/Makefile ($(objpfx)libm-test.stmp): Update gen-libm-test.pl
	commands.
	(regen-ulps): Likewise.
2017-02-06 18:21:06 +00:00
Joseph Myers 5a68e857bf Move non-function-specific parts of libm-test.inc to separate file.
libm-test.inc contains both test infrastructure and tests of
individual functions.

This patch moves the infrastructure to a separate file
libm-test-driver.c.  This is in preparation for splitting the tests of
individual functions into separate source files, which will be
processed individually by gen-libm-test.pl (so e.g. libm-test-acos.inc
and auto-libm-test-out-acos will be processed by gen-libm-test.pl to
produce libm-test-acos.c, and files such as test-double-acos.c will be
generated by the Makefile to include appropriate headers,
libm-test-driver.c and libm-test-acos.c so tests of each function get
run separately).

It is no doubt possible to split things up further, so that functions
not depending on the type being tested only get compiled once and most
of those depending on the type being tested get compiled once per type
(rather than separately for variants such as inline / no-inline, and
separately for each function being tested after that split), but this
rearrangement as-is seems a useful incremental step towards splitting
these tests by function.

	* math/libm-test-driver.c: New file.  Based on math/libm-test.inc.
	* math/libm-test.inc: Move all contents, other than tests of
	individual functions, to libm-test-driver.c.
	[!FE_TONEAREST] (FE_TONEAREST): Move to libm-test-driver.c.
	[!FE_TOWARDZERO] (FE_TOWARDZERO): Likewise.
	[!FE_UPWARD] (FE_UPWARD): Likewise.
	[!FE_DOWNWARD] (FE_DOWNWARD): Likewise.
	(NO_EXCEPTION): Likewise.
	(INVALID_EXCEPTION): Likewise.
	(DIVIDE_BY_ZERO_EXCEPTION): Likewise.
	(OVERFLOW_EXCEPTION): Likewise.
	(UNDERFLOW_EXCEPTION): Likewise.
	(INEXACT_EXCEPTION): Likewise.
	(INVALID_EXCEPTION_OK): Likewise.
	(DIVIDE_BY_ZERO_EXCEPTION_OK): Likewise.
	(OVERFLOW_EXCEPTION_OK): Likewise.
	(UNDERFLOW_EXCEPTION_OK): Likewise.
	(NO_INEXACT_EXCEPTION): Likewise.
	(EXCEPTIONS_OK): Likewise.
	(IGNORE_ZERO_INF_SIGN): Likewise.
	(TEST_NAN_SIGN): Likewise.
	(TEST_NAN_PAYLOAD): Likewise.
	(NO_TEST_INLINE): Likewise.
	(XFAIL_TEST): Likewise.
	(ERRNO_UNCHANGED): Likewise.
	(ERRNO_EDOM): Likewise.
	(ERRNO_ERANGE): Likewise.
	(IGNORE_RESULT): Likewise.
	(NON_FINITE): Likewise.
	(TEST_SNAN): Likewise.
	(NO_TEST_MATHVEC): Likewise.
	(TEST_NAN_PAYLOAD_CANONICALIZE): Likewise.
	(__CONCATX): Likewise.
	(TYPE_MIN): Likewise.
	(TYPE_TRUE_MIN): Likewise.
	(TYPE_MAX): Likewise.
	(MIN_EXP): Likewise.
	(MAX_EXP): Likewise.
	(MANT_DIG): Likewise.
	(FSTR_MAX): Likewise.
	(ULP_IDX): Likewise.
	(QTYPE_STR): Likewise.
	(TEST_COND_binary32): Likewise.
	(TEST_COND_binary64): Likewise.
	(TEST_COND_binary128): Likewise.
	(TEST_COND_ibm128): Likewise.
	(TEST_COND_intel96): Likewise.
	(TEST_COND_m68k96): Likewise.
	(TEST_COND_ibm128_libgcc): Likewise.
	(XFAIL_IBM128_LIBGCC): Likewise.
	(PAYLOAD_DIG): Likewise.
	(UNDERFLOW_EXCEPTION_FLOAT): Likewise.
	(UNDERFLOW_EXCEPTION_OK_FLOAT): Likewise.
	(UNDERFLOW_EXCEPTION_DOUBLE): Likewise.
	(UNDERFLOW_EXCEPTION_OK_DOUBLE): Likewise.
	(UNDERFLOW_EXCEPTION_LDOUBLE_IBM): Likewise.
	(UNDERFLOW_EXCEPTION_BEFORE_ROUNDING): Likewise.
	(TEST_COND_long32): Likewise.
	(TEST_COND_long64): Likewise.
	(TEST_COND_before_rounding): Likewise.
	(TEST_COND_after_rounding): Likewise.
	(lit_pi_3_m_4_d): Likewise.
	(lit_pi_3_m_4_ln10_m_d): Likewise.
	(lit_pi_2_ln10_m_d): Likewise.
	(lit_pi_4_ln10_m_d): Likewise.
	(lit_pi_ln10_d): Likewise.
	(lit_pi_2_d): Likewise.
	(lit_pi_4_d): Likewise.
	(lit_pi): Likewise.
	(lit_e): Likewise.
	(ulps_file_name): Likewise.
	(ulps_file): Likewise.
	(output_ulps): Likewise.
	(output_dir): Likewise.
	(noErrors): Likewise.
	(noTests): Likewise.
	(noExcTests): Likewise.
	(noErrnoTests): Likewise.
	(verbose): Likewise.
	(output_max_error): Likewise.
	(output_points): Likewise.
	(ignore_max_ulp): Likewise.
	(plus_zero): Likewise.
	(minus_zero): Likewise.
	(plus_infty): Likewise.
	(minus_infty): Likewise.
	(qnan_value_pl): Likewise.
	(qnan_value): Likewise.
	(snan_value_pl): Likewise.
	(snan_value): Likewise.
	(max_value): Likewise.
	(min_value): Likewise.
	(min_subnorm_value): Likewise.
	(snan_value_ld): Likewise.
	(max_error): Likewise.
	(real_max_error): Likewise.
	(imag_max_error): Likewise.
	(prev_max_error): Likewise.
	(prev_real_max_error): Likewise.
	(prev_imag_max_error): Likewise.
	(max_valid_error): Likewise.
	(TYPE_DECIMAL_DIG): Likewise.
	(TYPE_HEX_DIG): Likewise.
	(fmt_ftostr): Likewise.
	(compare_ulp_data): Likewise.
	(find_ulps): Likewise.
	(init_max_error): Likewise.
	(set_max_error): Likewise.
	(print_float): Likewise.
	(print_screen): Likewise.
	(print_screen_max_error): Likewise.
	(update_stats): Likewise.
	(print_function_ulps): Likewise.
	(print_complex_function_ulps): Likewise.
	(fpstack_test): Likewise.
	(print_max_error): Likewise.
	(print_complex_max_error): Likewise.
	(test_single_exception): Likewise.
	(test_exceptions): Likewise.
	(test_single_errno): Likewise.
	(test_errno): Likewise.
	(ULPDIFF): Likewise.
	(ulp): Likewise.
	(check_float_internal): Likewise.
	(check_float): Likewise.
	(check_complex): Likewise.
	(check_int): Likewise.
	(check_long): Likewise.
	(check_bool): Likewise.
	(check_longlong): Likewise.
	(check_intmax_t): Likewise.
	(check_uintmax_t): Likewise.
	(enable_test): Likewise.
	(struct test_f_f_data): Likewise.
	(struct test_ff_f_data): Likewise.
	(struct test_fj_f_data): Likewise.
	(struct test_fi_f_data): Likewise.
	(struct test_fl_f_data): Likewise.
	(struct test_if_f_data): Likewise.
	(struct test_fff_f_data): Likewise.
	(struct test_fiu_M_data): Likewise.
	(struct test_fiu_U_data): Likewise.
	(struct test_c_f_data): Likewise.
	(struct test_f_f1_data): Likewise.
	(struct test_fF_f1_data): Likewise.
	(struct test_ffI_f1_data): Likewise.
	(struct test_c_c_data): Likewise.
	(struct test_cc_c_data): Likewise.
	(struct test_f_i_data): Likewise.
	(struct test_ff_i_data): Likewise.
	(struct test_f_l_data): Likewise.
	(struct test_f_L_data): Likewise.
	(struct test_fFF_11_data): Likewise.
	(struct test_Ff_b1_data): Likewise.
	(IF_ROUND_INIT_): Likewise.
	(IF_ROUND_INIT_FE_DOWNWARD): Likewise.
	(IF_ROUND_INIT_FE_TONEAREST): Likewise.
	(IF_ROUND_INIT_FE_TOWARDZERO): Likewise.
	(IF_ROUND_INIT_FE_UPWARD): Likewise.
	(ROUND_RESTORE_): Likewise.
	(ROUND_RESTORE_FE_DOWNWARD): Likewise.
	(ROUND_RESTORE_FE_TONEAREST): Likewise.
	(ROUND_RESTORE_FE_TOWARDZERO): Likewise.
	(ROUND_RESTORE_FE_UPWARD): Likewise.
	(RM_): Likewise.
	(RM_FE_DOWNWARD): Likewise.
	(RM_FE_TONEAREST): Likewise.
	(RM_FE_TOWARDZERO): Likewise.
	(RM_FE_UPWARD): Likewise.
	(COMMON_TEST_SETUP): Likewise.
	(EXTRA_OUTPUT_TEST_SETUP): Likewise.
	(COMMON_TEST_CLEANUP): Likewise.
	(EXTRA_OUTPUT_TEST_CLEANUP): Likewise.
	(RUN_TEST_f_f): Likewise.
	(RUN_TEST_LOOP_f_f): Likewise.
	(RUN_TEST_fp_f): Likewise.
	(RUN_TEST_LOOP_fp_f): Likewise.
	(RUN_TEST_2_f): Likewise.
	(RUN_TEST_LOOP_2_f): Likewise.
	(RUN_TEST_ff_f): Likewise.
	(RUN_TEST_LOOP_ff_f): Likewise.
	(RUN_TEST_LOOP_fj_f): Likewise.
	(RUN_TEST_fi_f): Likewise.
	(RUN_TEST_LOOP_fi_f): Likewise.
	(RUN_TEST_fl_f): Likewise.
	(RUN_TEST_LOOP_fl_f): Likewise.
	(RUN_TEST_if_f): Likewise.
	(RUN_TEST_LOOP_if_f): Likewise.
	(RUN_TEST_fff_f): Likewise.
	(RUN_TEST_LOOP_fff_f): Likewise.
	(RUN_TEST_fiu_M): Likewise.
	(RUN_TEST_LOOP_fiu_M): Likewise.
	(RUN_TEST_fiu_U): Likewise.
	(RUN_TEST_LOOP_fiu_U): Likewise.
	(RUN_TEST_c_f): Likewise.
	(RUN_TEST_LOOP_c_f): Likewise.
	(RUN_TEST_f_f1): Likewise.
	(RUN_TEST_LOOP_f_f1): Likewise.
	(RUN_TEST_fF_f1): Likewise.
	(RUN_TEST_LOOP_fF_f1): Likewise.
	(RUN_TEST_fI_f1): Likewise.
	(RUN_TEST_LOOP_fI_f1): Likewise.
	(RUN_TEST_ffI_f1_mod8): Likewise.
	(RUN_TEST_LOOP_ffI_f1_mod8): Likewise.
	(RUN_TEST_Ff_b1): Likewise.
	(RUN_TEST_LOOP_Ff_b1): Likewise.
	(RUN_TEST_Ffp_b1): Likewise.
	(RUN_TEST_LOOP_Ffp_b1): Likewise.
	(RUN_TEST_c_c): Likewise.
	(RUN_TEST_LOOP_c_c): Likewise.
	(RUN_TEST_cc_c): Likewise.
	(RUN_TEST_LOOP_cc_c): Likewise.
	(RUN_TEST_f_i): Likewise.
	(RUN_TEST_LOOP_f_i): Likewise.
	(RUN_TEST_f_i_tg): Likewise.
	(RUN_TEST_LOOP_f_i_tg): Likewise.
	(RUN_TEST_ff_b): Likewise.
	(RUN_TEST_LOOP_ff_b): Likewise.
	(RUN_TEST_ff_i_tg): Likewise.
	(RUN_TEST_LOOP_ff_i_tg): Likewise.
	(RUN_TEST_f_b): Likewise.
	(RUN_TEST_LOOP_f_b): Likewise.
	(RUN_TEST_f_b_tg): Likewise.
	(RUN_TEST_LOOP_f_b_tg): Likewise.
	(RUN_TEST_f_l): Likewise.
	(RUN_TEST_LOOP_f_l): Likewise.
	(RUN_TEST_f_L): Likewise.
	(RUN_TEST_LOOP_f_L): Likewise.
	(RUN_TEST_fFF_11): Likewise.
	(RUN_TEST_LOOP_fFF_11): Likewise.
	(VEC_SUFF): Likewise.
	(STR_CONCAT): Likewise.
	(STR_CON3): Likewise.
	(HAVE_VECTOR): Likewise.
	(START): Likewise.
	(END): Likewise.
	(END_COMPLEX): Likewise.
	(ALL_RM_TEST): Likewise.
	(matherr): Likewise.
	(initialize): Likewise.
	(options): Likewise.
	(doc): Likewise.
	(parse_opt): Likewise.
	(argp): Likewise.
	(check_ulp): Likewise.
	(main): Likewise.
	(do_test): New function.  Call tests of individual functions
	previously called from main.
2017-02-06 18:12:16 +00:00
Joseph Myers dd18757bd3 Remove libm-test.inc comment listing functions tested and not tested.
math/libm-test.inc has a comment listing the functions tested and not
tested.  The list of functions tested duplicates what is immediately
obvious from the rest of the file and adds another place to update
when adding a function.  I've put the information about functions not
tested on the wiki todo list; this patch removes that comment, in
preparation for splitting tests of each function into separate .inc
files with common code staying in a separate .c file.

Tested for x86_64.

	* math/libm-test.inc: Remove comment listing functions tested and
	not tested.
2017-02-06 18:04:10 +00:00
Joseph Myers 95b2e07faf Remove before-compile setting in math/Makefile.
In <https://sourceware.org/ml/libc-alpha/2015-12/msg00543.html>,
Florian noted highly parallel builds being slowed down by
gen-libm-test.pl running during the build, when it should only run for
testing, not for building glibc itself.

This is a consequence of libm-test.c being listed in before-compile.
That listing in before-compile arose from the error reported in
<https://sourceware.org/ml/libc-hacker/1999-10/msg00054.html> when
building dependencies: at that time, dependencies were generated
separation from compilation, so if a source file included a generated
file it wasn't enough for the dependencies for the .o file to be
correct, the generated file needed to be listed in before-compile.

Since <https://sourceware.org/ml/libc-hacker/2003-05/msg00001.html>,
dependencies are generated as a side-effect of compilation.  This
means that having the right dependencies for the .o files for the
tests fully suffices to ensure that libm-test.c is generated by the
time it's needed; no entry in before-compile is needed.  And we indeed
have such a dependency for all the tests using libm-test.c:

$(addprefix $(objpfx), $(libm-tests.o)): $(objpfx)libm-test.stmp

Thus, the before-compile definition is unnecessary, and this patch
removes it.  (This may of course move serialization from the glibc
build to glibc testing, but I intend to split up libm-test.inc so that
tests for each (floating-point type, libm function) pair are built and
run separately, which should reduce that serialization.)

Tested for x86_64.

	* math/Makefile (before-compile): Remove.
2017-02-06 17:48:02 +00:00
Joseph Myers 76475eae8f Update README.libm-test.
This patch updates math/README.libm-test to have a more complete and
up-to-date list of the characters used in TEST_* macros to indicate
the types of function inputs and outputs.

	* math/README.libm-test: Update list of characters for input and
	output types.
2017-01-20 23:25:13 +00:00
Joseph Myers 4dfb9c9411 Make fallback fegetexceptflag work with generic fetestexceptflag.
The generic implementation of fetestexceptflag does:

int
fetestexceptflag (const fexcept_t *flagp, int excepts)
{
  /* Most versions of fegetexceptflag store exceptions in a form such
     that this works.  */
  return *flagp & excepts & FE_ALL_EXCEPT;
}

In the case where FE_ALL_EXCEPT is nonzero but exceptions may not be
supported at runtime, this only works if fegetexceptflag cleared all
the bits of FE_ALL_EXCEPT in *flagp; otherwise it accesses
uninitialized data.  This showed up as a failure of
math/test-fetestexceptflag for MIPS o32 soft-float.  This patch makes
the fallback fegetexceptflag store 0 (fexcept_t is an integer type
everywhere) so that this works.  (No bug report in Bugzilla because
this wasn't user-visible - at least, without using tools to detect
uninitialized memory use at runtime - without fetestexceptflag, which
is new in 2.25.)

Tested for MIPS o32 soft-float.

	* math/fgetexcptflg.c (__fegetexceptflag): Store 0 in fexcept_t
	object.
2017-01-12 01:52:37 +00:00
Joseph Myers fbb31e20bc XFAIL libm-test.inc tests as needed for ibm128.
This patch arranges for various libm-test.inc tests to be XFAILed for
ibm128-libgcc in non-default rounding modes.  The tests are marked
with XFAIL_ROUNDING_IBM128_LIBGCC and gen-libm-test.pl is made to
transform that to XFAIL_IBM128_LIBGCC or 0 depending on the rounding
mode.

This should allow test-ldouble, test-ildouble and test-ldouble-finite
to pass with unmodified libgcc, given an ulps regeneration.  (The case
of patched libgcc was already clean up to ulps and possibly hypot
cases very close to the overflow threshold that may need more
XFAILing; patched libgcc, which should work with
TEST_COND_ibm128_libgcc defined to 0 to disable all these XFAILs, does
need slightly different ulps from unpatched.)  Note that soft-float
powerpc will still fail because of
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64811> resulting in
spurious "invalid" exceptions in the libgcc code (for hard float,
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58684> hides that bug).

Tested for powerpc.

	* math/libm-test.inc (XFAIL_IBM128_LIBGCC): New macro.
	(fdim_test_data): Use XFAIL_ROUNDING_IBM128_LIBGCC for some tests.
	(fma_test_data): Likewise.
	(hypot_test_data): Likewise.
	(log1p_test_data): Likewise.
	(modf_test_data): Likewise.
	(pow_test_data): Likewise.
	(remainder_test_data): Likewise.
	(remquo_test_data): Likewise.
	(scalb_test_data): Likewise.
	(scalbn_test_data): Likewise.
	(scalbln_test_data): Likewise.
	* math/gen-libm-test.pl (parse_args): Transform
	XFAIL_ROUNDING_IBM128_LIBGCC to XFAIL_IBM128_LIBGCC or 0 depending
	on the rounding mode.
2017-01-10 00:14:09 +00:00
Joseph Myers 08f7b95dbd Improve libm-test XFAILing for ibm128-libgcc.
This patch further improves XFAILing for ibm128-libgcc of tests in
auto-libm-test-*.

The bulk of the cases needing XFAILing are
xfail-rounding:ibm128-libgcc used for inputs where (possibly after
rounding the inputs to another floating-point type) the result
overflows (and the result in non-default rounding modes may be wildly
wrong with unpatched libgcc) or underflows near 0 (and the result in
non-default rounding modes may end up having the wrong sign).  This
patch makes gen-auto-libm-tests detect such cases and apply
xfail-rounding:ibm128-libgcc automatically to them, so most of the
manual XFAILs in auto-libm-test-in are no longer needed (some are
still needed if e.g. the result is very close to overflow, resulting
in an internal overflow in libgcc in some rounding modes).  A few
manual XFAILs are added for cases not covered by this
gen-auto-libm-tests change, and a few existing such XFAILs are left
in.

Tested for powerpc.

	* math/gen-auto-libm-tests.c (output_for_one_input_case): Apply
	xfail-rounding:ibm128-libgcc automatically to tests overflowing
	and those that can underflow to zero.
	* math/auto-libm-test-in: Remove most XFAILs for ibm128-libgcc and
	add others.
	* math/auto-libm-test-out: Regenerated.
2017-01-09 22:40:59 +00:00
Joseph Myers c6be839efd Fix math/test-fenv for no-exceptions / no-rounding-modes configurations.
This patch fixes math/test-fenv.c to check EXCEPTION_TESTS and
ROUNDING_TESTS to avoid failing in cases where some exceptions or
rounding modes are defined but not supported at runtime.

Tested for mips64 soft float and for x86_64.

	* math/test-fenv.c (fe_tests): Skip most tests when exceptions not
	supported.
	(feholdexcept_tests): Skip tests requiring exceptions or rounding
	modes support if not supported.
2017-01-09 18:27:49 +00:00
Joseph Myers f68fcd95d3 Make fallback fesetexceptflag always succeed (bug 21028).
The fallback implementation of fesetexceptflag currently fails if any
exceptions are specified.  It should always succeed, because the
exception state is always that all exceptions (if any are defined in
<fenv.h> but not supported in this configuration) are always clear,
just as fallback fetestexcept always succeeds and fallback fesetenv
always succeeds unless asked to set FE_NOMASK_ENV.

This patch fixes it accordingly.  Together with the patch to
test-fexcept.c to allow feraiseexcept to fail in another place, this
stops that test from failing for MIPS soft-float.

Tested for mips64 soft-float.

	[BZ #21028]
	* math/fsetexcptflg.c (__fesetexceptflag): Always return 0.
	* math/test-fexcept.c (test_set): Allow failure of feraiseexcept
	if EXCEPTION_TESTS returns false.
2017-01-05 23:15:47 +00:00
Joseph Myers 179b86750c Update libm-test XFAILs for ibm128 format.
This patch cleans up and updates the libm-test XFAILs for the ibm128
format.  More of them are changed to use a new ibm128-libgcc
conditional, to reflect that they are not in fact needed if you've
patched libgcc to fix the known issues (at substantial performance
cost).  Many additional XFAILs are added for tests that fail with
unpatched libgcc (most but not all of them xfail-rounding).

Note that further such fixes will be needed for test-ldouble actually
to pass with default libgcc (in particular, XFAILs for pow tests and
for various affected tests directly embedded in libm-test.inc).  With
patched libgcc, there may be a few XFAILs needed but the results are
already substantially clean apart from a few ulps differences.

Tested for powerpc.

	* math/libm-test.inc (TEST_COND_ibm128_libgcc): New macro.
	(init_max_error) [TEST_COND_ibm128]: Increase maximum error
	allowed to 16 ulps.
	* math/auto-libm-test-in: Change most XFAILs for ibm128 to use
	ibm128-libgcc.  XFAIL more tests for ibm128-libgcc.
	* math/auto-libm-test-out: Regenerated.
2017-01-04 23:29:42 +00:00