Hi!

When working on libstdc++ extended float support in <cmath>, I found that
we need various builtins for the _Float{16,32,64,128,32x,64x,128x} types.
Glibc 2.26 and later provides the underlying libm routines (except for
_Float16 and _Float128x for the time being) and in libstdc++ I think we
need at least the _Float128 builtins on x86_64, i?86, powerpc64le and ia64
(when long double is IEEE quad, we can handle it by using __builtin_*l
instead), because without the builtins the overloads couldn't be constexpr
(say when it would declare the *f128 extern "C" routines itself and call
them).

The testcase covers just types of those builtins and their constant
folding, so doesn't need actual libm support.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2022-10-15  Jakub Jelinek  <ja...@redhat.com>

        * builtin-types.def (BT_FLOAT16_PTR, BT_FLOAT32_PTR, BT_FLOAT64_PTR,
        BT_FLOAT128_PTR, BT_FLOAT32X_PTR, BT_FLOAT64X_PTR, BT_FLOAT128X_PTR):
        New DEF_PRIMITIVE_TYPE.
        (BT_FN_INT_FLOAT16, BT_FN_INT_FLOAT32, BT_FN_INT_FLOAT64,
        BT_FN_INT_FLOAT128, BT_FN_INT_FLOAT32X, BT_FN_INT_FLOAT64X,
        BT_FN_INT_FLOAT128X, BT_FN_LONG_FLOAT16, BT_FN_LONG_FLOAT32,
        BT_FN_LONG_FLOAT64, BT_FN_LONG_FLOAT128, BT_FN_LONG_FLOAT32X,
        BT_FN_LONG_FLOAT64X, BT_FN_LONG_FLOAT128X, BT_FN_LONGLONG_FLOAT16,
        BT_FN_LONGLONG_FLOAT32, BT_FN_LONGLONG_FLOAT64,
        BT_FN_LONGLONG_FLOAT128, BT_FN_LONGLONG_FLOAT32X,
        BT_FN_LONGLONG_FLOAT64X, BT_FN_LONGLONG_FLOAT128X): New
        DEF_FUNCTION_TYPE_1.
        (BT_FN_FLOAT16_FLOAT16_FLOAT16PTR, BT_FN_FLOAT32_FLOAT32_FLOAT32PTR,
        BT_FN_FLOAT64_FLOAT64_FLOAT64PTR, BT_FN_FLOAT128_FLOAT128_FLOAT128PTR,
        BT_FN_FLOAT32X_FLOAT32X_FLOAT32XPTR,
        BT_FN_FLOAT64X_FLOAT64X_FLOAT64XPTR,
        BT_FN_FLOAT128X_FLOAT128X_FLOAT128XPTR, BT_FN_FLOAT16_FLOAT16_INT,
        BT_FN_FLOAT32_FLOAT32_INT, BT_FN_FLOAT64_FLOAT64_INT,
        BT_FN_FLOAT128_FLOAT128_INT, BT_FN_FLOAT32X_FLOAT32X_INT,
        BT_FN_FLOAT64X_FLOAT64X_INT, BT_FN_FLOAT128X_FLOAT128X_INT,
        BT_FN_FLOAT16_FLOAT16_INTPTR, BT_FN_FLOAT32_FLOAT32_INTPTR,
        BT_FN_FLOAT64_FLOAT64_INTPTR, BT_FN_FLOAT128_FLOAT128_INTPTR,
        BT_FN_FLOAT32X_FLOAT32X_INTPTR, BT_FN_FLOAT64X_FLOAT64X_INTPTR,
        BT_FN_FLOAT128X_FLOAT128X_INTPTR, BT_FN_FLOAT16_FLOAT16_LONG,
        BT_FN_FLOAT32_FLOAT32_LONG, BT_FN_FLOAT64_FLOAT64_LONG,
        BT_FN_FLOAT128_FLOAT128_LONG, BT_FN_FLOAT32X_FLOAT32X_LONG,
        BT_FN_FLOAT64X_FLOAT64X_LONG, BT_FN_FLOAT128X_FLOAT128X_LONG): New
        DEF_FUNCTION_TYPE_2.
        (BT_FN_FLOAT16_FLOAT16_FLOAT16_INTPTR,
        BT_FN_FLOAT32_FLOAT32_FLOAT32_INTPTR,
        BT_FN_FLOAT64_FLOAT64_FLOAT64_INTPTR,
        BT_FN_FLOAT128_FLOAT128_FLOAT128_INTPTR,
        BT_FN_FLOAT32X_FLOAT32X_FLOAT32X_INTPTR,
        BT_FN_FLOAT64X_FLOAT64X_FLOAT64X_INTPTR,
        BT_FN_FLOAT128X_FLOAT128X_FLOAT128X_INTPTR): New DEF_FUNCTION_TYPE_3.
        * builtins.def (ACOSH_TYPE, ATAN2_TYPE, ATANH_TYPE, COSH_TYPE,
        FDIM_TYPE, HUGE_VAL_TYPE, HYPOT_TYPE, ILOGB_TYPE, LDEXP_TYPE,
        LGAMMA_TYPE, LLRINT_TYPE, LOG10_TYPE, LRINT_TYPE, MODF_TYPE,
        NEXTAFTER_TYPE, REMQUO_TYPE, SCALBLN_TYPE, SCALBN_TYPE, SINH_TYPE):
        Define and undefine later.
        (FMIN_TYPE, SQRT_TYPE): Undefine at a later line.
        (INF_TYPE): Define at a later line.
        (BUILT_IN_ACOSH, BUILT_IN_ACOS, BUILT_IN_ASINH, BUILT_IN_ASIN,
        BUILT_IN_ATAN2, BUILT_IN_ATANH, BUILT_IN_ATAN, BUILT_IN_CBRT,
        BUILT_IN_COSH, BUILT_IN_COS, BUILT_IN_ERFC, BUILT_IN_ERF,
        BUILT_IN_EXP2, BUILT_IN_EXP, BUILT_IN_EXPM1, BUILT_IN_FDIM,
        BUILT_IN_FMOD, BUILT_IN_FREXP, BUILT_IN_HYPOT, BUILT_IN_ILOGB,
        BUILT_IN_LDEXP, BUILT_IN_LGAMMA, BUILT_IN_LLRINT, BUILT_IN_LLROUND,
        BUILT_IN_LOG10, BUILT_IN_LOG1P, BUILT_IN_LOG2, BUILT_IN_LOGB,
        BUILT_IN_LOG, BUILT_IN_LRINT, BUILT_IN_LROUND, BUILT_IN_MODF,
        BUILT_IN_NEXTAFTER, BUILT_IN_POW, BUILT_IN_REMAINDER, BUILT_IN_REMQUO,
        BUILT_IN_SCALBLN, BUILT_IN_SCALBN, BUILT_IN_SINH, BUILT_IN_SIN,
        BUILT_IN_TANH, BUILT_IN_TAN, BUILT_IN_TGAMMA): Add
        DEF_EXT_LIB_FLOATN_NX_BUILTINS.
        (BUILT_IN_HUGE_VAL): Use HUGE_VAL_TYPE instead of INF_TYPE in
        DEF_GCC_FLOATN_NX_BUILTINS.
        * fold-const-call.cc (fold_const_call_ss): Add various CASE_CFN_*_FN:
        cases when CASE_CFN_* is present.
        (fold_const_call_sss): Likewise.
        * builtins.cc (mathfn_built_in_2): Use CASE_MATHFN_FLOATN instead of
        CASE_MATHFN for various builtins in SEQ_OF_CASE_MATHFN macro.
        (builtin_with_linkage_p): Add CASE_FLT_FN_FLOATN_NX for various
        builtins next to CASE_FLT_FN.
        * fold-const.cc (tree_call_nonnegative_warnv_p): Add CASE_CFN_*_FN:
        next to CASE_CFN_*: for various builtins.
        * tree-call-cdce.cc (can_test_argument_range): Add
        CASE_FLT_FN_FLOATN_NX next to CASE_FLT_FN for various builtins.
        (edom_only_function): Likewise.

        * gcc.dg/torture/floatn-builtin.h: Add tests for newly added builtins.

--- gcc/builtin-types.def.jj    2022-10-14 09:35:56.135991141 +0200
+++ gcc/builtin-types.def       2022-10-14 18:24:47.658341007 +0200
@@ -135,6 +135,27 @@ DEF_PRIMITIVE_TYPE (BT_CONST_DOUBLE_PTR,
                     (build_qualified_type (double_type_node,
                                            TYPE_QUAL_CONST)))
 DEF_PRIMITIVE_TYPE (BT_LONGDOUBLE_PTR, long_double_ptr_type_node)
+DEF_PRIMITIVE_TYPE (BT_FLOAT16_PTR, (float16_type_node
+                                     ? build_pointer_type (float16_type_node)
+                                     : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_FLOAT32_PTR, (float32_type_node
+                                     ? build_pointer_type (float32_type_node)
+                                     : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_FLOAT64_PTR, (float64_type_node
+                                     ? build_pointer_type (float64_type_node)
+                                     : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_FLOAT128_PTR, (float128_type_node
+                                     ? build_pointer_type (float128_type_node)
+                                     : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_FLOAT32X_PTR, (float32x_type_node
+                                     ? build_pointer_type (float32x_type_node)
+                                     : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_FLOAT64X_PTR, (float64x_type_node
+                                     ? build_pointer_type (float64x_type_node)
+                                     : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_FLOAT128X_PTR, (float128x_type_node
+                                     ? build_pointer_type (float128x_type_node)
+                                     : error_mark_node))
 DEF_PRIMITIVE_TYPE (BT_PID, pid_type_node)
 DEF_PRIMITIVE_TYPE (BT_SIZE, size_type_node)
 DEF_PRIMITIVE_TYPE (BT_CONST_SIZE,
@@ -247,15 +268,36 @@ DEF_FUNCTION_TYPE_1 (BT_FN_INT_PTR, BT_I
 DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT, BT_INT, BT_FLOAT)
 DEF_FUNCTION_TYPE_1 (BT_FN_INT_DOUBLE, BT_INT, BT_DOUBLE)
 DEF_FUNCTION_TYPE_1 (BT_FN_INT_LONGDOUBLE, BT_INT, BT_LONGDOUBLE)
+DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT16, BT_INT, BT_FLOAT16)
+DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT32, BT_INT, BT_FLOAT32)
+DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT64, BT_INT, BT_FLOAT64)
+DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT128, BT_INT, BT_FLOAT128)
+DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT32X, BT_INT, BT_FLOAT32X)
+DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT64X, BT_INT, BT_FLOAT64X)
+DEF_FUNCTION_TYPE_1 (BT_FN_INT_FLOAT128X, BT_INT, BT_FLOAT128X)
 DEF_FUNCTION_TYPE_1 (BT_FN_INT_DFLOAT32, BT_INT, BT_DFLOAT32)
 DEF_FUNCTION_TYPE_1 (BT_FN_INT_DFLOAT64, BT_INT, BT_DFLOAT64)
 DEF_FUNCTION_TYPE_1 (BT_FN_INT_DFLOAT128, BT_INT, BT_DFLOAT128)
 DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT, BT_LONG, BT_FLOAT)
 DEF_FUNCTION_TYPE_1 (BT_FN_LONG_DOUBLE, BT_LONG, BT_DOUBLE)
 DEF_FUNCTION_TYPE_1 (BT_FN_LONG_LONGDOUBLE, BT_LONG, BT_LONGDOUBLE)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT16, BT_LONG, BT_FLOAT16)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT32, BT_LONG, BT_FLOAT32)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT64, BT_LONG, BT_FLOAT64)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT128, BT_LONG, BT_FLOAT128)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT32X, BT_LONG, BT_FLOAT32X)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT64X, BT_LONG, BT_FLOAT64X)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONG_FLOAT128X, BT_LONG, BT_FLOAT128X)
 DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT, BT_LONGLONG, BT_FLOAT)
 DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_DOUBLE, BT_LONGLONG, BT_DOUBLE)
 DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_LONGDOUBLE, BT_LONGLONG, BT_LONGDOUBLE)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT16, BT_LONGLONG, BT_FLOAT16)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT32, BT_LONGLONG, BT_FLOAT32)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT64, BT_LONGLONG, BT_FLOAT64)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT128, BT_LONGLONG, BT_FLOAT128)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT32X, BT_LONGLONG, BT_FLOAT32X)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT64X, BT_LONGLONG, BT_FLOAT64X)
+DEF_FUNCTION_TYPE_1 (BT_FN_LONGLONG_FLOAT128X, BT_LONGLONG, BT_FLOAT128X)
 DEF_FUNCTION_TYPE_1 (BT_FN_VOID_PTR, BT_VOID, BT_PTR)
 DEF_FUNCTION_TYPE_1 (BT_FN_SIZE_CONST_STRING, BT_SIZE, BT_CONST_STRING)
 DEF_FUNCTION_TYPE_1 (BT_FN_INT_CONST_STRING, BT_INT, BT_CONST_STRING)
@@ -425,6 +467,20 @@ DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE
                     BT_DOUBLE, BT_DOUBLE, BT_DOUBLE_PTR)
 DEF_FUNCTION_TYPE_2 (BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLEPTR,
                     BT_LONGDOUBLE, BT_LONGDOUBLE, BT_LONGDOUBLE_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT16_FLOAT16_FLOAT16PTR,
+                    BT_FLOAT16, BT_FLOAT16, BT_FLOAT16_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT32_FLOAT32_FLOAT32PTR,
+                    BT_FLOAT32, BT_FLOAT32, BT_FLOAT32_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64_FLOAT64_FLOAT64PTR,
+                    BT_FLOAT64, BT_FLOAT64, BT_FLOAT64_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128_FLOAT128_FLOAT128PTR,
+                    BT_FLOAT128, BT_FLOAT128, BT_FLOAT128_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT32X_FLOAT32X_FLOAT32XPTR,
+                    BT_FLOAT32X, BT_FLOAT32X, BT_FLOAT32X_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64X_FLOAT64X_FLOAT64XPTR,
+                    BT_FLOAT64X, BT_FLOAT64X, BT_FLOAT64X_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128X_FLOAT128X_FLOAT128XPTR,
+                    BT_FLOAT128X, BT_FLOAT128X, BT_FLOAT128X_PTR)
 DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_FLOAT_LONGDOUBLE,
                     BT_FLOAT, BT_FLOAT, BT_LONGDOUBLE)
 DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_LONGDOUBLE,
@@ -435,12 +491,40 @@ DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE
                     BT_DOUBLE, BT_DOUBLE, BT_INT)
 DEF_FUNCTION_TYPE_2 (BT_FN_LONGDOUBLE_LONGDOUBLE_INT,
                     BT_LONGDOUBLE, BT_LONGDOUBLE, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT16_FLOAT16_INT,
+                    BT_FLOAT16, BT_FLOAT16, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT32_FLOAT32_INT,
+                    BT_FLOAT32, BT_FLOAT32, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64_FLOAT64_INT,
+                    BT_FLOAT64, BT_FLOAT64, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128_FLOAT128_INT,
+                    BT_FLOAT128, BT_FLOAT128, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT32X_FLOAT32X_INT,
+                    BT_FLOAT32X, BT_FLOAT32X, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64X_FLOAT64X_INT,
+                    BT_FLOAT64X, BT_FLOAT64X, BT_INT)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128X_FLOAT128X_INT,
+                    BT_FLOAT128X, BT_FLOAT128X, BT_INT)
 DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_FLOAT_INTPTR,
                     BT_FLOAT, BT_FLOAT, BT_INT_PTR)
 DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_INTPTR,
                     BT_DOUBLE, BT_DOUBLE, BT_INT_PTR)
 DEF_FUNCTION_TYPE_2 (BT_FN_LONGDOUBLE_LONGDOUBLE_INTPTR,
                     BT_LONGDOUBLE, BT_LONGDOUBLE, BT_INT_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT16_FLOAT16_INTPTR,
+                    BT_FLOAT16, BT_FLOAT16, BT_INT_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT32_FLOAT32_INTPTR,
+                    BT_FLOAT32, BT_FLOAT32, BT_INT_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64_FLOAT64_INTPTR,
+                    BT_FLOAT64, BT_FLOAT64, BT_INT_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128_FLOAT128_INTPTR,
+                    BT_FLOAT128, BT_FLOAT128, BT_INT_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT32X_FLOAT32X_INTPTR,
+                    BT_FLOAT32X, BT_FLOAT32X, BT_INT_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64X_FLOAT64X_INTPTR,
+                    BT_FLOAT64X, BT_FLOAT64X, BT_INT_PTR)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128X_FLOAT128X_INTPTR,
+                    BT_FLOAT128X, BT_FLOAT128X, BT_INT_PTR)
 DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_INT_FLOAT,
                     BT_FLOAT, BT_INT, BT_FLOAT)
 DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_INT_DOUBLE,
@@ -453,6 +537,20 @@ DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE
                     BT_DOUBLE, BT_DOUBLE, BT_LONG)
 DEF_FUNCTION_TYPE_2 (BT_FN_LONGDOUBLE_LONGDOUBLE_LONG,
                     BT_LONGDOUBLE, BT_LONGDOUBLE, BT_LONG)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT16_FLOAT16_LONG,
+                    BT_FLOAT16, BT_FLOAT16, BT_LONG)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT32_FLOAT32_LONG,
+                    BT_FLOAT32, BT_FLOAT32, BT_LONG)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64_FLOAT64_LONG,
+                    BT_FLOAT64, BT_FLOAT64, BT_LONG)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128_FLOAT128_LONG,
+                    BT_FLOAT128, BT_FLOAT128, BT_LONG)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT32X_FLOAT32X_LONG,
+                    BT_FLOAT32X, BT_FLOAT32X, BT_LONG)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64X_FLOAT64X_LONG,
+                    BT_FLOAT64X, BT_FLOAT64X, BT_LONG)
+DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128X_FLOAT128X_LONG,
+                    BT_FLOAT128X, BT_FLOAT128X, BT_LONG)
 DEF_FUNCTION_TYPE_2 (BT_FN_INT_CONST_STRING_VALIST_ARG,
                     BT_INT, BT_CONST_STRING, BT_VALIST_ARG)
 DEF_FUNCTION_TYPE_2 (BT_FN_PTR_SIZE_SIZE,
@@ -578,6 +676,20 @@ DEF_FUNCTION_TYPE_3 (BT_FN_DOUBLE_DOUBLE
                     BT_DOUBLE, BT_DOUBLE, BT_DOUBLE, BT_INT_PTR)
 DEF_FUNCTION_TYPE_3 (BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE_INTPTR,
                     BT_LONGDOUBLE, BT_LONGDOUBLE, BT_LONGDOUBLE, BT_INT_PTR)
+DEF_FUNCTION_TYPE_3 (BT_FN_FLOAT16_FLOAT16_FLOAT16_INTPTR,
+                    BT_FLOAT16, BT_FLOAT16, BT_FLOAT16, BT_INT_PTR)
+DEF_FUNCTION_TYPE_3 (BT_FN_FLOAT32_FLOAT32_FLOAT32_INTPTR,
+                    BT_FLOAT32, BT_FLOAT32, BT_FLOAT32, BT_INT_PTR)
+DEF_FUNCTION_TYPE_3 (BT_FN_FLOAT64_FLOAT64_FLOAT64_INTPTR,
+                    BT_FLOAT64, BT_FLOAT64, BT_FLOAT64, BT_INT_PTR)
+DEF_FUNCTION_TYPE_3 (BT_FN_FLOAT128_FLOAT128_FLOAT128_INTPTR,
+                    BT_FLOAT128, BT_FLOAT128, BT_FLOAT128, BT_INT_PTR)
+DEF_FUNCTION_TYPE_3 (BT_FN_FLOAT32X_FLOAT32X_FLOAT32X_INTPTR,
+                    BT_FLOAT32X, BT_FLOAT32X, BT_FLOAT32X, BT_INT_PTR)
+DEF_FUNCTION_TYPE_3 (BT_FN_FLOAT64X_FLOAT64X_FLOAT64X_INTPTR,
+                    BT_FLOAT64X, BT_FLOAT64X, BT_FLOAT64X, BT_INT_PTR)
+DEF_FUNCTION_TYPE_3 (BT_FN_FLOAT128X_FLOAT128X_FLOAT128X_INTPTR,
+                    BT_FLOAT128X, BT_FLOAT128X, BT_FLOAT128X, BT_INT_PTR)
 DEF_FUNCTION_TYPE_3 (BT_FN_VOID_FLOAT_FLOATPTR_FLOATPTR,
                     BT_VOID, BT_FLOAT, BT_FLOAT_PTR, BT_FLOAT_PTR)
 DEF_FUNCTION_TYPE_3 (BT_FN_VOID_DOUBLE_DOUBLEPTR_DOUBLEPTR,
--- gcc/builtins.def.jj 2022-10-14 09:35:56.136991127 +0200
+++ gcc/builtins.def    2022-10-14 18:12:27.473475694 +0200
@@ -292,26 +292,40 @@ DEF_C99_C90RES_BUILTIN (BUILT_IN_ACOSF,
 DEF_C99_BUILTIN        (BUILT_IN_ACOSH, "acosh", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_ACOSHF, "acoshf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_ACOSHL, "acoshl", 
BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define ACOSH_TYPE(F) BT_FN_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ACOSH, "acosh", ACOSH_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_ACOSL, "acosl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ACOS, "acos", ACOSH_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C11_BUILTIN        (BUILT_IN_ALIGNED_ALLOC, "aligned_alloc", 
BT_FN_PTR_SIZE_SIZE, ATTR_ALLOC_WARN_UNUSED_RESULT_SIZE_2_NOTHROW_LIST)
 DEF_LIB_BUILTIN        (BUILT_IN_ASIN, "asin", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_ASINF, "asinf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_ASINH, "asinh", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING)
 DEF_C99_BUILTIN        (BUILT_IN_ASINHF, "asinhf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING)
 DEF_C99_BUILTIN        (BUILT_IN_ASINHL, "asinhl", 
BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ASINH, "asinh", ACOSH_TYPE, 
ATTR_MATHFN_FPROUNDING)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_ASINL, "asinl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ASIN, "asin", ACOSH_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef ACOSH_TYPE
 DEF_LIB_BUILTIN        (BUILT_IN_ATAN, "atan", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING)
 DEF_LIB_BUILTIN        (BUILT_IN_ATAN2, "atan2", BT_FN_DOUBLE_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_ATAN2F, "atan2f", BT_FN_FLOAT_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_ATAN2L, "atan2l", 
BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define ATAN2_TYPE(F) BT_FN_##F##_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ATAN2, "atan2", ATAN2_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef ATAN2_TYPE
 DEF_C99_C90RES_BUILTIN (BUILT_IN_ATANF, "atanf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING)
 DEF_C99_BUILTIN        (BUILT_IN_ATANH, "atanh", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_ATANHF, "atanhf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_ATANHL, "atanhl", 
BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define ATANH_TYPE(F) BT_FN_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ATANH, "atanh", ATANH_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_ATANL, "atanl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ATAN, "atan", ATANH_TYPE, 
ATTR_MATHFN_FPROUNDING)
 DEF_C99_BUILTIN        (BUILT_IN_CBRT, "cbrt", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING)
 DEF_C99_BUILTIN        (BUILT_IN_CBRTF, "cbrtf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING)
 DEF_C99_BUILTIN        (BUILT_IN_CBRTL, "cbrtl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CBRT, "cbrt", ATANH_TYPE, 
ATTR_MATHFN_FPROUNDING)
+#undef ATANH_TYPE
 DEF_LIB_BUILTIN        (BUILT_IN_CEIL, "ceil", BT_FN_DOUBLE_DOUBLE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_CEILF, "ceilf", BT_FN_FLOAT_FLOAT, 
ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_CEILL, "ceill", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
@@ -329,7 +343,10 @@ DEF_C99_C90RES_BUILTIN (BUILT_IN_COSF, "
 DEF_LIB_BUILTIN        (BUILT_IN_COSH, "cosh", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_COSHF, "coshf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_COSHL, "coshl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#define COSH_TYPE(F) BT_FN_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_COSH, "cosh", COSH_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_COSL, "cosl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_COS, "cos", COSH_TYPE, 
ATTR_MATHFN_FPROUNDING)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_DREM, "drem", BT_FN_DOUBLE_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_DREMF, "dremf", BT_FN_FLOAT_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_DREML, "dreml", 
BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
@@ -337,8 +354,10 @@ DEF_C99_BUILTIN        (BUILT_IN_ERF, "e
 DEF_C99_BUILTIN        (BUILT_IN_ERFC, "erfc", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_ERFCF, "erfcf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_ERFCL, "erfcl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ERFC, "erfc", COSH_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_ERFF, "erff", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING)
 DEF_C99_BUILTIN        (BUILT_IN_ERFL, "erfl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ERF, "erf", COSH_TYPE, 
ATTR_MATHFN_FPROUNDING)
 DEF_LIB_BUILTIN        (BUILT_IN_EXP, "exp", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C2X_BUILTIN        (BUILT_IN_EXP10, "exp10", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C2X_BUILTIN        (BUILT_IN_EXP10F, "exp10f", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
@@ -346,9 +365,13 @@ DEF_C2X_BUILTIN        (BUILT_IN_EXP10L,
 DEF_C99_BUILTIN        (BUILT_IN_EXP2, "exp2", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_EXP2F, "exp2f", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_EXP2L, "exp2l", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_EXP2, "exp2", COSH_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_EXPF, "expf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_EXPL, "expl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_EXP, "exp", COSH_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_EXPM1, "expm1", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_EXPM1, "expm1", COSH_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef COSH_TYPE
 DEF_C99_BUILTIN        (BUILT_IN_EXPM1F, "expm1f", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_EXPM1L, "expm1l", 
BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_LIB_BUILTIN        (BUILT_IN_FABS, "fabs", BT_FN_DOUBLE_DOUBLE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
@@ -363,6 +386,9 @@ DEF_C2X_BUILTIN        (BUILT_IN_FABSD12
 DEF_C99_BUILTIN        (BUILT_IN_FDIM, "fdim", BT_FN_DOUBLE_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_FDIMF, "fdimf", BT_FN_FLOAT_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_FDIML, "fdiml", 
BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define FDIM_TYPE(F) BT_FN_##F##_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_FDIM, "fdim", FDIM_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef FDIM_TYPE
 DEF_C99_BUILTIN        (BUILT_IN_FECLEAREXCEPT, "feclearexcept", 
BT_FN_INT_INT, ATTR_NOTHROW_LEAF_LIST)
 DEF_C99_BUILTIN        (BUILT_IN_FEGETENV, "fegetenv", BT_FN_INT_FENV_T_PTR, 
ATTR_NOTHROW_LEAF_LIST)
 DEF_C99_BUILTIN        (BUILT_IN_FEGETEXCEPTFLAG, "fegetexceptflag", 
BT_FN_INT_FEXCEPT_T_PTR_INT, ATTR_NOTHROW_LEAF_LIST)
@@ -397,13 +423,17 @@ DEF_C99_BUILTIN        (BUILT_IN_FMINF,
 DEF_C99_BUILTIN        (BUILT_IN_FMINL, "fminl", 
BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
 #define FMIN_TYPE(F) BT_FN_##F##_##F##_##F
 DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_FMIN, "fmin", FMIN_TYPE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
-#undef FMIN_TYPE
 DEF_LIB_BUILTIN        (BUILT_IN_FMOD, "fmod", BT_FN_DOUBLE_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_FMODF, "fmodf", BT_FN_FLOAT_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_FMODL, "fmodl", 
BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_FMOD, "fmod", FMIN_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef FMIN_TYPE
 DEF_LIB_BUILTIN        (BUILT_IN_FREXP, "frexp", BT_FN_DOUBLE_DOUBLE_INTPTR, 
ATTR_MATHFN_FPROUNDING_STORE)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_FREXPF, "frexpf", BT_FN_FLOAT_FLOAT_INTPTR, 
ATTR_MATHFN_FPROUNDING_STORE)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_FREXPL, "frexpl", 
BT_FN_LONGDOUBLE_LONGDOUBLE_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
+#define FREXP_TYPE(F) BT_FN_##F##_##F##_INTPTR
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_FREXP, "frexp", FREXP_TYPE, 
ATTR_MATHFN_FPROUNDING_STORE)
+#undef FREXP_TYPE
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_GAMMA, "gamma", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_STORE)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_GAMMAF, "gammaf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_STORE)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_GAMMAL, "gammal", 
BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_STORE)
@@ -413,11 +443,15 @@ DEF_EXT_LIB_BUILTIN    (BUILT_IN_GAMMAL_
 DEF_GCC_BUILTIN        (BUILT_IN_HUGE_VAL, "huge_val", BT_FN_DOUBLE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_HUGE_VALF, "huge_valf", BT_FN_FLOAT, 
ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_HUGE_VALL, "huge_vall", BT_FN_LONGDOUBLE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
-#define INF_TYPE(F) BT_FN_##F
-DEF_GCC_FLOATN_NX_BUILTINS (BUILT_IN_HUGE_VAL, "huge_val", INF_TYPE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
+#define HUGE_VAL_TYPE(F) BT_FN_##F
+DEF_GCC_FLOATN_NX_BUILTINS (BUILT_IN_HUGE_VAL, "huge_val", HUGE_VAL_TYPE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
+#undef HUGE_VAL_TYPE
 DEF_C99_BUILTIN        (BUILT_IN_HYPOT, "hypot", BT_FN_DOUBLE_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_HYPOTF, "hypotf", BT_FN_FLOAT_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_HYPOTL, "hypotl", 
BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define HYPOT_TYPE(F) BT_FN_##F##_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_HYPOT, "hypot", HYPOT_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef HYPOT_TYPE
 DEF_GCC_BUILTIN        (BUILT_IN_ICEIL, "iceil", BT_FN_INT_DOUBLE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_ICEILF, "iceilf", BT_FN_INT_FLOAT, 
ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_ICEILL, "iceill", BT_FN_INT_LONGDOUBLE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
@@ -427,9 +461,13 @@ DEF_GCC_BUILTIN        (BUILT_IN_IFLOORL
 DEF_C99_BUILTIN        (BUILT_IN_ILOGB, "ilogb", BT_FN_INT_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_ILOGBF, "ilogbf", BT_FN_INT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_ILOGBL, "ilogbl", BT_FN_INT_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#define ILOGB_TYPE(F) BT_FN_INT_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_ILOGB, "ilogb", ILOGB_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef ILOGB_TYPE
 DEF_GCC_BUILTIN        (BUILT_IN_INF, "inf", BT_FN_DOUBLE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_INFF, "inff", BT_FN_FLOAT, 
ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_INFL, "infl", BT_FN_LONGDOUBLE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
+#define INF_TYPE(F) BT_FN_##F
 DEF_GCC_FLOATN_NX_BUILTINS (BUILT_IN_INF, "inf", INF_TYPE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
 #undef INF_TYPE
 DEF_GCC_BUILTIN               (BUILT_IN_INFD32, "infd32", BT_FN_DFLOAT32, 
ATTR_CONST_NOTHROW_LEAF_LIST)
@@ -456,12 +494,18 @@ DEF_GCC_BUILTIN        (BUILT_IN_LCEILL,
 DEF_LIB_BUILTIN        (BUILT_IN_LDEXP, "ldexp", BT_FN_DOUBLE_DOUBLE_INT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_LDEXPF, "ldexpf", BT_FN_FLOAT_FLOAT_INT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_LDEXPL, "ldexpl", 
BT_FN_LONGDOUBLE_LONGDOUBLE_INT, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define LDEXP_TYPE(F) BT_FN_##F##_##F##_INT
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LDEXP, "ldexp", LDEXP_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef LDEXP_TYPE
 DEF_GCC_BUILTIN        (BUILT_IN_LFLOOR, "lfloor", BT_FN_LONG_DOUBLE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_LFLOORF, "lfloorf", BT_FN_LONG_FLOAT, 
ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_LFLOORL, "lfloorl", BT_FN_LONG_LONGDOUBLE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_C99_BUILTIN        (BUILT_IN_LGAMMA, "lgamma", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_STORE)
 DEF_C99_BUILTIN        (BUILT_IN_LGAMMAF, "lgammaf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_STORE)
 DEF_C99_BUILTIN        (BUILT_IN_LGAMMAL, "lgammal", 
BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_STORE)
+#define LGAMMA_TYPE(F) BT_FN_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LGAMMA, "lgamma", LGAMMA_TYPE, 
ATTR_MATHFN_FPROUNDING_STORE)
+#undef LGAMMA_TYPE
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_LGAMMA_R, "lgamma_r", 
BT_FN_DOUBLE_DOUBLE_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_LGAMMAF_R, "lgammaf_r", 
BT_FN_FLOAT_FLOAT_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_LGAMMAL_R, "lgammal_r", 
BT_FN_LONGDOUBLE_LONGDOUBLE_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
@@ -474,33 +518,51 @@ DEF_GCC_BUILTIN        (BUILT_IN_LLFLOOR
 DEF_C99_BUILTIN        (BUILT_IN_LLRINT, "llrint", BT_FN_LONGLONG_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LLRINTF, "llrintf", BT_FN_LONGLONG_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LLRINTL, "llrintl", 
BT_FN_LONGLONG_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define LLRINT_TYPE(F) BT_FN_LONGLONG_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LLRINT, "llrint", LLRINT_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LLROUND, "llround", BT_FN_LONGLONG_DOUBLE, 
ATTR_MATHFN_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LLROUNDF, "llroundf", BT_FN_LONGLONG_FLOAT, 
ATTR_MATHFN_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LLROUNDL, "llroundl", 
BT_FN_LONGLONG_LONGDOUBLE, ATTR_MATHFN_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LLROUND, "llround", LLRINT_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef LLRINT_TYPE
 DEF_LIB_BUILTIN        (BUILT_IN_LOG, "log", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_LIB_BUILTIN        (BUILT_IN_LOG10, "log10", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_LOG10F, "log10f", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_LOG10L, "log10l", 
BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define LOG10_TYPE(F) BT_FN_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LOG10, "log10", LOG10_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LOG1P, "log1p", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LOG1PF, "log1pf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LOG1PL, "log1pl", 
BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LOG1P, "log1p", LOG10_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LOG2, "log2", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LOG2F, "log2f", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LOG2L, "log2l", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LOG2, "log2", LOG10_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LOGB, "logb", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LOGBF, "logbf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LOGBL, "logbl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LOGB, "logb", LOG10_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_LOGF, "logf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_LOGL, "logl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LOG, "log", LOG10_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef LOG10_TYPE
 DEF_C99_BUILTIN        (BUILT_IN_LRINT, "lrint", BT_FN_LONG_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LRINTF, "lrintf", BT_FN_LONG_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LRINTL, "lrintl", BT_FN_LONG_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#define LRINT_TYPE(F) BT_FN_LONG_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LRINT, "lrint", LRINT_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LROUND, "lround", BT_FN_LONG_DOUBLE, 
ATTR_MATHFN_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LROUNDF, "lroundf", BT_FN_LONG_FLOAT, 
ATTR_MATHFN_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_LROUNDL, "lroundl", BT_FN_LONG_LONGDOUBLE, 
ATTR_MATHFN_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_LROUND, "lround", LRINT_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef LRINT_TYPE
 DEF_LIB_BUILTIN        (BUILT_IN_MODF, "modf", BT_FN_DOUBLE_DOUBLE_DOUBLEPTR, 
ATTR_MATHFN_FPROUNDING_STORE)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_MODFF, "modff", BT_FN_FLOAT_FLOAT_FLOATPTR, 
ATTR_MATHFN_FPROUNDING_STORE)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_MODFL, "modfl", 
BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLEPTR, ATTR_MATHFN_FPROUNDING_STORE)
+#define MODF_TYPE(F) BT_FN_##F##_##F##_##F##PTR
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_MODF, "modf", MODF_TYPE, 
ATTR_MATHFN_FPROUNDING_STORE)
+#undef MODF_TYPE
 DEF_C99_BUILTIN        (BUILT_IN_NAN, "nan", BT_FN_DOUBLE_CONST_STRING, 
ATTR_CONST_NOTHROW_NONNULL)
 DEF_C99_BUILTIN        (BUILT_IN_NANF, "nanf", BT_FN_FLOAT_CONST_STRING, 
ATTR_CONST_NOTHROW_NONNULL)
 DEF_C99_BUILTIN        (BUILT_IN_NANL, "nanl", BT_FN_LONGDOUBLE_CONST_STRING, 
ATTR_CONST_NOTHROW_NONNULL)
@@ -527,6 +589,8 @@ DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN
 DEF_C99_BUILTIN        (BUILT_IN_NEXTAFTER, "nextafter", 
BT_FN_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_NEXTAFTERF, "nextafterf", 
BT_FN_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_NEXTAFTERL, "nextafterl", 
BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_ERRNO)
+#define NEXTAFTER_TYPE(F) BT_FN_##F##_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_NEXTAFTER, "nextafter", 
NEXTAFTER_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_NEXTTOWARD, "nexttoward", 
BT_FN_DOUBLE_DOUBLE_LONGDOUBLE, ATTR_MATHFN_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_NEXTTOWARDF, "nexttowardf", 
BT_FN_FLOAT_FLOAT_LONGDOUBLE, ATTR_MATHFN_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_NEXTTOWARDL, "nexttowardl", 
BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_ERRNO)
@@ -539,12 +603,18 @@ DEF_GCC_BUILTIN        (BUILT_IN_POWI, "
 DEF_GCC_BUILTIN        (BUILT_IN_POWIF, "powif", BT_FN_FLOAT_FLOAT_INT, 
ATTR_MATHFN_FPROUNDING)
 DEF_GCC_BUILTIN        (BUILT_IN_POWIL, "powil", 
BT_FN_LONGDOUBLE_LONGDOUBLE_INT, ATTR_MATHFN_FPROUNDING)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_POWL, "powl", 
BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_POW, "pow", NEXTAFTER_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_REMAINDER, "remainder", 
BT_FN_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_REMAINDERF, "remainderf", 
BT_FN_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_REMAINDERL, "remainderl", 
BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_REMAINDER, "remainder", 
NEXTAFTER_TYPE, ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef NEXTAFTER_TYPE
 DEF_C99_BUILTIN        (BUILT_IN_REMQUO, "remquo", 
BT_FN_DOUBLE_DOUBLE_DOUBLE_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
 DEF_C99_BUILTIN        (BUILT_IN_REMQUOF, "remquof", 
BT_FN_FLOAT_FLOAT_FLOAT_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
 DEF_C99_BUILTIN        (BUILT_IN_REMQUOL, "remquol", 
BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE_INTPTR, ATTR_MATHFN_FPROUNDING_STORE)
+#define REMQUO_TYPE(F) BT_FN_##F##_##F##_##F##_INTPTR
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_REMQUO, "remquo", REMQUO_TYPE, 
ATTR_MATHFN_FPROUNDING_STORE)
+#undef REMQUO_TYPE
 DEF_C99_BUILTIN        (BUILT_IN_RINT, "rint", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING)
 DEF_C99_BUILTIN        (BUILT_IN_RINTF, "rintf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING)
 DEF_C99_BUILTIN        (BUILT_IN_RINTL, "rintl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING)
@@ -569,9 +639,15 @@ DEF_EXT_LIB_BUILTIN    (BUILT_IN_SCALBL,
 DEF_C99_BUILTIN        (BUILT_IN_SCALBLN, "scalbln", BT_FN_DOUBLE_DOUBLE_LONG, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_SCALBLNF, "scalblnf", BT_FN_FLOAT_FLOAT_LONG, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_SCALBLNL, "scalblnl", 
BT_FN_LONGDOUBLE_LONGDOUBLE_LONG, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define SCALBLN_TYPE(F) BT_FN_##F##_##F##_LONG
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_SCALBLN, "scalbln", SCALBLN_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef SCALBLN_TYPE
 DEF_C99_BUILTIN        (BUILT_IN_SCALBN, "scalbn", BT_FN_DOUBLE_DOUBLE_INT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_SCALBNF, "scalbnf", BT_FN_FLOAT_FLOAT_INT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_SCALBNL, "scalbnl", 
BT_FN_LONGDOUBLE_LONGDOUBLE_INT, ATTR_MATHFN_FPROUNDING_ERRNO)
+#define SCALBN_TYPE(F) BT_FN_##F##_##F##_INT
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_SCALBN, "scalbn", SCALBN_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef SCALBN_TYPE
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_SIGNBIT, "signbit", BT_FN_INT_VAR, 
ATTR_CONST_NOTHROW_TYPEGENERIC_LEAF)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_SIGNBITF, "signbitf", BT_FN_INT_FLOAT, 
ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_SIGNBITL, "signbitl", BT_FN_INT_LONGDOUBLE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
@@ -589,22 +665,29 @@ DEF_C99_C90RES_BUILTIN (BUILT_IN_SINF, "
 DEF_LIB_BUILTIN        (BUILT_IN_SINH, "sinh", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_SINHF, "sinhf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_SINHL, "sinhl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#define SINH_TYPE(F) BT_FN_##F##_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_SINH, "sinh", SINH_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_SINL, "sinl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_SIN, "sin", SINH_TYPE, 
ATTR_MATHFN_FPROUNDING)
+#undef SINH_TYPE
 DEF_LIB_BUILTIN        (BUILT_IN_SQRT, "sqrt", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_SQRTF, "sqrtf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_SQRTL, "sqrtl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 #define SQRT_TYPE(F) BT_FN_##F##_##F
 DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_SQRT, "sqrt", SQRT_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
-#undef SQRT_TYPE
 DEF_LIB_BUILTIN        (BUILT_IN_TAN, "tan", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_TANF, "tanf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING)
 DEF_LIB_BUILTIN        (BUILT_IN_TANH, "tanh", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_TANHF, "tanhf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_TANHL, "tanhl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_TANH, "tanh", SQRT_TYPE, 
ATTR_MATHFN_FPROUNDING)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_TANL, "tanl", BT_FN_LONGDOUBLE_LONGDOUBLE, 
ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_TAN, "tan", SQRT_TYPE, 
ATTR_MATHFN_FPROUNDING)
 DEF_C99_BUILTIN        (BUILT_IN_TGAMMA, "tgamma", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_TGAMMAF, "tgammaf", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_C99_BUILTIN        (BUILT_IN_TGAMMAL, "tgammal", 
BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_TGAMMA, "tgamma", SQRT_TYPE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
+#undef SQRT_TYPE
 DEF_C99_BUILTIN        (BUILT_IN_TRUNC, "trunc", BT_FN_DOUBLE_DOUBLE, 
ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_C99_BUILTIN        (BUILT_IN_TRUNCF, "truncf", BT_FN_FLOAT_FLOAT, 
ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_C99_BUILTIN        (BUILT_IN_TRUNCL, "truncl", 
BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
--- gcc/fold-const-call.cc.jj   2022-10-14 09:35:56.136991127 +0200
+++ gcc/fold-const-call.cc      2022-10-15 13:38:42.172877383 +0200
@@ -734,64 +734,82 @@ fold_const_call_ss (real_value *result,
              && do_mpfr_arg1 (result, mpfr_sqrt, arg, format));
 
     CASE_CFN_CBRT:
+    CASE_CFN_CBRT_FN:
       return do_mpfr_arg1 (result, mpfr_cbrt, arg, format);
 
     CASE_CFN_ASIN:
+    CASE_CFN_ASIN_FN:
       return (real_compare (GE_EXPR, arg, &dconstm1)
              && real_compare (LE_EXPR, arg, &dconst1)
              && do_mpfr_arg1 (result, mpfr_asin, arg, format));
 
     CASE_CFN_ACOS:
+    CASE_CFN_ACOS_FN:
       return (real_compare (GE_EXPR, arg, &dconstm1)
              && real_compare (LE_EXPR, arg, &dconst1)
              && do_mpfr_arg1 (result, mpfr_acos, arg, format));
 
     CASE_CFN_ATAN:
+    CASE_CFN_ATAN_FN:
       return do_mpfr_arg1 (result, mpfr_atan, arg, format);
 
     CASE_CFN_ASINH:
+    CASE_CFN_ASINH_FN:
       return do_mpfr_arg1 (result, mpfr_asinh, arg, format);
 
     CASE_CFN_ACOSH:
+    CASE_CFN_ACOSH_FN:
       return (real_compare (GE_EXPR, arg, &dconst1)
              && do_mpfr_arg1 (result, mpfr_acosh, arg, format));
 
     CASE_CFN_ATANH:
+    CASE_CFN_ATANH_FN:
       return (real_compare (GE_EXPR, arg, &dconstm1)
              && real_compare (LE_EXPR, arg, &dconst1)
              && do_mpfr_arg1 (result, mpfr_atanh, arg, format));
 
     CASE_CFN_SIN:
+    CASE_CFN_SIN_FN:
       return do_mpfr_arg1 (result, mpfr_sin, arg, format);
 
     CASE_CFN_COS:
+    CASE_CFN_COS_FN:
       return do_mpfr_arg1 (result, mpfr_cos, arg, format);
 
     CASE_CFN_TAN:
+    CASE_CFN_TAN_FN:
       return do_mpfr_arg1 (result, mpfr_tan, arg, format);
 
     CASE_CFN_SINH:
+    CASE_CFN_SINH_FN:
       return do_mpfr_arg1 (result, mpfr_sinh, arg, format);
 
     CASE_CFN_COSH:
+    CASE_CFN_COSH_FN:
       return do_mpfr_arg1 (result, mpfr_cosh, arg, format);
 
     CASE_CFN_TANH:
+    CASE_CFN_TANH_FN:
       return do_mpfr_arg1 (result, mpfr_tanh, arg, format);
 
     CASE_CFN_ERF:
+    CASE_CFN_ERF_FN:
       return do_mpfr_arg1 (result, mpfr_erf, arg, format);
 
     CASE_CFN_ERFC:
+    CASE_CFN_ERFC_FN:
       return do_mpfr_arg1 (result, mpfr_erfc, arg, format);
 
     CASE_CFN_TGAMMA:
+    CASE_CFN_TGAMMA_FN:
       return do_mpfr_arg1 (result, mpfr_gamma, arg, format);
 
     CASE_CFN_EXP:
+    CASE_CFN_EXP_FN:
       return do_mpfr_arg1 (result, mpfr_exp, arg, format);
 
     CASE_CFN_EXP2:
+    CASE_CFN_EXP2_FN:
       return do_mpfr_arg1 (result, mpfr_exp2, arg, format);
 
     CASE_CFN_EXP10:
@@ -799,21 +817,26 @@ fold_const_call_ss (real_value *result,
       return do_mpfr_arg1 (result, mpfr_exp10, arg, format);
 
     CASE_CFN_EXPM1:
+    CASE_CFN_EXPM1_FN:
       return do_mpfr_arg1 (result, mpfr_expm1, arg, format);
 
     CASE_CFN_LOG:
+    CASE_CFN_LOG_FN:
       return (real_compare (GT_EXPR, arg, &dconst0)
              && do_mpfr_arg1 (result, mpfr_log, arg, format));
 
     CASE_CFN_LOG2:
+    CASE_CFN_LOG2_FN:
       return (real_compare (GT_EXPR, arg, &dconst0)
              && do_mpfr_arg1 (result, mpfr_log2, arg, format));
 
     CASE_CFN_LOG10:
+    CASE_CFN_LOG10_FN:
       return (real_compare (GT_EXPR, arg, &dconst0)
              && do_mpfr_arg1 (result, mpfr_log10, arg, format));
 
     CASE_CFN_LOG1P:
+    CASE_CFN_LOG1P_FN:
       return (real_compare (GT_EXPR, arg, &dconstm1)
              && do_mpfr_arg1 (result, mpfr_log1p, arg, format));
 
@@ -877,6 +900,7 @@ fold_const_call_ss (real_value *result,
       return false;
 
     CASE_CFN_LOGB:
+    CASE_CFN_LOGB_FN:
       return fold_const_logb (result, arg, format);
 
     CASE_CFN_SIGNIFICAND:
@@ -909,6 +933,7 @@ fold_const_call_ss (wide_int *result, co
       return true;
 
     CASE_CFN_ILOGB:
+    CASE_CFN_ILOGB_FN:
       /* For ilogb we don't know FP_ILOGB0, so only handle normal values.
         Proceed iff radix == 2.  In GCC, normalized significands are in
         the range [0.5, 1.0).  We want the exponent as if they were
@@ -934,13 +959,17 @@ fold_const_call_ss (wide_int *result, co
 
     CASE_CFN_IROUND:
     CASE_CFN_LROUND:
+    CASE_CFN_LROUND_FN:
     CASE_CFN_LLROUND:
+    CASE_CFN_LLROUND_FN:
       return fold_const_conversion (result, real_round, arg,
                                    precision, format);
 
     CASE_CFN_IRINT:
     CASE_CFN_LRINT:
+    CASE_CFN_LRINT_FN:
     CASE_CFN_LLRINT:
+    CASE_CFN_LLRINT_FN:
       /* Not yet folded to a constant.  */
       return false;
 
@@ -1370,18 +1399,23 @@ fold_const_call_sss (real_value *result,
     {
     CASE_CFN_DREM:
     CASE_CFN_REMAINDER:
+    CASE_CFN_REMAINDER_FN:
       return do_mpfr_arg2 (result, mpfr_remainder, arg0, arg1, format);
 
     CASE_CFN_ATAN2:
+    CASE_CFN_ATAN2_FN:
       return do_mpfr_arg2 (result, mpfr_atan2, arg0, arg1, format);
 
     CASE_CFN_FDIM:
+    CASE_CFN_FDIM_FN:
       return do_mpfr_arg2 (result, mpfr_dim, arg0, arg1, format);
 
     CASE_CFN_FMOD:
+    CASE_CFN_FMOD_FN:
       return do_mpfr_arg2 (result, mpfr_fmod, arg0, arg1, format);
 
     CASE_CFN_HYPOT:
+    CASE_CFN_HYPOT_FN:
       return do_mpfr_arg2 (result, mpfr_hypot, arg0, arg1, format);
 
     CASE_CFN_COPYSIGN:
@@ -1399,9 +1433,11 @@ fold_const_call_sss (real_value *result,
       return do_mpfr_arg2 (result, mpfr_max, arg0, arg1, format);
 
     CASE_CFN_POW:
+    CASE_CFN_POW_FN:
       return fold_const_pow (result, arg0, arg1, format);
 
     CASE_CFN_NEXTAFTER:
+    CASE_CFN_NEXTAFTER_FN:
     CASE_CFN_NEXTTOWARD:
       return fold_const_nextafter (result, arg0, arg1, format);
 
@@ -1425,10 +1461,13 @@ fold_const_call_sss (real_value *result,
   switch (fn)
     {
     CASE_CFN_LDEXP:
+    CASE_CFN_LDEXP_FN:
       return fold_const_builtin_load_exponent (result, arg0, arg1, format);
 
     CASE_CFN_SCALBN:
+    CASE_CFN_SCALBN_FN:
     CASE_CFN_SCALBLN:
+    CASE_CFN_SCALBLN_FN:
       return (format->b == 2
              && fold_const_builtin_load_exponent (result, arg0, arg1,
                                                   format));
--- gcc/builtins.cc.jj  2022-09-03 09:35:40.141003309 +0200
+++ gcc/builtins.cc     2022-10-14 17:28:08.581805146 +0200
@@ -1934,42 +1934,42 @@ mathfn_built_in_2 (tree type, combined_f
   switch (fn)
     {
 #define SEQ_OF_CASE_MATHFN                     \
-    CASE_MATHFN (ACOS)                         \
-    CASE_MATHFN (ACOSH)                                \
-    CASE_MATHFN (ASIN)                         \
-    CASE_MATHFN (ASINH)                                \
-    CASE_MATHFN (ATAN)                         \
-    CASE_MATHFN (ATAN2)                                \
-    CASE_MATHFN (ATANH)                                \
-    CASE_MATHFN (CBRT)                         \
+    CASE_MATHFN_FLOATN (ACOS)                  \
+    CASE_MATHFN_FLOATN (ACOSH)                 \
+    CASE_MATHFN_FLOATN (ASIN)                  \
+    CASE_MATHFN_FLOATN (ASINH)                 \
+    CASE_MATHFN_FLOATN (ATAN)                  \
+    CASE_MATHFN_FLOATN (ATAN2)                 \
+    CASE_MATHFN_FLOATN (ATANH)                 \
+    CASE_MATHFN_FLOATN (CBRT)                  \
     CASE_MATHFN_FLOATN (CEIL)                  \
     CASE_MATHFN (CEXPI)                                \
     CASE_MATHFN_FLOATN (COPYSIGN)              \
-    CASE_MATHFN (COS)                          \
-    CASE_MATHFN (COSH)                         \
+    CASE_MATHFN_FLOATN (COS)                   \
+    CASE_MATHFN_FLOATN (COSH)                  \
     CASE_MATHFN (DREM)                         \
-    CASE_MATHFN (ERF)                          \
-    CASE_MATHFN (ERFC)                         \
-    CASE_MATHFN (EXP)                          \
+    CASE_MATHFN_FLOATN (ERF)                   \
+    CASE_MATHFN_FLOATN (ERFC)                  \
+    CASE_MATHFN_FLOATN (EXP)                   \
     CASE_MATHFN (EXP10)                                \
-    CASE_MATHFN (EXP2)                         \
-    CASE_MATHFN (EXPM1)                                \
-    CASE_MATHFN (FABS)                         \
-    CASE_MATHFN (FDIM)                         \
+    CASE_MATHFN_FLOATN (EXP2)                  \
+    CASE_MATHFN_FLOATN (EXPM1)                 \
+    CASE_MATHFN_FLOATN (FABS)                  \
+    CASE_MATHFN_FLOATN (FDIM)                  \
     CASE_MATHFN_FLOATN (FLOOR)                 \
     CASE_MATHFN_FLOATN (FMA)                   \
     CASE_MATHFN_FLOATN (FMAX)                  \
     CASE_MATHFN_FLOATN (FMIN)                  \
-    CASE_MATHFN (FMOD)                         \
-    CASE_MATHFN (FREXP)                                \
+    CASE_MATHFN_FLOATN (FMOD)                  \
+    CASE_MATHFN_FLOATN (FREXP)                 \
     CASE_MATHFN (GAMMA)                                \
     CASE_MATHFN_REENT (GAMMA) /* GAMMA_R */    \
-    CASE_MATHFN (HUGE_VAL)                     \
-    CASE_MATHFN (HYPOT)                                \
-    CASE_MATHFN (ILOGB)                                \
+    CASE_MATHFN_FLOATN (HUGE_VAL)              \
+    CASE_MATHFN_FLOATN (HYPOT)                 \
+    CASE_MATHFN_FLOATN (ILOGB)                 \
     CASE_MATHFN (ICEIL)                                \
     CASE_MATHFN (IFLOOR)                       \
-    CASE_MATHFN (INF)                          \
+    CASE_MATHFN_FLOATN (INF)                   \
     CASE_MATHFN (IRINT)                                \
     CASE_MATHFN (IROUND)                       \
     CASE_MATHFN (ISINF)                                \
@@ -1977,47 +1977,47 @@ mathfn_built_in_2 (tree type, combined_f
     CASE_MATHFN (J1)                           \
     CASE_MATHFN (JN)                           \
     CASE_MATHFN (LCEIL)                                \
-    CASE_MATHFN (LDEXP)                                \
+    CASE_MATHFN_FLOATN (LDEXP)                 \
     CASE_MATHFN (LFLOOR)                       \
-    CASE_MATHFN (LGAMMA)                       \
+    CASE_MATHFN_FLOATN (LGAMMA)                        \
     CASE_MATHFN_REENT (LGAMMA) /* LGAMMA_R */  \
     CASE_MATHFN (LLCEIL)                       \
     CASE_MATHFN (LLFLOOR)                      \
-    CASE_MATHFN (LLRINT)                       \
-    CASE_MATHFN (LLROUND)                      \
-    CASE_MATHFN (LOG)                          \
-    CASE_MATHFN (LOG10)                                \
-    CASE_MATHFN (LOG1P)                                \
-    CASE_MATHFN (LOG2)                         \
-    CASE_MATHFN (LOGB)                         \
-    CASE_MATHFN (LRINT)                                \
-    CASE_MATHFN (LROUND)                       \
-    CASE_MATHFN (MODF)                         \
-    CASE_MATHFN (NAN)                          \
-    CASE_MATHFN (NANS)                         \
+    CASE_MATHFN_FLOATN (LLRINT)                        \
+    CASE_MATHFN_FLOATN (LLROUND)               \
+    CASE_MATHFN_FLOATN (LOG)                   \
+    CASE_MATHFN_FLOATN (LOG10)                 \
+    CASE_MATHFN_FLOATN (LOG1P)                 \
+    CASE_MATHFN_FLOATN (LOG2)                  \
+    CASE_MATHFN_FLOATN (LOGB)                  \
+    CASE_MATHFN_FLOATN (LRINT)                 \
+    CASE_MATHFN_FLOATN (LROUND)                        \
+    CASE_MATHFN_FLOATN (MODF)                  \
+    CASE_MATHFN_FLOATN (NAN)                   \
+    CASE_MATHFN_FLOATN (NANS)                  \
     CASE_MATHFN_FLOATN (NEARBYINT)             \
-    CASE_MATHFN (NEXTAFTER)                    \
+    CASE_MATHFN_FLOATN (NEXTAFTER)             \
     CASE_MATHFN (NEXTTOWARD)                   \
-    CASE_MATHFN (POW)                          \
+    CASE_MATHFN_FLOATN (POW)                   \
     CASE_MATHFN (POWI)                         \
     CASE_MATHFN (POW10)                                \
-    CASE_MATHFN (REMAINDER)                    \
-    CASE_MATHFN (REMQUO)                       \
+    CASE_MATHFN_FLOATN (REMAINDER)             \
+    CASE_MATHFN_FLOATN (REMQUO)                        \
     CASE_MATHFN_FLOATN (RINT)                  \
     CASE_MATHFN_FLOATN (ROUND)                 \
     CASE_MATHFN_FLOATN (ROUNDEVEN)             \
     CASE_MATHFN (SCALB)                                \
-    CASE_MATHFN (SCALBLN)                      \
-    CASE_MATHFN (SCALBN)                       \
+    CASE_MATHFN_FLOATN (SCALBLN)               \
+    CASE_MATHFN_FLOATN (SCALBN)                        \
     CASE_MATHFN (SIGNBIT)                      \
     CASE_MATHFN (SIGNIFICAND)                  \
-    CASE_MATHFN (SIN)                          \
+    CASE_MATHFN_FLOATN (SIN)                   \
     CASE_MATHFN (SINCOS)                       \
-    CASE_MATHFN (SINH)                         \
+    CASE_MATHFN_FLOATN (SINH)                  \
     CASE_MATHFN_FLOATN (SQRT)                  \
-    CASE_MATHFN (TAN)                          \
-    CASE_MATHFN (TANH)                         \
-    CASE_MATHFN (TGAMMA)                       \
+    CASE_MATHFN_FLOATN (TAN)                   \
+    CASE_MATHFN_FLOATN (TANH)                  \
+    CASE_MATHFN_FLOATN (TGAMMA)                        \
     CASE_MATHFN_FLOATN (TRUNC)                 \
     CASE_MATHFN (Y0)                           \
     CASE_MATHFN (Y1)                           \
@@ -11350,27 +11350,43 @@ builtin_with_linkage_p (tree decl)
     switch (DECL_FUNCTION_CODE (decl))
     {
       CASE_FLT_FN (BUILT_IN_ACOS):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_ACOS):
       CASE_FLT_FN (BUILT_IN_ACOSH):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_ACOSH):
       CASE_FLT_FN (BUILT_IN_ASIN):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_ASIN):
       CASE_FLT_FN (BUILT_IN_ASINH):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_ASINH):
       CASE_FLT_FN (BUILT_IN_ATAN):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_ATAN):
       CASE_FLT_FN (BUILT_IN_ATANH):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_ATANH):
       CASE_FLT_FN (BUILT_IN_ATAN2):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_ATAN2):
       CASE_FLT_FN (BUILT_IN_CBRT):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_CBRT):
       CASE_FLT_FN (BUILT_IN_CEIL):
       CASE_FLT_FN_FLOATN_NX (BUILT_IN_CEIL):
       CASE_FLT_FN (BUILT_IN_COPYSIGN):
       CASE_FLT_FN_FLOATN_NX (BUILT_IN_COPYSIGN):
       CASE_FLT_FN (BUILT_IN_COS):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_COS):
       CASE_FLT_FN (BUILT_IN_COSH):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_COSH):
       CASE_FLT_FN (BUILT_IN_ERF):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_ERF):
       CASE_FLT_FN (BUILT_IN_ERFC):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_ERFC):
       CASE_FLT_FN (BUILT_IN_EXP):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_EXP):
       CASE_FLT_FN (BUILT_IN_EXP2):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_EXP2):
       CASE_FLT_FN (BUILT_IN_EXPM1):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_EXPM1):
       CASE_FLT_FN (BUILT_IN_FABS):
       CASE_FLT_FN_FLOATN_NX (BUILT_IN_FABS):
       CASE_FLT_FN (BUILT_IN_FDIM):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_FDIM):
       CASE_FLT_FN (BUILT_IN_FLOOR):
       CASE_FLT_FN_FLOATN_NX (BUILT_IN_FLOOR):
       CASE_FLT_FN (BUILT_IN_FMA):
@@ -11380,43 +11396,71 @@ builtin_with_linkage_p (tree decl)
       CASE_FLT_FN (BUILT_IN_FMIN):
       CASE_FLT_FN_FLOATN_NX (BUILT_IN_FMIN):
       CASE_FLT_FN (BUILT_IN_FMOD):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_FMOD):
       CASE_FLT_FN (BUILT_IN_FREXP):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_FREXP):
       CASE_FLT_FN (BUILT_IN_HYPOT):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_HYPOT):
       CASE_FLT_FN (BUILT_IN_ILOGB):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_ILOGB):
       CASE_FLT_FN (BUILT_IN_LDEXP):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_LDEXP):
       CASE_FLT_FN (BUILT_IN_LGAMMA):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_LGAMMA):
       CASE_FLT_FN (BUILT_IN_LLRINT):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_LLRINT):
       CASE_FLT_FN (BUILT_IN_LLROUND):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_LLROUND):
       CASE_FLT_FN (BUILT_IN_LOG):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG):
       CASE_FLT_FN (BUILT_IN_LOG10):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG10):
       CASE_FLT_FN (BUILT_IN_LOG1P):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG1P):
       CASE_FLT_FN (BUILT_IN_LOG2):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG2):
       CASE_FLT_FN (BUILT_IN_LOGB):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOGB):
       CASE_FLT_FN (BUILT_IN_LRINT):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_LRINT):
       CASE_FLT_FN (BUILT_IN_LROUND):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_LROUND):
       CASE_FLT_FN (BUILT_IN_MODF):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_MODF):
       CASE_FLT_FN (BUILT_IN_NAN):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_NAN):
       CASE_FLT_FN (BUILT_IN_NEARBYINT):
       CASE_FLT_FN_FLOATN_NX (BUILT_IN_NEARBYINT):
       CASE_FLT_FN (BUILT_IN_NEXTAFTER):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_NEXTAFTER):
       CASE_FLT_FN (BUILT_IN_NEXTTOWARD):
       CASE_FLT_FN (BUILT_IN_POW):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_POW):
       CASE_FLT_FN (BUILT_IN_REMAINDER):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_REMAINDER):
       CASE_FLT_FN (BUILT_IN_REMQUO):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_REMQUO):
       CASE_FLT_FN (BUILT_IN_RINT):
       CASE_FLT_FN_FLOATN_NX (BUILT_IN_RINT):
       CASE_FLT_FN (BUILT_IN_ROUND):
       CASE_FLT_FN_FLOATN_NX (BUILT_IN_ROUND):
       CASE_FLT_FN (BUILT_IN_SCALBLN):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_SCALBLN):
       CASE_FLT_FN (BUILT_IN_SCALBN):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_SCALBN):
       CASE_FLT_FN (BUILT_IN_SIN):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_SIN):
       CASE_FLT_FN (BUILT_IN_SINH):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_SINH):
       CASE_FLT_FN (BUILT_IN_SINCOS):
       CASE_FLT_FN (BUILT_IN_SQRT):
       CASE_FLT_FN_FLOATN_NX (BUILT_IN_SQRT):
       CASE_FLT_FN (BUILT_IN_TAN):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_TAN):
       CASE_FLT_FN (BUILT_IN_TANH):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_TANH):
       CASE_FLT_FN (BUILT_IN_TGAMMA):
+      CASE_FLT_FN_FLOATN_NX (BUILT_IN_TGAMMA):
       CASE_FLT_FN (BUILT_IN_TRUNC):
       CASE_FLT_FN_FLOATN_NX (BUILT_IN_TRUNC):
        return true;
--- gcc/fold-const.cc.jj        2022-10-06 08:56:28.463130017 +0200
+++ gcc/fold-const.cc   2022-10-14 18:30:33.396604895 +0200
@@ -14797,16 +14797,25 @@ tree_call_nonnegative_warnv_p (tree type
   switch (fn)
     {
     CASE_CFN_ACOS:
+    CASE_CFN_ACOS_FN:
     CASE_CFN_ACOSH:
+    CASE_CFN_ACOSH_FN:
     CASE_CFN_CABS:
     CASE_CFN_COSH:
+    CASE_CFN_COSH_FN:
     CASE_CFN_ERFC:
+    CASE_CFN_ERFC_FN:
     CASE_CFN_EXP:
+    CASE_CFN_EXP_FN:
     CASE_CFN_EXP10:
     CASE_CFN_EXP2:
+    CASE_CFN_EXP2_FN:
     CASE_CFN_FABS:
+    CASE_CFN_FABS_FN:
     CASE_CFN_FDIM:
+    CASE_CFN_FDIM_FN:
     CASE_CFN_HYPOT:
+    CASE_CFN_HYPOT_FN:
     CASE_CFN_POW10:
     CASE_CFN_FFS:
     CASE_CFN_PARITY:
@@ -14828,17 +14837,25 @@ tree_call_nonnegative_warnv_p (tree type
       return RECURSE (arg0);
 
     CASE_CFN_ASINH:
+    CASE_CFN_ASINH_FN:
     CASE_CFN_ATAN:
+    CASE_CFN_ATAN_FN:
     CASE_CFN_ATANH:
+    CASE_CFN_ATANH_FN:
     CASE_CFN_CBRT:
+    CASE_CFN_CBRT_FN:
     CASE_CFN_CEIL:
     CASE_CFN_CEIL_FN:
     CASE_CFN_ERF:
+    CASE_CFN_ERF_FN:
     CASE_CFN_EXPM1:
+    CASE_CFN_EXPM1_FN:
     CASE_CFN_FLOOR:
     CASE_CFN_FLOOR_FN:
     CASE_CFN_FMOD:
+    CASE_CFN_FMOD_FN:
     CASE_CFN_FREXP:
+    CASE_CFN_FREXP_FN:
     CASE_CFN_ICEIL:
     CASE_CFN_IFLOOR:
     CASE_CFN_IRINT:
@@ -14849,10 +14866,15 @@ tree_call_nonnegative_warnv_p (tree type
     CASE_CFN_LLCEIL:
     CASE_CFN_LLFLOOR:
     CASE_CFN_LLRINT:
+    CASE_CFN_LLRINT_FN:
     CASE_CFN_LLROUND:
+    CASE_CFN_LLROUND_FN:
     CASE_CFN_LRINT:
+    CASE_CFN_LRINT_FN:
     CASE_CFN_LROUND:
+    CASE_CFN_LROUND_FN:
     CASE_CFN_MODF:
+    CASE_CFN_MODF_FN:
     CASE_CFN_NEARBYINT:
     CASE_CFN_NEARBYINT_FN:
     CASE_CFN_RINT:
@@ -14863,11 +14885,15 @@ tree_call_nonnegative_warnv_p (tree type
     CASE_CFN_ROUNDEVEN_FN:
     CASE_CFN_SCALB:
     CASE_CFN_SCALBLN:
+    CASE_CFN_SCALBLN_FN:
     CASE_CFN_SCALBN:
+    CASE_CFN_SCALBN_FN:
     CASE_CFN_SIGNBIT:
     CASE_CFN_SIGNIFICAND:
     CASE_CFN_SINH:
+    CASE_CFN_SINH_FN:
     CASE_CFN_TANH:
+    CASE_CFN_TANH_FN:
     CASE_CFN_TRUNC:
     CASE_CFN_TRUNC_FN:
       /* True if the 1st argument is nonnegative.  */
@@ -14907,6 +14933,7 @@ tree_call_nonnegative_warnv_p (tree type
       return RECURSE (arg0);
 
     CASE_CFN_POW:
+    CASE_CFN_POW_FN:
       /* True if the 1st argument is nonnegative or the second
         argument is an even integer valued real.  */
       if (TREE_CODE (arg1) == REAL_CST)
--- gcc/tree-call-cdce.cc.jj    2022-06-28 13:03:31.081687705 +0200
+++ gcc/tree-call-cdce.cc       2022-10-14 18:33:48.583931114 +0200
@@ -295,22 +295,35 @@ can_test_argument_range (gcall *call)
     {
     /* Trig functions.  */
     CASE_FLT_FN (BUILT_IN_ACOS):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_ACOS):
     CASE_FLT_FN (BUILT_IN_ASIN):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_ASIN):
     /* Hyperbolic functions.  */
     CASE_FLT_FN (BUILT_IN_ACOSH):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_ACOSH):
     CASE_FLT_FN (BUILT_IN_ATANH):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_ATANH):
     CASE_FLT_FN (BUILT_IN_COSH):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_COSH):
     CASE_FLT_FN (BUILT_IN_SINH):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_SINH):
     /* Log functions.  */
     CASE_FLT_FN (BUILT_IN_LOG):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG):
     CASE_FLT_FN (BUILT_IN_LOG2):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG2):
     CASE_FLT_FN (BUILT_IN_LOG10):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG10):
     CASE_FLT_FN (BUILT_IN_LOG1P):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_LOG1P):
     /* Exp functions.  */
     CASE_FLT_FN (BUILT_IN_EXP):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_EXP):
     CASE_FLT_FN (BUILT_IN_EXP2):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_EXP2):
     CASE_FLT_FN (BUILT_IN_EXP10):
     CASE_FLT_FN (BUILT_IN_EXPM1):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_EXPM1):
     CASE_FLT_FN (BUILT_IN_POW10):
     /* Sqrt.  */
     CASE_FLT_FN (BUILT_IN_SQRT):
@@ -337,15 +350,22 @@ edom_only_function (gcall *call)
   switch (DECL_FUNCTION_CODE (gimple_call_fndecl (call)))
     {
     CASE_FLT_FN (BUILT_IN_ACOS):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_ACOS):
     CASE_FLT_FN (BUILT_IN_ASIN):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_ASIN):
     CASE_FLT_FN (BUILT_IN_ATAN):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_ATAN):
     CASE_FLT_FN (BUILT_IN_COS):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_COS):
     CASE_FLT_FN (BUILT_IN_SIGNIFICAND):
     CASE_FLT_FN (BUILT_IN_SIN):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_SIN):
     CASE_FLT_FN (BUILT_IN_SQRT):
     CASE_FLT_FN_FLOATN_NX (BUILT_IN_SQRT):
     CASE_FLT_FN (BUILT_IN_FMOD):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_FMOD):
     CASE_FLT_FN (BUILT_IN_REMAINDER):
+    CASE_FLT_FN_FLOATN_NX (BUILT_IN_REMAINDER):
       return true;
 
     default:
--- gcc/testsuite/gcc.dg/torture/floatn-builtin.h.jj    2022-10-14 
09:26:22.579891793 +0200
+++ gcc/testsuite/gcc.dg/torture/floatn-builtin.h       2022-10-15 
13:23:09.365460334 +0200
@@ -20,6 +20,9 @@
 extern void exit (int);
 extern void abort (void);
 
+extern int test_i;
+extern long int test_l;
+extern long long int test_ll;
 extern TYPE test_type;
 extern __typeof (FN (__builtin_inf) ()) test_type;
 extern __typeof (FN (__builtin_huge_val) ()) test_type;
@@ -27,12 +30,91 @@ extern __typeof (FN (__builtin_nan) ("")
 extern __typeof (FN (__builtin_nans) ("")) test_type;
 extern __typeof (FN (__builtin_fabs) (0)) test_type;
 extern __typeof (FN (__builtin_copysign) (0, 0)) test_type;
+extern __typeof (FN (__builtin_acosh) (0)) test_type;
+extern __typeof (FN (__builtin_acos) (0)) test_type;
+extern __typeof (FN (__builtin_asinh) (0)) test_type;
+extern __typeof (FN (__builtin_asin) (0)) test_type;
+extern __typeof (FN (__builtin_atanh) (0)) test_type;
+extern __typeof (FN (__builtin_atan) (0)) test_type;
+extern __typeof (FN (__builtin_cbrt) (0)) test_type;
+extern __typeof (FN (__builtin_cosh) (0)) test_type;
+extern __typeof (FN (__builtin_cos) (0)) test_type;
+extern __typeof (FN (__builtin_erfc) (0)) test_type;
+extern __typeof (FN (__builtin_erf) (0)) test_type;
+extern __typeof (FN (__builtin_exp2) (0)) test_type;
+extern __typeof (FN (__builtin_exp) (0)) test_type;
+extern __typeof (FN (__builtin_expm1) (0)) test_type;
+extern __typeof (FN (__builtin_lgamma) (0)) test_type;
+extern __typeof (FN (__builtin_log10) (0)) test_type;
+extern __typeof (FN (__builtin_log1p) (0)) test_type;
+extern __typeof (FN (__builtin_log2) (0)) test_type;
+extern __typeof (FN (__builtin_logb) (0)) test_type;
+extern __typeof (FN (__builtin_log) (0)) test_type;
+extern __typeof (FN (__builtin_nextafter) (0, 0)) test_type;
+extern __typeof (FN (__builtin_sinh) (0)) test_type;
+extern __typeof (FN (__builtin_sin) (0)) test_type;
+extern __typeof (FN (__builtin_tanh) (0)) test_type;
+extern __typeof (FN (__builtin_tan) (0)) test_type;
+extern __typeof (FN (__builtin_tgamma) (0)) test_type;
+extern __typeof (FN (__builtin_atan2) (0, 0)) test_type;
+extern __typeof (FN (__builtin_fdim) (0, 0)) test_type;
+extern __typeof (FN (__builtin_fmod) (0, 0)) test_type;
+extern __typeof (FN (__builtin_frexp) (0, &test_i)) test_type;
+extern __typeof (FN (__builtin_ldexp) (0, 0)) test_type;
+extern __typeof (FN (__builtin_hypot) (0, 0)) test_type;
+extern __typeof (FN (__builtin_ilogb) (0)) test_i;
+extern __typeof (FN (__builtin_llrint) (0)) test_ll;
+extern __typeof (FN (__builtin_llround) (0)) test_ll;
+extern __typeof (FN (__builtin_lrint) (0)) test_l;
+extern __typeof (FN (__builtin_lround) (0)) test_l;
+extern __typeof (FN (__builtin_modf) (0, &test_type)) test_type;
+extern __typeof (FN (__builtin_pow) (0, 0)) test_type;
+extern __typeof (FN (__builtin_remainder) (0, 0)) test_type;
+extern __typeof (FN (__builtin_remquo) (0, 0, &test_i)) test_type;
+extern __typeof (FN (__builtin_scalbln) (0, 0L)) test_type;
+extern __typeof (FN (__builtin_scalbn) (0, 0)) test_type;
 
 volatile TYPE inf_cst = FN (__builtin_inf) ();
 volatile TYPE huge_val_cst = FN (__builtin_huge_val) ();
 volatile TYPE nan_cst = FN (__builtin_nan) ("");
 volatile TYPE nans_cst = FN (__builtin_nans) ("");
 volatile TYPE neg0 = -CST (0.0), neg1 = -CST (1.0), one = 1.0;
+volatile TYPE t1 = FN (__builtin_acosh) (CST (1.0));
+volatile TYPE t2 = FN (__builtin_acos) (CST (1.0));
+volatile TYPE t3 = FN (__builtin_asinh) (CST (0.0));
+volatile TYPE t4 = FN (__builtin_asin) (CST (0.0));
+volatile TYPE t5 = FN (__builtin_atanh) (CST (0.0));
+volatile TYPE t6 = FN (__builtin_atan) (CST (0.0));
+volatile TYPE t7 = FN (__builtin_cbrt) (CST (27.0));
+volatile TYPE t8 = FN (__builtin_cosh) (CST (0.0));
+volatile TYPE t9 = FN (__builtin_cos) (CST (0.0));
+volatile TYPE t10 = FN (__builtin_erfc) (CST (0.0));
+volatile TYPE t11 = FN (__builtin_erf) (CST (0.0));
+volatile TYPE t12 = FN (__builtin_exp2) (CST (1.0));
+volatile TYPE t13 = FN (__builtin_exp) (CST (0.0));
+volatile TYPE t14 = FN (__builtin_expm1) (CST (0.0));
+volatile TYPE t15 = FN (__builtin_log10) (CST (1.0));
+volatile TYPE t16 = FN (__builtin_log1p) (CST (0.0));
+volatile TYPE t17 = FN (__builtin_log2) (CST (1.0));
+volatile TYPE t18 = FN (__builtin_logb) (CST (1.0));
+volatile TYPE t19 = FN (__builtin_log) (CST (1.0));
+volatile TYPE t20 = FN (__builtin_nextafter) (CST (0.0), CST (0.0));
+volatile TYPE t21 = FN (__builtin_sinh) (CST (0.0));
+volatile TYPE t22 = FN (__builtin_sin) (CST (0.0));
+volatile TYPE t23 = FN (__builtin_tanh) (CST (0.0));
+volatile TYPE t24 = FN (__builtin_tan) (CST (0.0));
+volatile TYPE t25 = FN (__builtin_atan2) (CST (0.0), CST (1.0));
+volatile TYPE t26 = FN (__builtin_fdim) (CST (0.0), CST (0.0));
+volatile TYPE t27 = FN (__builtin_fmod) (CST (0.0), CST (1.0));
+volatile TYPE t28 = FN (__builtin_ldexp) (CST (1.0), 1);
+volatile TYPE t29 = FN (__builtin_hypot) (CST (3.0), CST (4.0));
+volatile int t30 = FN (__builtin_ilogb) (CST (1.0));
+volatile long long int t31 = FN (__builtin_llround) (CST (42.25));
+volatile long int t32 = FN (__builtin_lround) (CST (42.25));
+volatile TYPE t33 = FN (__builtin_pow) (CST (1.0), CST (2.0));
+volatile TYPE t34 = FN (__builtin_remainder) (CST (7.0), CST (4.0));
+volatile TYPE t35 = FN (__builtin_scalbln) (CST (1.0), 1L);
+volatile TYPE t36 = FN (__builtin_scalbn) (CST (1.0), 1);
 
 int
 main (void)
@@ -60,5 +142,77 @@ main (void)
   r = FN (__builtin_copysign) (-inf_cst, one);
   if (r != huge_val_cst)
     abort ();
+  if (t1 != CST (0.0))
+    abort ();
+  if (t2 != CST (0.0))
+    abort ();
+  if (t3 != CST (0.0))
+    abort ();
+  if (t4 != CST (0.0))
+    abort ();
+  if (t5 != CST (0.0))
+    abort ();
+  if (t6 != CST (0.0))
+    abort ();
+  if (t7 != CST (3.0))
+    abort ();
+  if (t8 != CST (1.0))
+    abort ();
+  if (t9 != CST (1.0))
+    abort ();
+  if (t10 != CST (1.0))
+    abort ();
+  if (t11 != CST (0.0))
+    abort ();
+  if (t12 != CST (2.0))
+    abort ();
+  if (t13 != CST (1.0))
+    abort ();
+  if (t14 != CST (0.0))
+    abort ();
+  if (t15 != CST (0.0))
+    abort ();
+  if (t16 != CST (0.0))
+    abort ();
+  if (t17 != CST (0.0))
+    abort ();
+  if (t18 != CST (0.0))
+    abort ();
+  if (t19 != CST (0.0))
+    abort ();
+  if (t20 != CST (0.0))
+    abort ();
+  if (t21 != CST (0.0))
+    abort ();
+  if (t22 != CST (0.0))
+    abort ();
+  if (t23 != CST (0.0))
+    abort ();
+  if (t24 != CST (0.0))
+    abort ();
+  if (t25 != CST (0.0))
+    abort ();
+  if (t26 != CST (0.0))
+    abort ();
+  if (t27 != CST (0.0))
+    abort ();
+  if (t28 != CST (2.0))
+    abort ();
+  if (t29 != CST (5.0))
+    abort ();
+  if (t30 != 0)
+    abort ();
+  if (t31 != 42)
+    abort ();
+  if (t32 != 42)
+    abort ();
+  if (t33 != CST (1.0))
+    abort ();
+  if (t34 != -CST (1.0))
+    abort ();
+  if (t35 != CST (2.0))
+    abort ();
+  if (t36 != CST (2.0))
+    abort ();
   exit (0);
 }

        Jakub

Reply via email to