about summary refs log tree commit diff
path: root/sysdeps/powerpc
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.eti.br>2017-11-03 10:44:36 -0200
committerGabriel F. T. Gomes <gabriel@inconstante.eti.br>2017-12-19 23:26:59 -0200
commitc85e54ac6cef0faed7b7ffc722f52523dec59bf5 (patch)
tree594a7a95e759e7035ee80ea0dee46b09f917f9aa /sysdeps/powerpc
parent10e93d968716ab82931d593bada121c17c0a4b93 (diff)
downloadglibc-c85e54ac6cef0faed7b7ffc722f52523dec59bf5.tar.gz
glibc-c85e54ac6cef0faed7b7ffc722f52523dec59bf5.tar.xz
glibc-c85e54ac6cef0faed7b7ffc722f52523dec59bf5.zip
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.
Diffstat (limited to 'sysdeps/powerpc')
-rw-r--r--sysdeps/powerpc/powerpc64le/Makefile8
1 files changed, 6 insertions, 2 deletions
diff --git a/sysdeps/powerpc/powerpc64le/Makefile b/sysdeps/powerpc/powerpc64le/Makefile
index fefdfb3f3a..01957b4a1c 100644
--- a/sysdeps/powerpc/powerpc64le/Makefile
+++ b/sysdeps/powerpc/powerpc64le/Makefile
@@ -20,10 +20,14 @@ $(foreach suf,$(all-object-suffixes),$(objpfx)test-ifloat64x%$(suf)): CFLAGS +=
 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
-$(objpfx)test-float128% $(objpfx)test-ifloat128% \
-$(objpfx)test-float64x% $(objpfx)test-ifloat64x% $(objpfx)test-math-iszero: \
+$(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