|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
libm-test.inc has a macro BUILD_COMPLEX to construct a complex number
with given real and imaginary parts while allowing properly for signed
zeroes, infinities and NaNs (which don't work properly with a simple
real + I * imag, in the absence of compiler support for imaginary
types), using assignment to __real__ and __imag__ parts of the number.
C11 defines CMPLX* macros for this purpose, which GCC 4.7 and above
provide suitable built-in functions for. This patch redefines
BUILD_COMPLEX in terms of the standard macros.
Tested for x86_64 and x86.
* math/libm-test.inc (BUILD_COMPLEX): Remove macro.
* math/test-double.h (BUILD_COMPLEX): New macro.
* math/test-float.h (BUILD_COMPLEX): Likewise.
* math/test-ldouble.h (BUILD_COMPLEX): Likewise.
|
|
This patch refactors the libm tests using libm-test.inc to reduce the
level of duplicate definitions. New headers are created for the
definitions shared by tests for a particular type; by tests of inline
functions; by tests of non-inline functions; by scalar tests; and by
vector tests. The unused MATHCONST macro is removed. A new macro
VEC_LEN is added to the vector headers to allow the macros defining
wrappers for vector functions to be defined once, instead of six times
each (differing only in vector length) as before. There is still
scope for further refactoring, but this seems a useful start.
Tested for x86_64.
* math/test-double.h: New file.
* math/test-float.h: Likewise.
* math/test-ldouble.h: Likewise.
* math/test-math-inline.h: Likewise.
* math/test-math-no-inline.h: Likewise.
* math/test-math-scalar.h: Likewise.
* math/test-math-vector.h: Likewise.
* math/test-vec-loop.h: Remove file. Contents moved into
test-math-vector.h.
* math/libm-test.inc (MATHCONST): Do not document macro.
* math/test-double.c: Include test-double.h, test-math-no-inline.h
and test-math-scalar.h.
(FUNC): Remove macro.
(FUNC_TEST): Likewise.
(FLOAT): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_DOUBLE): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
* math/test-float.c: Include test-float.h, test-math-no-inline.h
and test-math-scalar.h.
(FUNC): Remove macro.
(FUNC_TEST): Likewise.
(FLOAT): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_FLOAT): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
* math/test-idouble.c: Include test-double.h, test-math-inline.h
and test-math-scalar.h.
(FUNC): Remove macro.
(FUNC_TEST): Likewise.
(FLOAT): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_DOUBLE): Likewise.
(TEST_MATHVEC): Likewise.
(TEST_INLINE): Likewise.
(__NO_MATH_INLINES): Likewise.
* math/test-ifloat.c: Include test-float.h, test-math-inline.h and
test-math-scalar.h.
(FUNC): Remove macro.
(FUNC_TEST): Likewise.
(FLOAT): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_FLOAT): Likewise.
(TEST_MATHVEC): Likewise.
(TEST_INLINE): Likewise.
(__NO_MATH_INLINES): Likewise.
* math/test-ildoubl.c: Include test-ldouble.h, test-math-inline.h
and test-math-scalar.h.
(FUNC): Remove macro.
(FUNC_TEST): Likewise.
(FLOAT): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_LDOUBLE): Likewise.
(TEST_MATHVEC): Likewise.
(TEST_INLINE): Likewise.
(__NO_MATH_INLINES): Likewise.
* math/test-ldouble.c: Include test-ldouble.h,
test-math-no-inline.h and test-math-scalar.h.
(FUNC): Remove macro.
(FUNC_TEST): Likewise.
(FLOAT): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_LDOUBLE): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
* math/test-double-vlen2.h: Include test-double.h,
test-math-no-inline.h and test-math-vector.h.
(FLOAT): Remove macro.
(FUNC): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_DOUBLE): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
(CNCT): Likewise.
(CONCAT): Likewise.
(WRAPPER_NAME): Likewise.
(WRAPPER_DECL): Likewise.
(WRAPPER_DECL_ff): Likewise.
(WRAPPER_DECL_fFF): Likewise.
(VECTOR_WRAPPER): Likewise.
(VECTOR_WRAPPER_ff): Likewise.
(VECTOR_WRAPPER_fFF): Likewise.
(VEC_LEN): New macro.
* math/test-double-vlen4.h: Include test-double.h,
test-math-no-inline.h and test-math-vector.h.
(FLOAT): Remove macro.
(FUNC): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_DOUBLE): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
(CNCT): Likewise.
(CONCAT): Likewise.
(WRAPPER_NAME): Likewise.
(WRAPPER_DECL): Likewise.
(WRAPPER_DECL_ff): Likewise.
(WRAPPER_DECL_fFF): Likewise.
(VECTOR_WRAPPER): Likewise.
(VECTOR_WRAPPER_ff): Likewise.
(VECTOR_WRAPPER_fFF): Likewise.
(VEC_LEN): New macro.
* math/test-double-vlen8.h: Include test-double.h,
test-math-no-inline.h and test-math-vector.h.
(FLOAT): Remove macro.
(FUNC): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_DOUBLE): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
(CNCT): Likewise.
(CONCAT): Likewise.
(WRAPPER_NAME): Likewise.
(WRAPPER_DECL): Likewise.
(WRAPPER_DECL_ff): Likewise.
(WRAPPER_DECL_fFF): Likewise.
(VECTOR_WRAPPER): Likewise.
(VECTOR_WRAPPER_ff): Likewise.
(VECTOR_WRAPPER_fFF): Likewise.
(VEC_LEN): New macro.
* math/test-float-vlen4.h: Include test-float.h,
test-math-no-inline.h and test-math-vector.h.
(FLOAT): Remove macro.
(FUNC): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_FLOAT): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
(CNCT): Likewise.
(CONCAT): Likewise.
(WRAPPER_NAME): Likewise.
(WRAPPER_DECL): Likewise.
(WRAPPER_DECL_ff): Likewise.
(WRAPPER_DECL_fFF): Likewise.
(VECTOR_WRAPPER): Likewise.
(VECTOR_WRAPPER_ff): Likewise.
(VECTOR_WRAPPER_fFF): Likewise.
(VEC_LEN): New macro.
* math/test-float-vlen8.h: Include test-float.h,
test-math-no-inline.h and test-math-vector.h.
(FLOAT): Remove macro.
(FUNC): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_FLOAT): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
(CNCT): Likewise.
(CONCAT): Likewise.
(WRAPPER_NAME): Likewise.
(WRAPPER_DECL): Likewise.
(WRAPPER_DECL_ff): Likewise.
(WRAPPER_DECL_fFF): Likewise.
(VECTOR_WRAPPER): Likewise.
(VECTOR_WRAPPER_ff): Likewise.
(VECTOR_WRAPPER_fFF): Likewise.
(VEC_LEN): New macro.
* math/test-float-vlen16.h: Include test-float.h,
test-math-no-inline.h and test-math-vector.h.
(FLOAT): Remove macro.
(FUNC): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_FLOAT): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
(CNCT): Likewise.
(CONCAT): Likewise.
(WRAPPER_NAME): Likewise.
(WRAPPER_DECL): Likewise.
(WRAPPER_DECL_ff): Likewise.
(WRAPPER_DECL_fFF): Likewise.
(VECTOR_WRAPPER): Likewise.
(VECTOR_WRAPPER_ff): Likewise.
(VECTOR_WRAPPER_fFF): Likewise.
(VEC_LEN): New macro.
* sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c: Do not include
test-vec-loop.h.
* sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c: Likewise.
* sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c: Likewise.
* sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c: Likewise.
* sysdeps/x86_64/fpu/test-float-vlen4-wrappers.c: Likewise.
* sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c: Likewise.
* sysdeps/x86_64/fpu/test-float-vlen8-avx2-wrappers.c: Likewise.
* sysdeps/x86_64/fpu/test-float-vlen16-wrappers.c: Likewise.
|