2016-08-09 21:48:54 +00:00
|
|
|
# When building float128 we need to ensure -mfloat128 is
|
|
|
|
# passed to all such object files.
|
|
|
|
|
2017-07-17 20:48:59 +00:00
|
|
|
# libgcc requires __tcb_parse_hwcap_and_convert_at_platform when built with
|
|
|
|
# a binary128 type. That symbol is provided by the loader on dynamically
|
|
|
|
# linked executables, forcing to link the loader after libgcc link.
|
2019-12-03 09:58:52 +00:00
|
|
|
f128-loader-link = -Wl,--as-needed $(elf-objpfx)ld.so -Wl,--no-as-needed
|
2017-07-17 20:48:59 +00:00
|
|
|
|
2016-08-09 21:48:54 +00:00
|
|
|
ifeq ($(subdir),math)
|
|
|
|
# sqrtf128 requires emulation before POWER9.
|
|
|
|
CPPFLAGS += -I../soft-fp
|
|
|
|
|
|
|
|
# float128 requires adding a handful of extra flags.
|
|
|
|
$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += -mfloat128
|
|
|
|
$(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += -mfloat128
|
2017-06-27 18:41:12 +00:00
|
|
|
$(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += -mfloat128
|
2017-11-24 23:38:51 +00:00
|
|
|
$(foreach suf,$(all-object-suffixes),$(objpfx)test-float64x%$(suf)): CFLAGS += -mfloat128
|
2018-02-10 01:52:33 +00:00
|
|
|
# Pairs of types with _Float128 / _Float64x as the wider type but not
|
|
|
|
# the narrower one.
|
|
|
|
f128-pairs = float32-float64x float32-float128 float64-float64x \
|
|
|
|
float64-float128 float32x-float64x float32x-float128
|
|
|
|
$(foreach suf,$(all-object-suffixes),$(foreach pair,$(f128-pairs),$(objpfx)test-$(pair)%$(suf))): CFLAGS += -mfloat128
|
2016-08-09 21:48:54 +00:00
|
|
|
CFLAGS-libm-test-support-float128.c += -mfloat128
|
2017-11-24 23:38:51 +00:00
|
|
|
CFLAGS-libm-test-support-float64x.c += -mfloat128
|
Add C++ versions of iscanonical for ldbl-96 and ldbl-128ibm (bug 22235)
All representations of floating-point numbers in types with IEC 60559
binary exchange format are canonical. On the other hand, types with IEC
60559 extended formats, such as those implemented under ldbl-96 and
ldbl-128ibm, contain representations that are not canonical.
TS 18661-1 introduced the type-generic macro iscanonical, which returns
whether a floating-point value is canonical or not. In Glibc, this
type-generic macro is implemented using the macro __MATH_TG, which, when
support for float128 is enabled, relies on __builtin_types_compatible_p
to select between floating-point types. However, this use of
iscanonical breaks C++ applications, because the builtin is only
available in C mode.
This patch provides a C++ implementation of iscanonical that relies on
function overloading, rather than builtins, to select between
floating-point types.
Unlike the C++ implementations for iszero and issignaling, this
implementation ignores __NO_LONG_DOUBLE_MATH. The double type always
matches IEC 60559 double format, which is always canonical. Thus, when
double and long double are the same (__NO_LONG_DOUBLE_MATH), iscanonical
always returns 1 and is not implemented with __MATH_TG.
Tested for powerpc64, powerpc64le and x86_64.
[BZ #22235]
* math/math.h: Trivial fix for unbalanced parentheses in comment.
* math/Makefile [CXX] (tests): Add test-math-iscanonical.cc.
(CFLAGS-test-math-iscanonical.cc): New variable.
* math/test-math-iscanonical.cc: New file.
* sysdeps/ieee754/ldbl-96/bits/iscanonical.h (iscanonical):
Provide a C++ implementation based on function overloading,
rather than using __MATH_TG, which uses C-only builtins.
* sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h (iscanonical):
Likewise.
* sysdeps/powerpc/powerpc64le/Makefile
(CFLAGS-test-math-iscanonical.cc): New variable.
2017-10-02 17:46:35 +00:00
|
|
|
CFLAGS-test-math-iscanonical.cc += -mfloat128
|
Provide a C++ version of iseqsig (bug 22377)
In C++ mode, __MATH_TG cannot be used for defining iseqsig, because
__MATH_TG relies on __builtin_types_compatible_p, which is a C-only
builtin. This is true when float128 is provided as an ABI-distinct type
from long double.
Moreover, the comparison macros from ISO C take two floating-point
arguments, which need not have the same type. Choosing what underlying
function to call requires evaluating the formats of the arguments, then
selecting which is wider. The macro __MATH_EVAL_FMT2 provides this
information, however, only the type of the macro expansion is relevant
(actually evaluating the expression would be incorrect).
This patch provides a C++ version of iseqsig, in which only the type of
__MATH_EVAL_FMT2 (__typeof or decltype) is used as a template parameter
for __iseqsig_type. This function calls the appropriate underlying
function.
Tested for powerpc64le and x86_64.
[BZ #22377]
* math/Makefile [C++] (tests): Add test for iseqsig.
* math/math.h [C++] (iseqsig): New implementation, which does
not rely on __MATH_TG/__builtin_types_compatible_p.
* math/test-math-iseqsig.cc: New file.
* sysdeps/powerpc/powerpc64le/Makefile
(CFLAGS-test-math-iseqsig.cc): New variable.
2017-11-03 12:44:36 +00:00
|
|
|
CFLAGS-test-math-iseqsig.cc += -mfloat128
|
2017-08-14 16:46:15 +00:00
|
|
|
CFLAGS-test-math-issignaling.cc += -mfloat128
|
Provide a C++ version of iszero that does not use __MATH_TG (bug 21930)
When signaling nans are enabled (with -fsignaling-nans), the C++ version
of iszero uses the fpclassify macro, which is defined with __MATH_TG.
However, when support for float128 is available, __MATH_TG uses the
builtin __builtin_types_compatible_p, which is only available in C mode.
This patch refactors the C++ version of iszero so that it uses function
overloading to select between the floating-point types, instead of
relying on fpclassify and __MATH_TG.
Tested for powerpc64le, s390x, x86_64, and with build-many-glibcs.py.
[BZ #21930]
* math/math.h [defined __cplusplus && defined __SUPPORT_SNAN__]
(iszero): New C++ implementation that does not use
fpclassify/__MATH_TG/__builtin_types_compatible_p, when
signaling nans are enabled, since __builtin_types_compatible_p
is a C-only feature.
* math/test-math-iszero.cc: When __HAVE_DISTINCT_FLOAT128 is
defined, include ieee754_float128.h for access to the union and
member ieee854_float128.ieee.
[__HAVE_DISTINCT_FLOAT128] (do_test): Call check_float128.
[__HAVE_DISTINCT_FLOAT128] (check_float128): New function.
* sysdeps/powerpc/powerpc64le/Makefile [subdir == math]
(CXXFLAGS-test-math-iszero.cc): Add -mfloat128 to the build
options of test-math-zero on powerpc64le.
2017-08-22 19:34:42 +00:00
|
|
|
CFLAGS-test-math-iszero.cc += -mfloat128
|
Provide a C++ version of iseqsig (bug 22377)
In C++ mode, __MATH_TG cannot be used for defining iseqsig, because
__MATH_TG relies on __builtin_types_compatible_p, which is a C-only
builtin. This is true when float128 is provided as an ABI-distinct type
from long double.
Moreover, the comparison macros from ISO C take two floating-point
arguments, which need not have the same type. Choosing what underlying
function to call requires evaluating the formats of the arguments, then
selecting which is wider. The macro __MATH_EVAL_FMT2 provides this
information, however, only the type of the macro expansion is relevant
(actually evaluating the expression would be incorrect).
This patch provides a C++ version of iseqsig, in which only the type of
__MATH_EVAL_FMT2 (__typeof or decltype) is used as a template parameter
for __iseqsig_type. This function calls the appropriate underlying
function.
Tested for powerpc64le and x86_64.
[BZ #22377]
* math/Makefile [C++] (tests): Add test for iseqsig.
* math/math.h [C++] (iseqsig): New implementation, which does
not rely on __MATH_TG/__builtin_types_compatible_p.
* math/test-math-iseqsig.cc: New file.
* sysdeps/powerpc/powerpc64le/Makefile
(CFLAGS-test-math-iseqsig.cc): New variable.
2017-11-03 12:44:36 +00:00
|
|
|
$(foreach test, \
|
2020-03-17 18:46:29 +00:00
|
|
|
test-float128% test-float64x% \
|
2018-02-10 01:52:33 +00:00
|
|
|
$(foreach pair,$(f128-pairs),test-$(pair)%) \
|
Provide a C++ version of iseqsig (bug 22377)
In C++ mode, __MATH_TG cannot be used for defining iseqsig, because
__MATH_TG relies on __builtin_types_compatible_p, which is a C-only
builtin. This is true when float128 is provided as an ABI-distinct type
from long double.
Moreover, the comparison macros from ISO C take two floating-point
arguments, which need not have the same type. Choosing what underlying
function to call requires evaluating the formats of the arguments, then
selecting which is wider. The macro __MATH_EVAL_FMT2 provides this
information, however, only the type of the macro expansion is relevant
(actually evaluating the expression would be incorrect).
This patch provides a C++ version of iseqsig, in which only the type of
__MATH_EVAL_FMT2 (__typeof or decltype) is used as a template parameter
for __iseqsig_type. This function calls the appropriate underlying
function.
Tested for powerpc64le and x86_64.
[BZ #22377]
* math/Makefile [C++] (tests): Add test for iseqsig.
* math/math.h [C++] (iseqsig): New implementation, which does
not rely on __MATH_TG/__builtin_types_compatible_p.
* math/test-math-iseqsig.cc: New file.
* sysdeps/powerpc/powerpc64le/Makefile
(CFLAGS-test-math-iseqsig.cc): New variable.
2017-11-03 12:44:36 +00:00
|
|
|
test-math-iscanonical test-math-iseqsig test-math-issignaling \
|
|
|
|
test-math-iszero, \
|
|
|
|
$(objpfx)$(test)): \
|
2017-07-17 20:48:59 +00:00
|
|
|
gnulib-tests += $(f128-loader-link)
|
2016-08-09 21:48:54 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Append flags to string <-> _Float128 routines.
|
|
|
|
ifneq ($(filter $(subdir),wcsmbs stdlib),)
|
2017-06-27 18:41:12 +00:00
|
|
|
$(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += -mfloat128
|
|
|
|
$(foreach suf,$(all-object-suffixes),%f128_l$(suf)): CFLAGS += -mfloat128
|
|
|
|
$(foreach suf,$(all-object-suffixes),%f128_nan$(suf)): CFLAGS += -mfloat128
|
|
|
|
$(foreach suf,$(all-object-suffixes),%float1282mpn$(suf)): CFLAGS += -mfloat128
|
|
|
|
$(foreach suf,$(all-object-suffixes),%mpn2float128$(suf)): CFLAGS += -mfloat128
|
2016-08-09 21:48:54 +00:00
|
|
|
CFLAGS-bug-strtod.c += -mfloat128
|
|
|
|
CFLAGS-bug-strtod2.c += -mfloat128
|
|
|
|
CFLAGS-tst-strtod-round.c += -mfloat128
|
|
|
|
CFLAGS-tst-wcstod-round.c += -mfloat128
|
2017-09-04 15:48:31 +00:00
|
|
|
CFLAGS-tst-strtod-nan-locale.c += -mfloat128
|
|
|
|
CFLAGS-tst-wcstod-nan-locale.c += -mfloat128
|
2016-08-09 21:48:54 +00:00
|
|
|
CFLAGS-tst-strtod6.c += -mfloat128
|
|
|
|
CFLAGS-tst-strfrom.c += -mfloat128
|
|
|
|
CFLAGS-tst-strfrom-locale.c += -mfloat128
|
|
|
|
CFLAGS-strfrom-skeleton.c += -mfloat128
|
2018-06-18 11:27:51 +00:00
|
|
|
CFLAGS-tst-strtod-nan-sign.c += -mfloat128
|
|
|
|
CFLAGS-tst-wcstod-nan-sign.c += -mfloat128
|
2017-07-17 20:48:59 +00:00
|
|
|
$(foreach test,bug-strtod bug-strtod2 bug-strtod2 tst-strtod-round \
|
|
|
|
tst-wcstod-round tst-strtod6 tst-strrom tst-strfrom-locale \
|
2017-09-04 15:48:31 +00:00
|
|
|
tst-strtod-nan-locale tst-wcstod-nan-locale \
|
2018-06-18 11:27:51 +00:00
|
|
|
strfrom-skeleton tst-strtod-nan-sign tst-wcstod-nan-sign, \
|
|
|
|
$(objpfx)$(test)): gnulib-tests += $(f128-loader-link)
|
2016-08-09 21:48:54 +00:00
|
|
|
|
|
|
|
# When building glibc with support for _Float128, the powers of ten tables in
|
2017-06-27 18:41:12 +00:00
|
|
|
# fpioconst.c and in the string conversion functions must be extended. Some
|
|
|
|
# Makefiles (e.g.: wcsmbs/Makefile) override CFLAGS defined by the Makefiles in
|
|
|
|
# sysdeps. This is avoided with the use sysdep-CFLAGS instead of CFLAGS.
|
2016-08-09 21:48:54 +00:00
|
|
|
sysdep-CFLAGS += $(sysdep-CFLAGS-$(<F))
|
|
|
|
sysdep-CFLAGS-fpioconst.c += -mfloat128
|
|
|
|
sysdep-CFLAGS-strtod_l.c += -mfloat128
|
|
|
|
sysdep-CFLAGS-strtof_l.c += -mfloat128
|
|
|
|
sysdep-CFLAGS-strtold_l.c += -mfloat128
|
|
|
|
sysdep-CFLAGS-wcstod_l.c += -mfloat128
|
|
|
|
sysdep-CFLAGS-wcstof_l.c += -mfloat128
|
|
|
|
sysdep-CFLAGS-wcstold_l.c += -mfloat128
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Append flags to printf routines.
|
|
|
|
ifeq ($(subdir),stdio-common)
|
|
|
|
CFLAGS-printf_fp.c = -mfloat128
|
|
|
|
CFLAGS-printf_fphex.c = -mfloat128
|
|
|
|
CFLAGS-printf_size.c = -mfloat128
|
|
|
|
endif
|