This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Thu, Oct 19, 2017 at 10:15:44PM +0000, Joseph Myers wrote: > On Thu, 19 Oct 2017, Michael Meissner wrote: > > > 1) I switched to use DEF_EXT_LIB_BUILTIN to declare the _Float<N> and > > _Float<N>X functions. This allows treating __builtin_sqrtf128 the same > > as sqrtf128. > > It's not correct to do that unconditionally for all the existing > DEF_GCC_FLOATN_NX_BUILTINS functions. There should not be a public > huge_valf128 function any more than a public huge_val function, just > __builtin_huge_valf128. > > Rather, you should add a new DEF_EXT_LIB_FLOATN_NX_BUILTINS. It should be > used by the new functions, and by the existing copysign / fabs / nan > functions. It should not be used by the existing huge_val / inf / nans > functions. This patch adds a new switch (-fimplicit-math-floatn) that when enabled, it will add implicit declarations for copysign, fabs, fma, fmax, fmin, nan, and sqrt _Float<N> and _Float<N>X variants. Like the previous patch, it adds fma, fmax, fmin, and sqrt builtins to the machine independent built-in support, and removed the PowerPC specific __builtin_{sqrt,fma}f128 functions. I have bootstrapped this patch on a little endian power8 system and an x86-64 system. There were no regressions in either system. I added powerpc specific tests for -f{,no-}implicit-math-floatn. Can I check this patch into the trunk? [gcc] 2017-10-24 Michael Meissner <meissner@linux.vnet.ibm.com> * builtins.c (CASE_MATHFN_FLOATN): New helper macro to add cases for math functions that have _Float<N> and _Float<N>X variants. (mathfn_built_in_2): Add support for math functions that have _Float<N> and _Float<N>X variants. (DEF_INTERNAL_FLT_FLOATN_FN): New helper macro. (expand_builtin_mathfn_ternary): Add support for fma with _Float<N> and _Float<N>X variants. (expand_builtin): Likewise. (fold_builtin_3): Likewise. * builtins.def (DEF_FLOATFN_BUILTIN_2): New macros. If -fimplicit-math-floatn is on, treat the _Float<N> and _Float<N>X variants like DEF_EXT_LIB_BUILTINs where both <foo> and __builtin_<foo> are implicitly declared. If -fimplicit-math-floatn is off, treat the variants like DEF_GCC_BUILTIN where only the __builtin_<foo> is implicitly declared. (DEF_FLOATFN_BUILTINS): Likewise. (BUILT_IN_COPYSIGN _Float<N> and _Float<N>X variants) Replace DEF_GCC_FLOATN_NX_BUILTINS with DEF_FLOATFN_BUILTINS. Add fma, fmax, fmin, sqrt versions. Do not replace huge_val, inf, and nans. (BUILT_IN_FABS _Float<N> and _Float<N>X variants): Likewise. (BUILT_IN_FMA _Float<N> and _Float<N>X variants): Likewise. (BUILT_IN_FMAX _Float<N> and _Float<N>X variants): Likewise. (BUILT_IN_FMIN _Float<N> and _Float<N>X variants): Likewise. (BUILT_IN_NAN _Float<N> and _Float<N>X variants): Likewise. (BUILT_IN_SQRT _Float<N> and _Float<N>X variants): Likewise. * builtin-types.def (BT_FN_FLOAT16_FLOAT16_FLOAT16_FLOAT16): New function signatures for fma _Float<N> and _Float<N>X 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<N> and _Float<N>X 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<N> and _Float<N>X variants. (SQRT): Add support for sqrt, copysign, fmin and fmax _Float<N> and _Float<N>X 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<N> and _Float<N>X 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<N> and _Float<N>X variants. (fold_const_call_ssss): Add support for fma _Float<N> and _Float<N>X variants. * gimple-ssa-backprop.c (backprop::process_builtin_call_use): Add support for copysign and fma _Float<N> and _Float<N>X variants. (backprop::process_builtin_call_use): Likewise. * tree-call-cdce.c (can_test_argument_range); Add support for sqrt _Float<N> and _Float<N>X 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<N> and _Float<N>X variants. * config/rs6000/rs6000-builtin.def (SQRTF128): Delete, this is now handled by machine independent code. (FMAF128): Likewise. * doc/invoke.texi (C Dialect Options): Document -fimplicit-math-floatn. [gcc/c] 2017-10-24 Michael Meissner <meissner@linux.vnet.ibm.com> * c-decl.c (header_for_builtin_fn): Add support for copysign, fma, fmax, fmin, and sqrt _Float<N> and _Float<N>X variants. [gcc/c-family] 2017-10-24 Michael Meissner <meissner@linux.vnet.ibm.com> * c-cppbuiltin.c (mode_has_fma): Add support for PowerPC KFmode. (c_cpp_builtins): If -fimplicit-math-floatn and the machine has a fast fma _Float<N> and _Float<N>X variant, define __FP_FAST_FMA<N> and __FP_FAST_FMA<N>X. * c.opt (-fimplicit-math-floatn): New switch to enable making _Float<N> and _Float<N>X variant math functions implicitly declared without the __builtin_ prefix. [gcc/testsuite] 2017-10-24 Michael Meissner <meissner@linux.vnet.ibm.com> * gcc.target/powerpc/float128-hw.c: Add support for all 4 FMA variants. Check conversion from __float128 to float uses truncate with round to odd. Use {\m...\M} in the tests. * gcc.target/powerpc/float128-hw2.c: New test for -fimplicit-math-floatn. * gcc.target/powerpc/float128-hw3.c: New test for -fno-implicit-math-floatn. * gcc.target/powerpc/float128-fma2.c: Delete, test is no longer valid. * gcc.target/powerpc/float128-sqrt2.c: Likewise. -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797
Attachment:
ieee128-patch43b
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |