c85e54ac6c
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.
76 lines
3.4 KiB
Makefile
76 lines
3.4 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-float64x%$(suf)): CFLAGS += -mfloat128
|
|
$(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat128%$(suf)): CFLAGS += -mfloat128
|
|
$(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat64x%$(suf)): CFLAGS += -mfloat128
|
|
CFLAGS-libm-test-support-float128.c += -mfloat128
|
|
CFLAGS-libm-test-support-float64x.c += -mfloat128
|
|
CFLAGS-test-math-iscanonical.cc += -mfloat128
|
|
CFLAGS-test-math-iseqsig.cc += -mfloat128
|
|
CFLAGS-test-math-issignaling.cc += -mfloat128
|
|
CFLAGS-test-math-iszero.cc += -mfloat128
|
|
$(foreach test, \
|
|
test-float128% test-ifloat128% test-float64x% test-ifloat64x% \
|
|
test-math-iscanonical test-math-iseqsig test-math-issignaling \
|
|
test-math-iszero, \
|
|
$(objpfx)$(test)): \
|
|
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-strtod-nan-locale.c += -mfloat128
|
|
CFLAGS-tst-wcstod-nan-locale.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 \
|
|
tst-strtod-nan-locale tst-wcstod-nan-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
|