]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Use C11 CMPLX* macros in libm tests.
authorJoseph Myers <joseph@codesourcery.com>
Wed, 28 Oct 2015 21:57:10 +0000 (21:57 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 28 Oct 2015 21:57:10 +0000 (21:57 +0000)
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.

ChangeLog
math/libm-test.inc
math/test-double.h
math/test-float.h
math/test-ldouble.h

index 1feefafa5a277abc28eb9d5572f76868a3082653..52cd9f397718fb4e770e6699ae77ffb149a38f46 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2015-10-28  Joseph Myers  <joseph@codesourcery.com>
 
+       * 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.
+
        * math/libm-test.inc (min_subnorm_value): Use LDBL_TRUE_MIN,
        DBL_TRUE_MIN and FLT_TRUE_MIN instead of __LDBL_DENORM_MIN__,
        __DBL_DENORM_MIN__ and __FLT_DENORM_MIN__.
index 631b2055035c05c3c17bf0e75d57a5297912bd99..17edcfaa05eb4477a73e5a46aac6488e14b4eb02 100644 (file)
@@ -328,12 +328,6 @@ static FLOAT prev_max_error, prev_real_max_error, prev_imag_max_error;
 
 static FLOAT max_valid_error;
 
-#define BUILD_COMPLEX(real, imag) \
-  ({ __complex__ FLOAT __retval;                                             \
-     __real__ __retval = (real);                                             \
-     __imag__ __retval = (imag);                                             \
-     __retval; })
-
 #define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1),  \
                         (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
 #define MIN_EXP CHOOSE ((LDBL_MIN_EXP-1), (DBL_MIN_EXP-1), (FLT_MIN_EXP-1),    \
index 3f2c0082a2f9d73bde3a60889e29067d47be4848..0038acf89b587e0081e24b368a14f8cb2c5d2ead 100644 (file)
@@ -22,3 +22,4 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_DOUBLE 1
+#define BUILD_COMPLEX(real, imag) (CMPLX ((real), (imag)))
index 7b00cb12160d65332ee9e08b63381422b8ef4c43..8bdba5544d385067d281acd3a742d862b61e6dde 100644 (file)
@@ -22,3 +22,4 @@
 #define PRINTF_XEXPR "a"
 #define PRINTF_NEXPR "f"
 #define TEST_FLOAT 1
+#define BUILD_COMPLEX(real, imag) (CMPLXF ((real), (imag)))
index e42b2bd2f2f5b590da6114f2c3516f055837a464..4f0858c4cb254176bec3dfe9a9378437d18f0a12 100644 (file)
@@ -22,3 +22,4 @@
 #define PRINTF_XEXPR "La"
 #define PRINTF_NEXPR "Lf"
 #define TEST_LDOUBLE 1
+#define BUILD_COMPLEX(real, imag) (CMPLXL ((real), (imag)))