This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][fortran] Add {l,ll}{ceil,floor,round} builtins
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: fortran at gcc dot gnu dot org
- Date: Tue, 6 Dec 2005 21:25:05 +0100 (CET)
- Subject: [PATCH][fortran] Add {l,ll}{ceil,floor,round} builtins
Built on x86_64-unknown-linux-gnu.
Ok for mainline?
Thanks,
Richard.
2005-12-06 Richard Guenther <rguenther@suse.de>
* c99builtins.def: Add {l,ll}{ceil,floor,round} builtins.
* f95-lang.c (build_builtin_fntypes): Build two additional
types with return type long and long long.
(gfc_init_builtin_functions): Adjust type arrays size.
Index: src/gcc-svn/gcc/fortran/c99builtins.def
===================================================================
--- src.orig/gcc-svn/gcc/fortran/c99builtins.def 2005-12-06 20:29:21.000000000 +0100
+++ src/gcc-svn/gcc/fortran/c99builtins.def 2005-12-06 21:17:08.000000000 +0100
@@ -9,6 +9,12 @@
This list is for C99 builtins used by the middle-end that do
not have a corresponding intrinsic in the fortran frontend. */
DEFINE_MATH_BUILTIN (COPYSIGN, "copysign", 1)
+DEFINE_MATH_BUILTIN (LLCEIL, "llceil", 5)
+DEFINE_MATH_BUILTIN (LLFLOOR, "llfloor", 5)
+DEFINE_MATH_BUILTIN (LLROUND, "llround", 5)
+DEFINE_MATH_BUILTIN (LCEIL, "lceil", 4)
+DEFINE_MATH_BUILTIN (LFLOOR, "lfloor", 4)
+DEFINE_MATH_BUILTIN (LROUND, "lround", 4)
DEFINE_MATH_BUILTIN (POW, "pow", 1)
DEFINE_MATH_BUILTIN (ROUND, "round", 0)
DEFINE_MATH_BUILTIN (TRUNC, "trunc", 0)
Index: src/gcc-svn/gcc/fortran/f95-lang.c
===================================================================
--- src.orig/gcc-svn/gcc/fortran/f95-lang.c 2005-12-06 20:30:08.000000000 +0100
+++ src/gcc-svn/gcc/fortran/f95-lang.c 2005-12-06 21:03:47.000000000 +0100
@@ -774,6 +774,10 @@
/* type (*) (type) */
tmp = tree_cons (NULL_TREE, float_type_node, void_list_node);
fntype[0] = build_function_type (type, tmp);
+ /* long (*) (type) */
+ fntype[3] = build_function_type (long_integer_type_node, tmp);
+ /* long long (*) (type) */
+ fntype[4] = build_function_type (long_long_integer_type_node, tmp);
/* type (*) (type, type) */
tmp = tree_cons (NULL_TREE, float_type_node, tmp);
fntype[1] = build_function_type (type, tmp);
@@ -789,12 +793,12 @@
static void
gfc_init_builtin_functions (void)
{
- tree mfunc_float[3];
- tree mfunc_double[3];
- tree mfunc_longdouble[3];
- tree mfunc_cfloat[3];
- tree mfunc_cdouble[3];
- tree mfunc_clongdouble[3];
+ tree mfunc_float[5];
+ tree mfunc_double[5];
+ tree mfunc_longdouble[5];
+ tree mfunc_cfloat[5];
+ tree mfunc_cdouble[5];
+ tree mfunc_clongdouble[5];
tree func_cfloat_float;
tree func_cdouble_double;
tree func_clongdouble_longdouble;