f95-lang.c (gfc_init_builtin_functions): Define BUILT_IN_TRUNC and BUILT_IN_TRUNCF...
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
Wed, 18 May 2005 13:57:48 +0000 (15:57 +0200)
committerTobias Schlüter <tobi@gcc.gnu.org>
Wed, 18 May 2005 13:57:48 +0000 (15:57 +0200)
* 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
gcc/fortran/f95-lang.c
gcc/fortran/trans-intrinsic.c

index 16467434e376540786ce3f691d95bb71a2c9518b..714024f80231cf3dd52d966b45d915615d5bf82c 100644 (file)
@@ -1,3 +1,13 @@
+2005-05-18  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       * 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  <fengwang@nudt.edu.cn>
 
        PR fortran/20954
index 7c472e0c03be52cfd75e994d15dd663263d17e74..ced6799589d4f839acb375fe01ac0413b8360e62 100644 (file)
@@ -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, 
index 45581745b44ddc3267f5ccd4ab42495b415df958..97f00dc441a15c22fbda0129883b8e69de9dabfb 100644 (file)
@@ -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.  */