* [PATCH] builtins: Add various complex builtins for _Float{16,32,64,128,32x,64x,128x}
2022-10-21 7:23 [PATCH] builtins: Add __builtin_nextafterf16b builtin Jakub Jelinek
@ 2022-10-21 15:42 ` Jakub Jelinek
2022-10-24 16:28 ` Jeff Law
2022-10-24 15:24 ` [PATCH] builtins: Add __builtin_nextafterf16b builtin Jeff Law
1 sibling, 1 reply; 5+ messages in thread
From: Jakub Jelinek @ 2022-10-21 15:42 UTC (permalink / raw)
To: Joseph S. Myers, Richard Biener, Jeff Law; +Cc: gcc-patches, Jonathan Wakely
Hi!
On top of the pending
https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603665.html
https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604080.html
the following patch adds some complex builtins which have libm
implementation in glibc 2.26 and later on various arches.
It is needed for libstdc++ _Float128 support when long double is not
IEEE quad.
Tested on x86_64-linux, ok for trunk?
2022-10-21 Jakub Jelinek <jakub@redhat.com>
* builtin-types.def (BT_COMPLEX_FLOAT16, BT_COMPLEX_FLOAT32,
BT_COMPLEX_FLOAT64, BT_COMPLEX_FLOAT128, BT_COMPLEX_FLOAT32X,
BT_COMPLEX_FLOAT64X, BT_COMPLEX_FLOAT128X,
BT_FN_COMPLEX_FLOAT16_COMPLEX_FLOAT16,
BT_FN_COMPLEX_FLOAT32_COMPLEX_FLOAT32,
BT_FN_COMPLEX_FLOAT64_COMPLEX_FLOAT64,
BT_FN_COMPLEX_FLOAT128_COMPLEX_FLOAT128,
BT_FN_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X,
BT_FN_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X,
BT_FN_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X,
BT_FN_FLOAT16_COMPLEX_FLOAT16, BT_FN_FLOAT32_COMPLEX_FLOAT32,
BT_FN_FLOAT64_COMPLEX_FLOAT64, BT_FN_FLOAT128_COMPLEX_FLOAT128,
BT_FN_FLOAT32X_COMPLEX_FLOAT32X, BT_FN_FLOAT64X_COMPLEX_FLOAT64X,
BT_FN_FLOAT128X_COMPLEX_FLOAT128X,
BT_FN_COMPLEX_FLOAT16_COMPLEX_FLOAT16_COMPLEX_FLOAT16,
BT_FN_COMPLEX_FLOAT32_COMPLEX_FLOAT32_COMPLEX_FLOAT32,
BT_FN_COMPLEX_FLOAT64_COMPLEX_FLOAT64_COMPLEX_FLOAT64,
BT_FN_COMPLEX_FLOAT128_COMPLEX_FLOAT128_COMPLEX_FLOAT128,
BT_FN_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X,
BT_FN_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X,
BT_FN_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X): New.
* builtins.def (CABS_TYPE, CACOSH_TYPE, CARG_TYPE, CASINH_TYPE,
CPOW_TYPE, CPROJ_TYPE): Define and undefine later.
(BUILT_IN_CABS, BUILT_IN_CACOSH, BUILT_IN_CACOS, BUILT_IN_CARG,
BUILT_IN_CASINH, BUILT_IN_CASIN, BUILT_IN_CATANH, BUILT_IN_CATAN,
BUILT_IN_CCOSH, BUILT_IN_CCOS, BUILT_IN_CEXP, BUILT_IN_CLOG,
BUILT_IN_CPOW, BUILT_IN_CPROJ, BUILT_IN_CSINH, BUILT_IN_CSIN,
BUILT_IN_CSQRT, BUILT_IN_CTANH, BUILT_IN_CTAN): Add
DEF_EXT_LIB_FLOATN_NX_BUILTINS.
* fold-const-call.cc (fold_const_call_sc, fold_const_call_cc,
fold_const_call_ccc): Add various CASE_CFN_*_FN: cases when
CASE_CFN_* is present.
* gimple-ssa-backprop.cc (backprop::process_builtin_call_use):
Likewise.
* builtins.cc (expand_builtin, fold_builtin_1): Likewise.
* fold-const.cc (negate_mathfn_p, tree_expr_finite_p,
tree_expr_maybe_signaling_nan_p, tree_expr_maybe_nan_p,
tree_expr_maybe_real_minus_zero_p, tree_call_nonnegative_warnv_p):
Likewise.
--- gcc/builtin-types.def.jj 2022-10-21 09:44:13.918939702 +0200
+++ gcc/builtin-types.def 2022-10-21 13:55:25.152070472 +0200
@@ -109,6 +109,34 @@ DEF_PRIMITIVE_TYPE (BT_FLOAT128X, (float
DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT, complex_float_type_node)
DEF_PRIMITIVE_TYPE (BT_COMPLEX_DOUBLE, complex_double_type_node)
DEF_PRIMITIVE_TYPE (BT_COMPLEX_LONGDOUBLE, complex_long_double_type_node)
+DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT16, (float16_type_node
+ ? build_complex_type
+ (float16_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT32, (float32_type_node
+ ? build_complex_type
+ (float32_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT64, (float64_type_node
+ ? build_complex_type
+ (float64_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT128, (float128_type_node
+ ? build_complex_type
+ (float128_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT32X, (float32x_type_node
+ ? build_complex_type
+ (float32x_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT64X, (float64x_type_node
+ ? build_complex_type
+ (float64x_type_node)
+ : error_mark_node))
+DEF_PRIMITIVE_TYPE (BT_COMPLEX_FLOAT128X, (float128x_type_node
+ ? build_complex_type
+ (float128x_type_node)
+ : error_mark_node))
DEF_PRIMITIVE_TYPE (BT_PTR, ptr_type_node)
DEF_PRIMITIVE_TYPE (BT_FILEPTR, fileptr_type_node)
@@ -242,12 +270,40 @@ DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_DOUBL
BT_COMPLEX_DOUBLE, BT_COMPLEX_DOUBLE)
DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE,
BT_COMPLEX_LONGDOUBLE, BT_COMPLEX_LONGDOUBLE)
+DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT16_COMPLEX_FLOAT16,
+ BT_COMPLEX_FLOAT16, BT_COMPLEX_FLOAT16)
+DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT32_COMPLEX_FLOAT32,
+ BT_COMPLEX_FLOAT32, BT_COMPLEX_FLOAT32)
+DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT64_COMPLEX_FLOAT64,
+ BT_COMPLEX_FLOAT64, BT_COMPLEX_FLOAT64)
+DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT128_COMPLEX_FLOAT128,
+ BT_COMPLEX_FLOAT128, BT_COMPLEX_FLOAT128)
+DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X,
+ BT_COMPLEX_FLOAT32X, BT_COMPLEX_FLOAT32X)
+DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X,
+ BT_COMPLEX_FLOAT64X, BT_COMPLEX_FLOAT64X)
+DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X,
+ BT_COMPLEX_FLOAT128X, BT_COMPLEX_FLOAT128X)
DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT_COMPLEX_FLOAT,
BT_FLOAT, BT_COMPLEX_FLOAT)
DEF_FUNCTION_TYPE_1 (BT_FN_DOUBLE_COMPLEX_DOUBLE,
BT_DOUBLE, BT_COMPLEX_DOUBLE)
DEF_FUNCTION_TYPE_1 (BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE,
BT_LONGDOUBLE, BT_COMPLEX_LONGDOUBLE)
+DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT16_COMPLEX_FLOAT16,
+ BT_FLOAT16, BT_COMPLEX_FLOAT16)
+DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT32_COMPLEX_FLOAT32,
+ BT_FLOAT32, BT_COMPLEX_FLOAT32)
+DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT64_COMPLEX_FLOAT64,
+ BT_FLOAT64, BT_COMPLEX_FLOAT64)
+DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT128_COMPLEX_FLOAT128,
+ BT_FLOAT128, BT_COMPLEX_FLOAT128)
+DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT32X_COMPLEX_FLOAT32X,
+ BT_FLOAT32X, BT_COMPLEX_FLOAT32X)
+DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT64X_COMPLEX_FLOAT64X,
+ BT_FLOAT64X, BT_COMPLEX_FLOAT64X)
+DEF_FUNCTION_TYPE_1 (BT_FN_FLOAT128X_COMPLEX_FLOAT128X,
+ BT_FLOAT128X, BT_COMPLEX_FLOAT128X)
DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_FLOAT_FLOAT,
BT_COMPLEX_FLOAT, BT_FLOAT)
DEF_FUNCTION_TYPE_1 (BT_FN_COMPLEX_DOUBLE_DOUBLE,
@@ -565,6 +621,20 @@ DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_DOUBL
BT_COMPLEX_DOUBLE, BT_COMPLEX_DOUBLE, BT_COMPLEX_DOUBLE)
DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE,
BT_COMPLEX_LONGDOUBLE, BT_COMPLEX_LONGDOUBLE, BT_COMPLEX_LONGDOUBLE)
+DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT16_COMPLEX_FLOAT16_COMPLEX_FLOAT16,
+ BT_COMPLEX_FLOAT16, BT_COMPLEX_FLOAT16, BT_COMPLEX_FLOAT16)
+DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT32_COMPLEX_FLOAT32_COMPLEX_FLOAT32,
+ BT_COMPLEX_FLOAT32, BT_COMPLEX_FLOAT32, BT_COMPLEX_FLOAT32)
+DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT64_COMPLEX_FLOAT64_COMPLEX_FLOAT64,
+ BT_COMPLEX_FLOAT64, BT_COMPLEX_FLOAT64, BT_COMPLEX_FLOAT64)
+DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT128_COMPLEX_FLOAT128_COMPLEX_FLOAT128,
+ BT_COMPLEX_FLOAT128, BT_COMPLEX_FLOAT128, BT_COMPLEX_FLOAT128)
+DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X_COMPLEX_FLOAT32X,
+ BT_COMPLEX_FLOAT32X, BT_COMPLEX_FLOAT32X, BT_COMPLEX_FLOAT32X)
+DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X_COMPLEX_FLOAT64X,
+ BT_COMPLEX_FLOAT64X, BT_COMPLEX_FLOAT64X, BT_COMPLEX_FLOAT64X)
+DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X_COMPLEX_FLOAT128X,
+ BT_COMPLEX_FLOAT128X, BT_COMPLEX_FLOAT128X, BT_COMPLEX_FLOAT128X)
DEF_FUNCTION_TYPE_2 (BT_FN_VOID_PTR_PTR, BT_VOID, BT_PTR, BT_PTR)
DEF_FUNCTION_TYPE_2 (BT_FN_INT_CONST_STRING_PTR_CONST_STRING,
BT_INT, BT_CONST_STRING, BT_PTR_CONST_STRING)
--- gcc/builtins.def.jj 2022-10-21 09:44:13.919939689 +0200
+++ gcc/builtins.def 2022-10-21 16:59:20.600317489 +0200
@@ -709,36 +709,54 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_YNL, "y
DEF_C99_COMPL_BUILTIN (BUILT_IN_CABS, "cabs", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CABSF, "cabsf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CABSL, "cabsl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+#define CABS_TYPE(F) BT_FN_##F##_COMPLEX_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CABS, "cabs", CABS_TYPE, ATTR_MATHFN_FPROUNDING)
+#undef CABS_TYPE
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOS, "cacos", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSF, "cacosf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSH, "cacosh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSHF, "cacoshf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSHL, "cacoshl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+#define CACOSH_TYPE(F) BT_FN_COMPLEX_##F##_COMPLEX_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CACOSH, "cacosh", CACOSH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CACOSL, "cacosl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CACOS, "cacos", CACOSH_TYPE, ATTR_MATHFN_FPROUNDING)
+#undef CACOSH_TYPE
DEF_C99_COMPL_BUILTIN (BUILT_IN_CARG, "carg", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CARGF, "cargf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CARGL, "cargl", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+#define CARG_TYPE(F) BT_FN_##F##_COMPLEX_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CARG, "carg", CARG_TYPE, ATTR_MATHFN_FPROUNDING)
+#undef CARG_TYPE
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASIN, "casin", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINF, "casinf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINH, "casinh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINHF, "casinhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINHL, "casinhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+#define CASINH_TYPE(F) BT_FN_COMPLEX_##F##_COMPLEX_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CASINH, "casinh", CASINH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CASINL, "casinl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CASIN, "casin", CASINH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATAN, "catan", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANF, "catanf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANH, "catanh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANHF, "catanhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANHL, "catanhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CATANH, "catanh", CASINH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CATANL, "catanl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CATAN, "catan", CASINH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOS, "ccos", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSF, "ccosf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSH, "ccosh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSHF, "ccoshf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSHL, "ccoshl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CCOSH, "ccosh", CASINH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CCOSL, "ccosl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CCOS, "ccos", CASINH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CEXP, "cexp", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CEXPF, "cexpf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CEXPL, "cexpl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CEXP, "cexp", CASINH_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_GCC_BUILTIN (BUILT_IN_CEXPI, "cexpi", BT_FN_COMPLEX_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_GCC_BUILTIN (BUILT_IN_CEXPIF, "cexpif", BT_FN_COMPLEX_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_GCC_BUILTIN (BUILT_IN_CEXPIL, "cexpil", BT_FN_COMPLEX_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
@@ -748,6 +766,8 @@ DEF_C99_COMPL_BUILTIN (BUILT_IN_C
DEF_C99_COMPL_BUILTIN (BUILT_IN_CLOG, "clog", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CLOGF, "clogf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CLOGL, "clogl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CLOG, "clog", CASINH_TYPE, ATTR_MATHFN_FPROUNDING)
+#undef CASINH_TYPE
DEF_EXT_C99RES_BUILTIN (BUILT_IN_CLOG10, "clog10", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_EXT_C99RES_BUILTIN (BUILT_IN_CLOG10F, "clog10f", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_EXT_C99RES_BUILTIN (BUILT_IN_CLOG10L, "clog10l", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
@@ -757,9 +777,14 @@ DEF_C99_COMPL_BUILTIN (BUILT_IN_C
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPOW, "cpow", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPOWF, "cpowf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPOWL, "cpowl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+#define CPOW_TYPE(F) BT_FN_COMPLEX_##F##_COMPLEX_##F##_COMPLEX_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CPOW, "cpow", CPOW_TYPE, ATTR_MATHFN_FPROUNDING)
+#undef CPOW_TYPE
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPROJ, "cproj", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPROJF, "cprojf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CPROJL, "cprojl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
+#define CPROJ_TYPE(F) BT_FN_COMPLEX_##F##_COMPLEX_##F
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CPROJ, "cproj", CPROJ_TYPE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CREAL, "creal", BT_FN_DOUBLE_COMPLEX_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CREALF, "crealf", BT_FN_FLOAT_COMPLEX_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CREALL, "creall", BT_FN_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
@@ -768,16 +793,22 @@ DEF_C99_COMPL_BUILTIN (BUILT_IN_C
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINH, "csinh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINHF, "csinhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINHL, "csinhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CSINH, "csinh", CPROJ_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSINL, "csinl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CSIN, "csin", CPROJ_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSQRT, "csqrt", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSQRTF, "csqrtf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CSQRTL, "csqrtl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CSQRT, "csqrt", CPROJ_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTAN, "ctan", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANF, "ctanf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANH, "ctanh", BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANHF, "ctanhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANHL, "ctanhl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CTANH, "ctanh", CPROJ_TYPE, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN (BUILT_IN_CTANL, "ctanl", BT_FN_COMPLEX_LONGDOUBLE_COMPLEX_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)
+DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_CTAN, "ctan", CPROJ_TYPE, ATTR_MATHFN_FPROUNDING)
+#undef CPROJ_TYPE
/* Category: string/memory builtins. */
DEF_EXT_LIB_BUILTIN (BUILT_IN_BCMP, "bcmp", BT_FN_INT_CONST_PTR_CONST_PTR_SIZE, ATTR_PURE_NOTHROW_NONNULL_LEAF)
--- gcc/fold-const-call.cc.jj 2022-10-21 09:44:13.919939689 +0200
+++ gcc/fold-const-call.cc 2022-10-21 16:59:58.028812651 +0200
@@ -1112,6 +1112,7 @@ fold_const_call_sc (real_value *result,
switch (fn)
{
CASE_CFN_CABS:
+ CASE_CFN_CABS_FN:
return do_mpfr_arg2 (result, mpfr_hypot, arg_real, arg_imag, format);
default:
@@ -1135,14 +1136,17 @@ fold_const_call_cc (real_value *result_r
switch (fn)
{
CASE_CFN_CCOS:
+ CASE_CFN_CCOS_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_cos,
arg_real, arg_imag, format);
CASE_CFN_CCOSH:
+ CASE_CFN_CCOSH_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_cosh,
arg_real, arg_imag, format);
CASE_CFN_CPROJ:
+ CASE_CFN_CPROJ_FN:
if (real_isinf (arg_real) || real_isinf (arg_imag))
{
*result_real = dconstinf;
@@ -1157,54 +1161,67 @@ fold_const_call_cc (real_value *result_r
return true;
CASE_CFN_CSIN:
+ CASE_CFN_CSIN_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_sin,
arg_real, arg_imag, format);
CASE_CFN_CSINH:
+ CASE_CFN_CSINH_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_sinh,
arg_real, arg_imag, format);
CASE_CFN_CTAN:
+ CASE_CFN_CTAN_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_tan,
arg_real, arg_imag, format);
CASE_CFN_CTANH:
+ CASE_CFN_CTANH_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_tanh,
arg_real, arg_imag, format);
CASE_CFN_CLOG:
+ CASE_CFN_CLOG_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_log,
arg_real, arg_imag, format);
CASE_CFN_CSQRT:
+ CASE_CFN_CSQRT_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_sqrt,
arg_real, arg_imag, format);
CASE_CFN_CASIN:
+ CASE_CFN_CASIN_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_asin,
arg_real, arg_imag, format);
CASE_CFN_CACOS:
+ CASE_CFN_CACOS_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_acos,
arg_real, arg_imag, format);
CASE_CFN_CATAN:
+ CASE_CFN_CATAN_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_atan,
arg_real, arg_imag, format);
CASE_CFN_CASINH:
+ CASE_CFN_CASINH_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_asinh,
arg_real, arg_imag, format);
CASE_CFN_CACOSH:
+ CASE_CFN_CACOSH_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_acosh,
arg_real, arg_imag, format);
CASE_CFN_CATANH:
+ CASE_CFN_CATANH_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_atanh,
arg_real, arg_imag, format);
CASE_CFN_CEXP:
+ CASE_CFN_CEXP_FN:
return do_mpc_arg1 (result_real, result_imag, mpc_exp,
arg_real, arg_imag, format);
@@ -1532,6 +1549,7 @@ fold_const_call_ccc (real_value *result_
switch (fn)
{
CASE_CFN_CPOW:
+ CASE_CFN_CPOW_FN:
return do_mpc_arg2 (result_real, result_imag, mpc_pow,
arg0_real, arg0_imag, arg1_real, arg1_imag, format);
--- gcc/gimple-ssa-backprop.cc.jj 2022-06-28 13:03:30.773691775 +0200
+++ gcc/gimple-ssa-backprop.cc 2022-10-21 13:50:12.943336688 +0200
@@ -351,10 +351,15 @@ backprop::process_builtin_call_use (gcal
break;
CASE_CFN_COS:
+ CASE_CFN_COS_FN:
CASE_CFN_COSH:
+ CASE_CFN_COSH_FN:
CASE_CFN_CCOS:
+ CASE_CFN_CCOS_FN:
CASE_CFN_CCOSH:
+ CASE_CFN_CCOSH_FN:
CASE_CFN_HYPOT:
+ CASE_CFN_HYPOT_FN:
/* The signs of all inputs are ignored. */
info->flags.ignore_sign = true;
break;
@@ -367,6 +372,7 @@ backprop::process_builtin_call_use (gcal
break;
CASE_CFN_POW:
+ CASE_CFN_POW_FN:
{
/* The sign of the first input is ignored as long as the second
input is an even real. */
--- gcc/builtins.cc.jj 2022-10-21 09:44:01.537108876 +0200
+++ gcc/builtins.cc 2022-10-21 13:33:39.310898575 +0200
@@ -7393,6 +7393,7 @@ expand_builtin (tree exp, rtx target, rt
/* Just do a normal library call if we were unable to fold
the values. */
CASE_FLT_FN (BUILT_IN_CABS):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_CABS):
break;
CASE_FLT_FN (BUILT_IN_FMA):
@@ -9661,6 +9662,7 @@ fold_builtin_1 (location_t loc, tree exp
break;
CASE_FLT_FN (BUILT_IN_CARG):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_CARG):
return fold_builtin_carg (loc, arg0, type);
case BUILT_IN_ISASCII:
--- gcc/fold-const.cc.jj 2022-10-21 09:44:01.540108835 +0200
+++ gcc/fold-const.cc 2022-10-21 16:59:47.280957627 +0200
@@ -322,36 +322,62 @@ negate_mathfn_p (combined_fn fn)
switch (fn)
{
CASE_CFN_ASIN:
+ CASE_CFN_ASIN_FN:
CASE_CFN_ASINH:
+ CASE_CFN_ASINH_FN:
CASE_CFN_ATAN:
+ CASE_CFN_ATAN_FN:
CASE_CFN_ATANH:
+ CASE_CFN_ATANH_FN:
CASE_CFN_CASIN:
+ CASE_CFN_CASIN_FN:
CASE_CFN_CASINH:
+ CASE_CFN_CASINH_FN:
CASE_CFN_CATAN:
+ CASE_CFN_CATAN_FN:
CASE_CFN_CATANH:
+ CASE_CFN_CATANH_FN:
CASE_CFN_CBRT:
+ CASE_CFN_CBRT_FN:
CASE_CFN_CPROJ:
+ CASE_CFN_CPROJ_FN:
CASE_CFN_CSIN:
+ CASE_CFN_CSIN_FN:
CASE_CFN_CSINH:
+ CASE_CFN_CSINH_FN:
CASE_CFN_CTAN:
+ CASE_CFN_CTAN_FN:
CASE_CFN_CTANH:
+ CASE_CFN_CTANH_FN:
CASE_CFN_ERF:
+ CASE_CFN_ERF_FN:
CASE_CFN_LLROUND:
+ CASE_CFN_LLROUND_FN:
CASE_CFN_LROUND:
+ CASE_CFN_LROUND_FN:
CASE_CFN_ROUND:
CASE_CFN_ROUNDEVEN:
CASE_CFN_ROUNDEVEN_FN:
CASE_CFN_SIN:
+ CASE_CFN_SIN_FN:
CASE_CFN_SINH:
+ CASE_CFN_SINH_FN:
CASE_CFN_TAN:
+ CASE_CFN_TAN_FN:
CASE_CFN_TANH:
+ CASE_CFN_TANH_FN:
CASE_CFN_TRUNC:
+ CASE_CFN_TRUNC_FN:
return true;
CASE_CFN_LLRINT:
+ CASE_CFN_LLRINT_FN:
CASE_CFN_LRINT:
+ CASE_CFN_LRINT_FN:
CASE_CFN_NEARBYINT:
+ CASE_CFN_NEARBYINT_FN:
CASE_CFN_RINT:
+ CASE_CFN_RINT_FN:
return !flag_rounding_math;
default:
@@ -14288,9 +14314,12 @@ tree_expr_finite_p (const_tree x)
switch (get_call_combined_fn (x))
{
CASE_CFN_FABS:
+ CASE_CFN_FABS_FN:
return tree_expr_finite_p (CALL_EXPR_ARG (x, 0));
CASE_CFN_FMAX:
+ CASE_CFN_FMAX_FN:
CASE_CFN_FMIN:
+ CASE_CFN_FMIN_FN:
return tree_expr_finite_p (CALL_EXPR_ARG (x, 0))
&& tree_expr_finite_p (CALL_EXPR_ARG (x, 1));
default:
@@ -14408,9 +14437,12 @@ tree_expr_maybe_signaling_nan_p (const_t
switch (get_call_combined_fn (x))
{
CASE_CFN_FABS:
+ CASE_CFN_FABS_FN:
return tree_expr_maybe_signaling_nan_p (CALL_EXPR_ARG (x, 0));
CASE_CFN_FMAX:
+ CASE_CFN_FMAX_FN:
CASE_CFN_FMIN:
+ CASE_CFN_FMIN_FN:
return tree_expr_maybe_signaling_nan_p (CALL_EXPR_ARG (x, 0))
|| tree_expr_maybe_signaling_nan_p (CALL_EXPR_ARG (x, 1));
default:
@@ -14481,9 +14513,12 @@ tree_expr_maybe_nan_p (const_tree x)
switch (get_call_combined_fn (x))
{
CASE_CFN_FABS:
+ CASE_CFN_FABS_FN:
return tree_expr_maybe_nan_p (CALL_EXPR_ARG (x, 0));
CASE_CFN_FMAX:
+ CASE_CFN_FMAX_FN:
CASE_CFN_FMIN:
+ CASE_CFN_FMIN_FN:
return tree_expr_maybe_nan_p (CALL_EXPR_ARG (x, 0))
|| tree_expr_maybe_nan_p (CALL_EXPR_ARG (x, 1));
default:
@@ -14520,6 +14555,7 @@ tree_expr_maybe_real_minus_zero_p (const
switch (get_call_combined_fn (x))
{
CASE_CFN_FABS:
+ CASE_CFN_FABS_FN:
return false;
default:
break;
@@ -14801,6 +14837,7 @@ tree_call_nonnegative_warnv_p (tree type
CASE_CFN_ACOSH:
CASE_CFN_ACOSH_FN:
CASE_CFN_CABS:
+ CASE_CFN_CABS_FN:
CASE_CFN_COSH:
CASE_CFN_COSH_FN:
CASE_CFN_ERFC:
Jakub
^ permalink raw reply [flat|nested] 5+ messages in thread