diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-10-31 09:09:48 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-10-31 09:09:48 +0100 |
commit | 259a11555c90783e53c046c310080407ee54a31e (patch) | |
tree | cf07e197c437b0355701a5c0a71e6336caeb088d /gcc/fold-const.cc | |
parent | 29490c2a1dc00944f2420eb59374705f180a2e53 (diff) | |
download | gcc-259a11555c90783e53c046c310080407ee54a31e.zip gcc-259a11555c90783e53c046c310080407ee54a31e.tar.gz gcc-259a11555c90783e53c046c310080407ee54a31e.tar.bz2 |
builtins: Add various complex builtins for _Float{16,32,64,128,32x,64x,128x}
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.
2022-10-31 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.
Diffstat (limited to 'gcc/fold-const.cc')
-rw-r--r-- | gcc/fold-const.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index 16384a8..7e1ea58 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -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_tree x) 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_tree x) 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, combined_fn fn, tree arg0, tree arg1, CASE_CFN_ACOSH: CASE_CFN_ACOSH_FN: CASE_CFN_CABS: + CASE_CFN_CABS_FN: CASE_CFN_COSH: CASE_CFN_COSH_FN: CASE_CFN_ERFC: |