From 614d15f9324a871cc742a8952a3117c57831a3c5 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 28 Jun 2017 17:53:46 +0000 Subject: Support _Float128 in tgmath.h. This patch adds tgmath.h support for _Float128, so eliminating the awkward caveat in NEWS about the type not being supported there. This does inevitably increase the size of macro expansions (which grows particularly fast when you have nested calls to tgmath.h macros), but only when _Float128 is supported and the declarations of _Float128 interfaces are visible; otherwise the expansions are unchanged. Tested for x86_64 and arm. * math/tgmath.h: Include and . (__TGMATH_F128): New macro. (__TGMATH_CF128): Likewise. (__TGMATH_UNARY_REAL_ONLY): Use __TGMATH_F128. (__TGMATH_UNARY_REAL_RET_ONLY): Likewise. (__TGMATH_BINARY_FIRST_REAL_ONLY): Likewise. (__TGMATH_BINARY_FIRST_REAL_STD_ONLY): New macro. (__TGMATH_BINARY_REAL_ONLY): Use __TGMATH_F128. (__TGMATH_BINARY_REAL_STD_ONLY): New macro. (__TGMATH_BINARY_REAL_RET_ONLY): Use __TGMATH_F128. (__TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY): Likewise. (__TGMATH_TERNARY_REAL_ONLY): Likewise. (__TGMATH_TERNARY_FIRST_REAL_RET_ONLY): Likewise. (__TGMATH_UNARY_REAL_IMAG): Use __TGMATH_CF128. (__TGMATH_UNARY_IMAG): Use __TGMATH_F128. (__TGMATH_UNARY_REAL_IMAG_RET_REAL): Use __TGMATH_CF128. (__TGMATH_BINARY_REAL_IMAG): Likewise. (nexttoward): Use __TGMATH_BINARY_FIRST_REAL_STD_ONLY. [__USE_MISC] (scalb): Use __TGMATH_BINARY_REAL_STD_ONLY. * math/gen-tgmath-tests.py (Type.init_types): Enable _FloatN and _FloatNx types if the corresponding HUGE_VAL macros are defined. --- math/gen-tgmath-tests.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'math/gen-tgmath-tests.py') diff --git a/math/gen-tgmath-tests.py b/math/gen-tgmath-tests.py index 31a3bd2e2c..04492cd3d5 100755 --- a/math/gen-tgmath-tests.py +++ b/math/gen-tgmath-tests.py @@ -165,25 +165,25 @@ class Type(object): """Initialize all the known types.""" Type.create_type('_Float16', 'f16', 'FLT16_MANT_DIG', complex_name='__CFLOAT16', - condition='0', order=(0, 0)) + condition='defined HUGE_VAL_F16', order=(0, 0)) Type.create_type('float', 'f', 'FLT_MANT_DIG', order=(1, 1)) Type.create_type('_Float32', 'f32', 'FLT32_MANT_DIG', complex_name='__CFLOAT32', - condition='0', order=(2, 2)) + condition='defined HUGE_VAL_F32', order=(2, 2)) Type.create_type('_Float32x', 'f32x', 'FLT32X_MANT_DIG', complex_name='__CFLOAT32X', - condition='0', order=(3, 3)) + condition='defined HUGE_VAL_F32X', order=(3, 3)) Type.create_type('double', '', 'DBL_MANT_DIG', order=(4, 4)) Type.create_type('long double', 'l', 'LDBL_MANT_DIG', order=(5, 7)) Type.create_type('_Float64', 'f64', 'FLT64_MANT_DIG', complex_name='__CFLOAT64', - condition='0', order=(6, 5)) + condition='defined HUGE_VAL_F64', order=(6, 5)) Type.create_type('_Float64x', 'f64x', 'FLT64X_MANT_DIG', complex_name='__CFLOAT64X', - condition='0', order=(7, 6)) + condition='defined HUGE_VAL_F64X', order=(7, 6)) Type.create_type('_Float128', 'f128', 'FLT128_MANT_DIG', complex_name='__CFLOAT128', - condition='0', order=(8, 8)) + condition='defined HUGE_VAL_F128', order=(8, 8)) Type.create_type('char', integer=True) Type.create_type('signed char', integer=True) Type.create_type('unsigned char', integer=True) @@ -202,10 +202,12 @@ class Type(object): # whether long double has the same format as double. Type.create_type('long_double_Float64', 'LDBL_MANT_DIG', complex_name='complex_long_double_Float64', - condition='0', order=(6, 7), internal=True) + condition='defined HUGE_VAL_F64', order=(6, 7), + internal=True) Type.create_type('long_double_Float64x', 'FLT64X_MANT_DIG', complex_name='complex_long_double_Float64x', - condition='0', order=(7, 7), internal=True) + condition='defined HUGE_VAL_F64X', order=(7, 7), + internal=True) @staticmethod def can_combine_types(types): -- cgit v1.2.3