summaryrefslogtreecommitdiff
path: root/gcc/convert.c
diff options
context:
space:
mode:
authorMichael Meissner <meissner@linux.vnet.ibm.com>2017-12-28 21:19:12 +0000
committerMichael Meissner <meissner@gcc.gnu.org>2017-12-28 21:19:12 +0000
commitc6cfa2bfa09ac95dd01fa7927fa80274f9583823 (patch)
tree150679d60c4befc77e534f93d662b51e48277224 /gcc/convert.c
parentec8a1b8d931ccdfa87d712028226a03ff17f6cef (diff)
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/convert.c')
-rw-r--r--gcc/convert.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/convert.c b/gcc/convert.c
index 25aa5adf880..1607bededbc 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -554,6 +554,7 @@ convert_to_integer_1 (tree type, tree expr, bool dofold)
switch (fcode)
{
CASE_FLT_FN (BUILT_IN_CEIL):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_CEIL):
/* Only convert in ISO C99 mode. */
if (!targetm.libc_has_function (function_c99_misc))
break;
@@ -570,6 +571,7 @@ convert_to_integer_1 (tree type, tree expr, bool dofold)
break;
CASE_FLT_FN (BUILT_IN_FLOOR):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_FLOOR):
/* Only convert in ISO C99 mode. */
if (!targetm.libc_has_function (function_c99_misc))
break;
@@ -586,6 +588,7 @@ convert_to_integer_1 (tree type, tree expr, bool dofold)
break;
CASE_FLT_FN (BUILT_IN_ROUND):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_ROUND):
/* Only convert in ISO C99 mode and with -fno-math-errno. */
if (!targetm.libc_has_function (function_c99_misc) || flag_errno_math)
break;
@@ -602,11 +605,13 @@ convert_to_integer_1 (tree type, tree expr, bool dofold)
break;
CASE_FLT_FN (BUILT_IN_NEARBYINT):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_NEARBYINT):
/* Only convert nearbyint* if we can ignore math exceptions. */
if (flag_trapping_math)
break;
gcc_fallthrough ();
CASE_FLT_FN (BUILT_IN_RINT):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_RINT):
/* Only convert in ISO C99 mode and with -fno-math-errno. */
if (!targetm.libc_has_function (function_c99_misc) || flag_errno_math)
break;
@@ -623,6 +628,7 @@ convert_to_integer_1 (tree type, tree expr, bool dofold)
break;
CASE_FLT_FN (BUILT_IN_TRUNC):
+ CASE_FLT_FN_FLOATN_NX (BUILT_IN_TRUNC):
return convert_to_integer_1 (type, CALL_EXPR_ARG (s_expr, 0), dofold);
default: