aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorUros Bizjak <uros@kss-loka.si>2005-04-11 08:16:39 +0200
committerUros Bizjak <uros@gcc.gnu.org>2005-04-11 08:16:39 +0200
commitf94b16611c30340d61468354814e63916bd08303 (patch)
tree4f8876fc98292146b6f2b8bf4a5835e8ae42a92c /gcc/builtins.c
parent0dbca30748132482886593434b14d7242cdee9ad (diff)
downloadgcc-f94b16611c30340d61468354814e63916bd08303.zip
gcc-f94b16611c30340d61468354814e63916bd08303.tar.gz
gcc-f94b16611c30340d61468354814e63916bd08303.tar.bz2
* builtins.def (BUILT_IN_LCEIL, BUILT_IN_LCEILF, BUILT_IN_LCEILL)
(BUILT_IN_LLCEIL, BUILT_IN_LLCEILF, BUILT_IN_LLCEILL): New. * optabs.h (enum optab_index): Add new OTI_lceil. (lceil_optab): Define corresponding macro. * optabs.c (init_optabs): Initialize lceil_optab. * genopinit.c (optabs): Implement lceil_optab using lceilsi2 and lceildi2 patterns. * builtins.c (expand_builtin_int_roundingfn): Handle BUILT_IN_LCEIL{,F,L} and BUILT_IN_LLCEIL{,F,L}. (fold_builtin_int_roundingfn): Handle BUILT_IN_LCEIL{,F,L} and BUILT_IN_LLCEIL{,F,L}. (fold_builtin_1): Fold BUILT_IN_LCEIL{,F,L} and BUILT_IN_LLCEIL{,F,L} using fold_builtin_int_roundingfn. (mathfn_built_in): Handle BUILT_IN LCEIL and BUILT_IN_LLCEIL. (expand_builtin): Expand BUILT_IN_LCEIL{,F,L} and BUILT_IN_LLCEIL{,F,L} using expand_builtin_int_roundingfn. * convert.c (convert_to_integer): Convert (long int)ceil{,f,l}, into lceil built-in function and (long long int)ceil{,f,l} into llceil built-in function. * fold-const.c (tree_expr_nonnegative_p): Add BUILT_IN_LCEIL and BUILT_IN_LLCEIL. testsuite: * gcc.dg/builtins-53.c: Also check (int)ceil* and (long long int)ceil*. From-SVN: r97964
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 034934c..b7ddb74 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -1549,9 +1549,11 @@ mathfn_built_in (tree type, enum built_in_function fn)
CASE_MATHFN (BUILT_IN_J0)
CASE_MATHFN (BUILT_IN_J1)
CASE_MATHFN (BUILT_IN_JN)
+ CASE_MATHFN (BUILT_IN_LCEIL)
CASE_MATHFN (BUILT_IN_LDEXP)
CASE_MATHFN (BUILT_IN_LFLOOR)
CASE_MATHFN (BUILT_IN_LGAMMA)
+ CASE_MATHFN (BUILT_IN_LLCEIL)
CASE_MATHFN (BUILT_IN_LLFLOOR)
CASE_MATHFN (BUILT_IN_LLRINT)
CASE_MATHFN (BUILT_IN_LLROUND)
@@ -2141,6 +2143,16 @@ expand_builtin_int_roundingfn (tree exp, rtx target, rtx subtarget)
switch (DECL_FUNCTION_CODE (fndecl))
{
+ case BUILT_IN_LCEIL:
+ case BUILT_IN_LCEILF:
+ case BUILT_IN_LCEILL:
+ case BUILT_IN_LLCEIL:
+ case BUILT_IN_LLCEILF:
+ case BUILT_IN_LLCEILL:
+ builtin_optab = lceil_optab;
+ fallback_fn = BUILT_IN_CEIL;
+ break;
+
case BUILT_IN_LFLOOR:
case BUILT_IN_LFLOORF:
case BUILT_IN_LFLOORL:
@@ -5376,6 +5388,12 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
return target;
break;
+ case BUILT_IN_LCEIL:
+ case BUILT_IN_LCEILF:
+ case BUILT_IN_LCEILL:
+ case BUILT_IN_LLCEIL:
+ case BUILT_IN_LLCEILF:
+ case BUILT_IN_LLCEILL:
case BUILT_IN_LFLOOR:
case BUILT_IN_LFLOORF:
case BUILT_IN_LFLOORL:
@@ -6771,6 +6789,15 @@ fold_builtin_int_roundingfn (tree fndecl, tree arglist)
real_floor (&r, TYPE_MODE (ftype), &x);
break;
+ case BUILT_IN_LCEIL:
+ case BUILT_IN_LCEILF:
+ case BUILT_IN_LCEILL:
+ case BUILT_IN_LLCEIL:
+ case BUILT_IN_LLCEILF:
+ case BUILT_IN_LLCEILL:
+ real_ceil (&r, TYPE_MODE (ftype), &x);
+ break;
+
case BUILT_IN_LROUND:
case BUILT_IN_LROUNDF:
case BUILT_IN_LROUNDL:
@@ -8328,6 +8355,12 @@ fold_builtin_1 (tree fndecl, tree arglist, bool ignore)
case BUILT_IN_RINTL:
return fold_trunc_transparent_mathfn (fndecl, arglist);
+ case BUILT_IN_LCEIL:
+ case BUILT_IN_LCEILF:
+ case BUILT_IN_LCEILL:
+ case BUILT_IN_LLCEIL:
+ case BUILT_IN_LLCEILF:
+ case BUILT_IN_LLCEILL:
case BUILT_IN_LFLOOR:
case BUILT_IN_LFLOORF:
case BUILT_IN_LFLOORL: