diff options
author | Michael Meissner <meissner@linux.vnet.ibm.com> | 2017-12-28 21:19:12 +0000 |
---|---|---|
committer | Michael Meissner <meissner@gcc.gnu.org> | 2017-12-28 21:19:12 +0000 |
commit | c6cfa2bfa09ac95dd01fa7927fa80274f9583823 (patch) | |
tree | 150679d60c4befc77e534f93d662b51e48277224 /gcc/gencfn-macros.c | |
parent | ec8a1b8d931ccdfa87d712028226a03ff17f6cef (diff) | |
download | gcc-c6cfa2bfa09ac95dd01fa7927fa80274f9583823.zip gcc-c6cfa2bfa09ac95dd01fa7927fa80274f9583823.tar.gz gcc-c6cfa2bfa09ac95dd01fa7927fa80274f9583823.tar.bz2 |
builtins.def: (_Float<N> and _Float<N>X BUILT_IN_CEIL): Add _Float<N> and _Float<N>X variants...
[gcc]
2017-12-28 Michael Meissner <meissner@linux.vnet.ibm.com>
* builtins.def: (_Float<N> and _Float<N>X BUILT_IN_CEIL): Add
_Float<N> and _Float<N>X variants for rounding built-in
functions.
(_Float<N> and _Float<N>X BUILT_IN_FLOOR): Likewise.
(_Float<N> and _Float<N>X BUILT_IN_NEARBYINT): Likewise.
(_Float<N> and _Float<N>X BUILT_IN_RINT): Likewise.
(_Float<N> and _Float<N>X BUILT_IN_ROUND): Likewise.
(_Float<N> and _Float<N>X BUILT_IN_TRUNC): Likewise.
* builtins.c (mathfn_built_in_2): Likewise.
* internal-fn.def (CEIL): Likewise.
(FLOOR): Likewise.
(NEARBYINT): Likewise.
(RINT): Likewise.
(ROUND): Likewise.
(TRUNC): Likewise.
* convert.c (convert_to_integer_1): Likewise.
* fold-const.c (tree_call_nonnegative_warnv_p): Likewise.
(integer_valued_real_call_p): Likewise.
* fold-const-call.c (fold_const_call_ss): Likewise.
* gencfn-macros.c (print_case_cfn): Change CFN and operator
printers to take a const char * suffix instead of a bool.
(print_define_operator_list): Likewise.
(fltall_suffixes): New list of suffixes, that include the
traditional suffixes as well as all of the _Float<N> and
_Float<N>X suffixes.
(main): For _Float<N> and _Float<N>X functions, emit both
<name>_FN and <name>_ALL variants. The <macro>_FN variant only
has the _Float<N> and _Float<N>X case names or operators. The
<name>_ALL variant has both the traditional and the
_Float<N>/_Float<N>X case names or operators.
* match.pd (COPYSIGN optimizations): Provide optimizations for
_Float<N> and _Float<N>X types where possible.
(MIN/MAX optimizations): Likewise.
(sqrt optimizations): Likewise.
(rounding optimizations): Likewise.
[gcc/c]
2017-12-28 Michael Meissner <meissner@linux.vnet.ibm.com>
* c-decl.c (header_for_builtin_fn): Add integer rounding _Float<N>
and _Float<N>X built-in functions.
From-SVN: r256026
Diffstat (limited to 'gcc/gencfn-macros.c')
-rw-r--r-- | gcc/gencfn-macros.c | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/gcc/gencfn-macros.c b/gcc/gencfn-macros.c index 5b38ac2..ae5b0c9 100644 --- a/gcc/gencfn-macros.c +++ b/gcc/gencfn-macros.c @@ -94,13 +94,15 @@ is_group (string_set *builtins, const char *name, const char *const *suffixes) /* Print a macro for all combined functions related to NAME, with the null-terminated list of suffixes in SUFFIXES. INTERNAL_P says whether - CFN_<NAME> also exists. */ + CFN_<NAME> also exists. FLOATN_P is a suffix to the operator name, blank + for normal operators, "_FN" for _Float<N>/_Float<N>X operators only, and + "_ALL" for both the traditional operators and the _Float<N>/_Float<N>X + operators. */ static void print_case_cfn (const char *name, bool internal_p, - const char *const *suffixes, bool floatn_p) + const char *const *suffixes, const char *floatn) { - const char *floatn = (floatn_p) ? "_FN" : ""; printf ("#define CASE_CFN_%s%s", name, floatn); if (internal_p) printf (" \\\n case CFN_%s%s", name, floatn); @@ -110,15 +112,18 @@ print_case_cfn (const char *name, bool internal_p, printf ("\n"); } -/* Print an operator list for all combined functions related to NAME, - with the null-terminated list of suffixes in SUFFIXES. INTERNAL_P - says whether CFN_<NAME> also exists. */ +/* Print an operator list for all combined functions related to NAME, with the + null-terminated list of suffixes in SUFFIXES. INTERNAL_P says whether + CFN_<NAME> also exists. FLOATN_P is a suffix to the operator name, blank + for normal operators, "_FN" for _Float<N>/_Float<N>X operators only, and + "_ALL" for both the traditional operators and the _Float<N>/_Float<N>X + operators. */ static void print_define_operator_list (const char *name, bool internal_p, - const char *const *suffixes, bool floatn_p) + const char *const *suffixes, + const char *floatn) { - const char *floatn = (floatn_p) ? "_FN" : ""; printf ("(define_operator_list %s%s\n", name, floatn); for (unsigned int i = 0; suffixes[i]; ++i) printf (" BUILT_IN_%s%s\n", name, suffixes[i]); @@ -152,6 +157,9 @@ const char *const internal_fn_int_names[] = { static const char *const flt_suffixes[] = { "F", "", "L", NULL }; static const char *const fltfn_suffixes[] = { "F16", "F32", "F64", "F128", "F32X", "F64X", "F128X", NULL }; +static const char *const fltall_suffixes[] = { "F", "", "L", "F16", "F32", + "F64", "F128", "F32X", "F64X", + "F128X", NULL }; static const char *const int_suffixes[] = { "", "L", "LL", "IMAX", NULL }; static const char *const *const suffix_lists[] = { @@ -212,22 +220,31 @@ main (int argc, char **argv) bool internal_p = internal_fns.contains (root); if (type == 'c') - print_case_cfn (root, internal_p, suffix, false); + print_case_cfn (root, internal_p, suffix, ""); else - print_define_operator_list (root, internal_p, - suffix, false); + print_define_operator_list (root, internal_p, suffix, ""); /* Support the _Float<N> and _Float<N>X math functions if - they exist. We put these out as a separate CFN macro, - so code can add support or not as needed. */ + they exist. We put these out as a separate CFN or + operator macro, so code can add support or not as + needed. We also put out a combined CFN or operator + macro that includes both the traditional names and the + _Float<N> and _Float<N>X versions. */ if (suffix == flt_suffixes && is_group (&builtins, root, fltfn_suffixes)) { if (type == 'c') - print_case_cfn (root, false, fltfn_suffixes, true); + { + print_case_cfn (root, false, fltfn_suffixes, "_FN"); + print_case_cfn (root, false, fltall_suffixes, "_ALL"); + } else - print_define_operator_list (root, false, fltfn_suffixes, - true); + { + print_define_operator_list (root, false, + fltfn_suffixes, "_FN"); + print_define_operator_list (root, internal_p, + fltall_suffixes, "_ALL"); + } } } } |