aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2022-10-31 09:05:02 +0100
committerJakub Jelinek <jakub@redhat.com>2022-10-31 09:05:02 +0100
commit7f940822816917fea276654514eccdc8eacd5e93 (patch)
treea8da6f8e3d3e1dc52ad39d190084547401cac824 /gcc/rust
parent58685b939bb1738d23750fad29035f8055fd4315 (diff)
downloadgcc-7f940822816917fea276654514eccdc8eacd5e93.zip
gcc-7f940822816917fea276654514eccdc8eacd5e93.tar.gz
gcc-7f940822816917fea276654514eccdc8eacd5e93.tar.bz2
builtins: Add various __builtin_*f{16,32,64,128,32x,64x,128x} builtins
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. 2022-10-31 Jakub Jelinek <jakub@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.
Diffstat (limited to 'gcc/rust')
0 files changed, 0 insertions, 0 deletions