summaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>2016-12-09 11:41:55 -0200
committerGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>2017-05-17 18:59:23 -0300
commit477bf19a590b6e6de65f326cb00dcb8999fa8b26 (patch)
treeabb4d8a31bc1a82c783d021e2a7991b7e923c408 /math
parentb2980e3c545294d71b3960ce74b6148e274d2488 (diff)
downloadglibc-477bf19a590b6e6de65f326cb00dcb8999fa8b26.tar.gz
float128: Extend __MATH_TG for float128 support
* math/math.h (__MATH_TG): Extend the conditions to add _Float128 support. * misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): New macro.
Diffstat (limited to 'math')
-rw-r--r--math/math.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/math/math.h b/math/math.h
index 3b0bcadb00..5f006a8358 100644
--- a/math/math.h
+++ b/math/math.h
@@ -340,6 +340,27 @@ extern int signgam;
#ifdef __NO_LONG_DOUBLE_MATH
# define __MATH_TG(TG_ARG, FUNC, ARGS) \
(sizeof (TG_ARG) == sizeof (float) ? FUNC ## f ARGS : FUNC ARGS)
+#elif __HAVE_DISTINCT_FLOAT128
+# if __HAVE_GENERIC_SELECTION
+# define __MATH_TG(TG_ARG, FUNC, ARGS) \
+ _Generic ((TG_ARG), \
+ float: FUNC ## f ARGS, \
+ default: FUNC ARGS, \
+ long double: FUNC ## l ARGS, \
+ _Float128: FUNC ## f128 ARGS)
+# else
+# define __MATH_TG(TG_ARG, FUNC, ARGS) \
+ __builtin_choose_expr \
+ (__builtin_types_compatible_p (__typeof (TG_ARG), float), \
+ FUNC ## f ARGS, \
+ __builtin_choose_expr \
+ (__builtin_types_compatible_p (__typeof (TG_ARG), double), \
+ FUNC ARGS, \
+ __builtin_choose_expr \
+ (__builtin_types_compatible_p (__typeof (TG_ARG), long double), \
+ FUNC ## l ARGS, \
+ FUNC ## f128 ARGS)))
+# endif
#else
# define __MATH_TG(TG_ARG, FUNC, ARGS) \
(sizeof (TG_ARG) == sizeof (float) \