From e743d142aebcc694e105de1dcc588ee3e2a003f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Schl=C3=BCter?= Date: Wed, 18 May 2005 15:57:48 +0200 Subject: f95-lang.c (gfc_init_builtin_functions): Define BUILT_IN_TRUNC and BUILT_IN_TRUNCF instead of BUILT_IN_FLOOR and... * f95-lang.c (gfc_init_builtin_functions): Define BUILT_IN_TRUNC and BUILT_IN_TRUNCF instead of BUILT_IN_FLOOR and BUILT_IN_FLOORF. * trans-intrinsic.c (build_fix_expr): Change 'op' argument to correct enum type. (gfc_conv_intrinsic_aint): Likewise. Clarify comment in front of function. Add default case to switch, deal with FIX_TRUNC_EXPR instead of FIX_FLOOR_EXPR. From-SVN: r99900 --- gcc/fortran/ChangeLog | 10 ++++++++++ gcc/fortran/f95-lang.c | 10 +++++----- gcc/fortran/trans-intrinsic.c | 20 +++++++++++++------- 3 files changed, 28 insertions(+), 12 deletions(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1646743..714024f 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2005-05-18 Tobias Schl"uter + + * f95-lang.c (gfc_init_builtin_functions): Define BUILT_IN_TRUNC + and BUILT_IN_TRUNCF instead of BUILT_IN_FLOOR and BUILT_IN_FLOORF. + * trans-intrinsic.c (build_fix_expr): Change 'op' argument + to correct enum type. + (gfc_conv_intrinsic_aint): Likewise. Clarify comment in front of + function. Add default case to switch, deal with FIX_TRUNC_EXPR + instead of FIX_FLOOR_EXPR. + 2005-05-18 Feng Wang PR fortran/20954 diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index 7c472e0..ced6799 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -790,15 +790,15 @@ gfc_init_builtin_functions (void) /* We define these separately as the fortran versions have different semantics (they return an integer type) */ - gfc_define_builtin ("__builtin_floor", mfunc_double[0], - BUILT_IN_FLOOR, "floor", true); - gfc_define_builtin ("__builtin_floorf", mfunc_float[0], - BUILT_IN_FLOORF, "floorf", true); gfc_define_builtin ("__builtin_round", mfunc_double[0], BUILT_IN_ROUND, "round", true); gfc_define_builtin ("__builtin_roundf", mfunc_float[0], BUILT_IN_ROUNDF, "roundf", true); - + gfc_define_builtin ("__builtin_trunc", mfunc_double[0], + BUILT_IN_TRUNC, "trunc", true); + gfc_define_builtin ("__builtin_truncf", mfunc_float[0], + BUILT_IN_TRUNCF, "truncf", true); + gfc_define_builtin ("__builtin_cabs", func_cdouble_double, BUILT_IN_CABS, "cabs", true); gfc_define_builtin ("__builtin_cabsf", func_cfloat_float, diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 4558174..97f00dc 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -277,7 +277,8 @@ build_round_expr (stmtblock_t * pblock, tree arg, tree type) however the RTL expander only actually supports FIX_TRUNC_EXPR. */ static tree -build_fix_expr (stmtblock_t * pblock, tree arg, tree type, int op) +build_fix_expr (stmtblock_t * pblock, tree arg, tree type, + enum tree_code op) { switch (op) { @@ -300,14 +301,15 @@ build_fix_expr (stmtblock_t * pblock, tree arg, tree type, int op) /* Round a real value using the specified rounding mode. We use a temporary integer of that same kind size as the result. - Values larger than can be represented by this kind are unchanged, as - will not be accurate enough to represent the rounding. + Values larger than those that can be represented by this kind are + unchanged, as thay will not be accurate enough to represent the + rounding. huge = HUGE (KIND (a)) aint (a) = ((a > huge) || (a < -huge)) ? a : (real)(int)a */ static void -gfc_conv_intrinsic_aint (gfc_se * se, gfc_expr * expr, int op) +gfc_conv_intrinsic_aint (gfc_se * se, gfc_expr * expr, enum tree_code op) { tree type; tree itype; @@ -337,17 +339,21 @@ gfc_conv_intrinsic_aint (gfc_se * se, gfc_expr * expr, int op) } break; - case FIX_FLOOR_EXPR: + case FIX_TRUNC_EXPR: switch (kind) { case 4: - n = BUILT_IN_FLOORF; + n = BUILT_IN_TRUNCF; break; case 8: - n = BUILT_IN_FLOOR; + n = BUILT_IN_TRUNC; break; } + break; + + default: + gcc_unreachable (); } /* Evaluate the argument. */ -- cgit v1.1