Define CMPLX macros for more _FloatN, _FloatNx types.

Continuing the preparation for additional _FloatN / _FloatNx type
support, this patch defines CMPLX* macros for all such types, as
already done for _Float128.

Tested for x86_64.

	* math/complex.h
	[__HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (CMPLXF16):
	New macro.
	[__HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (CMPLXF32):
	Likewise.
	[__HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (CMPLXF64):
	Likewise.
	[__HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
	(CMPLXF32X): Likewise.
	[__HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
	(CMPLXF64X): Likewise.
	[__HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
	(CMPLXF128X): Likewise.
This commit is contained in:
Joseph Myers 2017-10-31 17:04:30 +00:00
parent 540af6e2f1
commit 43e662837c
2 changed files with 39 additions and 0 deletions

View File

@ -1,5 +1,19 @@
2017-10-31 Joseph Myers <joseph@codesourcery.com> 2017-10-31 Joseph Myers <joseph@codesourcery.com>
* math/complex.h
[__HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (CMPLXF16):
New macro.
[__HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (CMPLXF32):
Likewise.
[__HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (CMPLXF64):
Likewise.
[__HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(CMPLXF32X): Likewise.
[__HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(CMPLXF64X): Likewise.
[__HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(CMPLXF128X): Likewise.
* math/math.h * math/math.h
[__FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 32] [__FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 32]
(__MATH_EVAL_FMT2): Define to add 0.0f. (__MATH_EVAL_FMT2): Define to add 0.0f.

View File

@ -59,10 +59,35 @@ __BEGIN_DECLS
# define CMPLXL(x, y) __builtin_complex ((long double) (x), (long double) (y)) # define CMPLXL(x, y) __builtin_complex ((long double) (x), (long double) (y))
#endif #endif
#if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)
# define CMPLXF16(x, y) __builtin_complex ((_Float16) (x), (_Float16) (y))
#endif
#if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)
# define CMPLXF32(x, y) __builtin_complex ((_Float32) (x), (_Float32) (y))
#endif
#if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)
# define CMPLXF64(x, y) __builtin_complex ((_Float64) (x), (_Float64) (y))
#endif
#if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT) #if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
# define CMPLXF128(x, y) __builtin_complex ((_Float128) (x), (_Float128) (y)) # define CMPLXF128(x, y) __builtin_complex ((_Float128) (x), (_Float128) (y))
#endif #endif
#if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)
# define CMPLXF32X(x, y) __builtin_complex ((_Float32x) (x), (_Float32x) (y))
#endif
#if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)
# define CMPLXF64X(x, y) __builtin_complex ((_Float64x) (x), (_Float64x) (y))
#endif
#if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)
# define CMPLXF128X(x, y) \
__builtin_complex ((_Float128x) (x), (_Float128x) (y))
#endif
/* The file <bits/cmathcalls.h> contains the prototypes for all the /* The file <bits/cmathcalls.h> contains the prototypes for all the
actual math functions. These macros are used for those prototypes, actual math functions. These macros are used for those prototypes,
so we can easily declare each function as both `name' and `__name', so we can easily declare each function as both `name' and `__name',