aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/f95-lang.c
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2007-08-03 21:26:10 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2007-08-03 21:26:10 +0000
commit94f548c244426f45bab1ae19d3359aa2b651dce0 (patch)
treeb3c3360111641d52b502bddd36c0a4ce24d565cf /gcc/fortran/f95-lang.c
parent8db6f5454c392b098080e297de645be106d621af (diff)
downloadgcc-94f548c244426f45bab1ae19d3359aa2b651dce0.zip
gcc-94f548c244426f45bab1ae19d3359aa2b651dce0.tar.gz
gcc-94f548c244426f45bab1ae19d3359aa2b651dce0.tar.bz2
re PR fortran/31202 (Incorrect rounding generated for NINT)
PR fortran/31202 * f95-lang.c (gfc_init_builtin_functions): Defin builtins for lround{f,,l} and llround{f,,l}. * trans-intrinsic.c (build_fix_expr): Generate calls to the {l,}round{f,,l} functions. * intrinsics/c99_functions.c (roundl,lroundf,lround,lroundl, llroundf,llround,llroundl): New functions. * c99_protos.h (roundl,lroundf,lround,lroundl,llroundf,llround, llroundl): New prototypes. * configure.ac: Check for lroundf, lround, lroundl, llroundf, llround and llroundl. * configure: Regenerate. * Makefile.in: Regenerate. * config.h.in: Regenerate. * gfortran.dg/nint_2.f90: New test. From-SVN: r127185
Diffstat (limited to 'gcc/fortran/f95-lang.c')
-rw-r--r--gcc/fortran/f95-lang.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index 0cecac0..425f4d3 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -852,7 +852,7 @@ gfc_init_builtin_functions (void)
tree func_double_doublep_doublep;
tree func_longdouble_longdoublep_longdoublep;
tree ftype, ptype;
- tree tmp;
+ tree tmp, type;
tree builtin_types[(int) BT_LAST + 1];
build_builtin_fntypes (mfunc_float, float_type_node);
@@ -942,6 +942,31 @@ gfc_init_builtin_functions (void)
gfc_define_builtin ("__builtin_fmodf", mfunc_float[1],
BUILT_IN_FMODF, "fmodf", true);
+ /* lround{f,,l} and llround{f,,l} */
+ type = tree_cons (NULL_TREE, float_type_node, void_list_node);
+ tmp = build_function_type (long_integer_type_node, type);
+ gfc_define_builtin ("__builtin_lroundf", tmp, BUILT_IN_LROUNDF,
+ "lroundf", true);
+ tmp = build_function_type (long_long_integer_type_node, type);
+ gfc_define_builtin ("__builtin_llroundf", tmp, BUILT_IN_LLROUNDF,
+ "llroundf", true);
+
+ type = tree_cons (NULL_TREE, double_type_node, void_list_node);
+ tmp = build_function_type (long_integer_type_node, type);
+ gfc_define_builtin ("__builtin_lround", tmp, BUILT_IN_LROUND,
+ "lround", true);
+ tmp = build_function_type (long_long_integer_type_node, type);
+ gfc_define_builtin ("__builtin_llround", tmp, BUILT_IN_LLROUND,
+ "llround", true);
+
+ type = tree_cons (NULL_TREE, long_double_type_node, void_list_node);
+ tmp = build_function_type (long_integer_type_node, type);
+ gfc_define_builtin ("__builtin_lroundl", tmp, BUILT_IN_LROUNDL,
+ "lroundl", true);
+ tmp = build_function_type (long_long_integer_type_node, type);
+ gfc_define_builtin ("__builtin_llroundl", tmp, BUILT_IN_LLROUNDL,
+ "llroundl", true);
+
/* These are used to implement the ** operator. */
gfc_define_builtin ("__builtin_powl", mfunc_longdouble[1],
BUILT_IN_POWL, "powl", true);