From ee5fd23a481f510528e00f4c988ed0e6a71218c2 Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Fri, 27 Oct 2017 18:15:38 +0000 Subject: builtins.c (CASE_MATHFN_FLOATN): New helper macro to add cases for math functions that have _Float and... [gcc] 2017-10-27 Michael Meissner * builtins.c (CASE_MATHFN_FLOATN): New helper macro to add cases for math functions that have _Float and _FloatX variants. (mathfn_built_in_2): Add support for math functions that have _Float and _FloatX variants. (DEF_INTERNAL_FLT_FLOATN_FN): New helper macro. (expand_builtin_mathfn_ternary): Add support for fma with _Float and _FloatX variants. (expand_builtin): Likewise. (fold_builtin_3): Likewise. * builtins.def (DEF_EXT_LIB_FLOATN_NX_BUILTINS): New macro to create math function _Float and _FloatX variants as external library builtins. (BUILT_IN_COPYSIGN _Float and _FloatX variants) Use DEF_EXT_LIB_FLOATN_NX_BUILTINS to make built-in functions using the __builtin_ prefix and if not strict ansi, without the prefix. (BUILT_IN_FABS _Float and _FloatX variants): Likewise. (BUILT_IN_FMA _Float and _FloatX variants): Likewise. (BUILT_IN_FMAX _Float and _FloatX variants): Likewise. (BUILT_IN_FMIN _Float and _FloatX variants): Likewise. (BUILT_IN_NAN _Float and _FloatX variants): Likewise. (BUILT_IN_SQRT _Float and _FloatX variants): Likewise. * builtin-types.def (BT_FN_FLOAT16_FLOAT16_FLOAT16_FLOAT16): New function signatures for fma _Float and _FloatX variants. (BT_FN_FLOAT32_FLOAT32_FLOAT32_FLOAT32): Likewise. (BT_FN_FLOAT64_FLOAT64_FLOAT64_FLOAT64): Likewise. (BT_FN_FLOAT128_FLOAT128_FLOAT128_FLOAT128): Likewise. (BT_FN_FLOAT32X_FLOAT32X_FLOAT32X_FLOAT32X): Likewise. (BT_FN_FLOAT64X_FLOAT64X_FLOAT64X_FLOAT64X): Likewise. (BT_FN_FLOAT128X_FLOAT128X_FLOAT128X_FLOAT128X): Likewise. * gencfn-macros.c (print_case_cfn): Add support for math functions that have _Float and _FloatX variants. (print_define_operator_list): Likewise. (fltfn_suffixes): Likewise. (main): Likewise. * internal-fn.def (DEF_INTERNAL_FLT_FLOATN_FN): New helper macro for math functions that have _Float and _FloatX variants. (SQRT): Add support for sqrt, copysign, fmin and fmax _Float and _FloatX variants. (COPYSIGN): Likewise. (FMIN): Likewise. (FMAX): Likewise. * fold-const.c (tree_call_nonnegative_warnv_p): Add support for copysign, fma, fmax, fmin, and sqrt _Float and _FloatX variants. (integer_valued_read_call_p): Likewise. * fold-const-call.c (fold_const_call_ss): Likewise. (fold_const_call_sss): Add support for copysign, fmin, and fmax _Float and _FloatX variants. (fold_const_call_ssss): Add support for fma _Float and _FloatX variants. * gimple-ssa-backprop.c (backprop::process_builtin_call_use): Add support for copysign and fma _Float and _FloatX variants. (backprop::process_builtin_call_use): Likewise. * tree-call-cdce.c (can_test_argument_range); Add support for sqrt _Float and _FloatX variants. (edom_only_function): Likewise. (get_no_error_domain): Likewise. * tree-ssa-math-opts.c (internal_fn_reciprocal): Likewise. * tree-ssa-reassoc.c (attempt_builtin_copysign): Add support for copysign _Float and _FloatX variants. * config/rs6000/rs6000-builtin.def (SQRTF128): Delete, this is now handled by machine independent code. (FMAF128): Likewise. * doc/cpp.texi (Common Predefined Macros): Document defining __FP_FAST_FMAF and __FP_FAST_FMAFX if the backend supports fma _Float and _FloatX variants. [gcc/c] 2017-10-27 Michael Meissner * c-decl.c (header_for_builtin_fn): Add support for copysign, fma, fmax, fmin, and sqrt _Float and _FloatX variants. [gcc/c-family] 2017-10-27 Michael Meissner * c-cppbuiltin.c (mode_has_fma): Add support for PowerPC KFmode. (c_cpp_builtins): If a machine has a fast fma _Float and _FloatX variant, define __FP_FAST_FMA and/or __FP_FAST_FMAX. [gcc/testsuite] 2017-10-27 Michael Meissner * gcc.target/powerpc/float128-hw.c: Add support for all 4 FMA variants. Check various conversions to/from float128. Check negation. Use {\m...\M} in the tests. * gcc.target/powerpc/float128-hw2.c: New test for implicit _Float128 math functions. * gcc.target/powerpc/float128-hw3.c: New test for strict ansi mode not implicitly adding the _Float128 math functions. * gcc.target/powerpc/float128-fma2.c: Delete, test is no longer valid. * gcc.target/powerpc/float128-sqrt2.c: Likewise. From-SVN: r254168 --- gcc/tree-ssa-reassoc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/tree-ssa-reassoc.c') diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index cb438c7..5e8cac6 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -5625,6 +5625,7 @@ attempt_builtin_copysign (vec *ops) switch (gimple_call_combined_fn (old_call)) { CASE_CFN_COPYSIGN: + CASE_CFN_COPYSIGN_FN: arg0 = gimple_call_arg (old_call, 0); arg1 = gimple_call_arg (old_call, 1); /* The first argument of copysign must be a constant, -- cgit v1.1