mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-14 04:50:18 +00:00
42496114ec
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.
64 lines
2.8 KiB
Makefile
64 lines
2.8 KiB
Makefile
# When building float128 we need to ensure -mfloat128 is
|
|
# passed to all such object files.
|
|
|
|
# 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.
|
|
f128-loader-link = $(as-needed) $(elf-objpfx)ld.so $(no-as-needed)
|
|
|
|
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
|
|
$(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += -mfloat128
|
|
$(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat128%$(suf)): CFLAGS += -mfloat128
|
|
CFLAGS-libm-test-support-float128.c += -mfloat128
|
|
CFLAGS-test-math-issignaling.cc += -mfloat128
|
|
CFLAGS-test-math-iszero.cc += -mfloat128
|
|
$(objpfx)test-float128% $(objpfx)test-ifloat128% $(objpfx)test-math-iszero: \
|
|
gnulib-tests += $(f128-loader-link)
|
|
endif
|
|
|
|
# Append flags to string <-> _Float128 routines.
|
|
ifneq ($(filter $(subdir),wcsmbs stdlib),)
|
|
$(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
|
|
CFLAGS-bug-strtod.c += -mfloat128
|
|
CFLAGS-bug-strtod2.c += -mfloat128
|
|
CFLAGS-tst-strtod-round.c += -mfloat128
|
|
CFLAGS-tst-wcstod-round.c += -mfloat128
|
|
CFLAGS-tst-strtod6.c += -mfloat128
|
|
CFLAGS-tst-strfrom.c += -mfloat128
|
|
CFLAGS-tst-strfrom-locale.c += -mfloat128
|
|
CFLAGS-strfrom-skeleton.c += -mfloat128
|
|
$(foreach test,bug-strtod bug-strtod2 bug-strtod2 tst-strtod-round \
|
|
tst-wcstod-round tst-strtod6 tst-strrom tst-strfrom-locale \
|
|
strfrom-skeleton,$(objpfx)$(test)): gnulib-tests += $(f128-loader-link)
|
|
|
|
# When building glibc with support for _Float128, the powers of ten tables in
|
|
# 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.
|
|
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
|