]> gcc.gnu.org Git - gcc.git/commitdiff
Add OVERFLOW operand to CHECK_FLOAT_VALUE.
authorRichard Kenner <kenner@gcc.gnu.org>
Sun, 13 Mar 1994 13:34:34 +0000 (08:34 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Sun, 13 Mar 1994 13:34:34 +0000 (08:34 -0500)
From-SVN: r6770

gcc/config/convex/convex.c
gcc/config/convex/convex.h
gcc/config/fx80/fx80.h
gcc/config/tahoe/tahoe.h
gcc/config/vax/vax.c
gcc/config/vax/vax.h

index 2595e198f20861320eab55fb3f71a19eecba50e8..ce1b7561f71ed642fbeea306bb74beb17d769343 100644 (file)
@@ -1,5 +1,5 @@
 /* Subroutines for insn-output.c for Convex.
-   Copyright (C) 1988, 1993 Free Software Foundation, Inc.
+   Copyright (C) 1988, 1993, 1994 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -413,31 +413,40 @@ expand_movstr_call (operands)
 #define MIN_FLOAT 2.9387358770557188e-39
 #endif
 
-void
-check_float_value (mode, dp)
+int
+check_float_value (mode, dp, overflow)
      enum machine_mode mode;
      REAL_VALUE_TYPE *dp;
+     int overflow;
 {
   REAL_VALUE_TYPE d = *dp;
 
+  if (overflow)
+    {
+      *dp = MAX_FLOAT;
+      return 1;
+    }
+
   if (mode == SFmode)
     {
       if (d > MAX_FLOAT)
        {
-         error ("magnitude of constant too large for `float'");
          *dp = MAX_FLOAT;
+         return 1;
        }
       else if (d < -MAX_FLOAT)
        {
-         error ("magnitude of constant too large for `float'");
          *dp = -MAX_FLOAT;
+         return 1;
        }       
       else if ((d > 0 && d < MIN_FLOAT) || (d < 0 && d > -MIN_FLOAT))
        {
-         warning ("`float' constant truncated to zero");
          *dp = 0.0;
+         return 1;
        }
     }
+
+  return 0;
 }
 \f
 /* Output the label at the start of a function.
index 9bb8e70af04aa3f6001660b12ec03073b5570a55..af1a0f5213c7b7dd80be4a36cfa5f11ca5f49927 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions of target machine for GNU compiler.  Convex version.
-   Copyright (C) 1988, 1993 Free Software Foundation, Inc.
+   Copyright (C) 1988, 1993, 1994 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -1180,8 +1180,8 @@ enum reg_class {
 extern double atof();
 
 /* Check a `double' value for validity for a particular machine mode.  */
-#define CHECK_FLOAT_VALUE(mode, d) \
-    check_float_value ((mode), &(d))
+#define CHECK_FLOAT_VALUE(MODE, D, OVERFLOW) \
+   overflow = check_float_value (MODE, &D, OVERFLOW)
 \f
 /* Tell final.c how to eliminate redundant test instructions.  */
 
index 6dbfed8235388821b3b0696815c4225dde6b8e1e..d8c1bce1b923db44635e4674b4df53b278a6bf6e 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions of target machine for GNU compiler.  Alliant FX version.
-   Copyright (C) 1989, 1993 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1993, 1994 Free Software Foundation, Inc.
    Adapted from m68k.h by Paul Petersen (petersen@uicsrd.csrd.uiuc.edu)
    and Joe Weening (weening@gang-of-four.stanford.edu).
 
@@ -887,19 +887,19 @@ extern enum reg_class regno_reg_class[];
 /* Check a `double' value for validity for a particular machine mode.
    This is defined to avoid crashes outputting certain constants.  */
 
-#define CHECK_FLOAT_VALUE(mode, d)                                     \
-  if ((mode) == SFmode)                                                        \
+#define CHECK_FLOAT_VALUE(MODE, D, OVERFLOW)                           \
+  if (OVERFLOW)                                                                \
+    (D) = 3.4028234663852890e+38;                                      \
+  else if ((MODE) == SFmode)                                           \
     {                                                                  \
       if ((d) > 3.4028234663852890e+38)                                        \
-       { warning ("magnitude of value too large for `float'");         \
-         (d) = 3.4028234663852890e+38; }                               \
-      else if ((d) < -3.4028234663852890e+38)                          \
-       { warning ("magnitude of value too large for `float'");         \
-         (d) = -3.4028234663852890e+38; }                              \
-      else if (((d) > 0) && ((d) < 1.1754943508222873e-38))            \
-       (d) = 0.0;                                                      \
+       (OVERFLOW) = 1, (D) = 3.4028234663852890e+38;                   \
+      else if ((D) < -3.4028234663852890e+38)                          \
+       (OVERFLOW) = 1, (D) = -3.4028234663852890e+38;                  \
+      else if (((D) > 0) && ((D) < 1.1754943508222873e-38))            \
+       (OVERFLOW) = 1, (D) = 0.0;                                      \
       else if (((d) < 0) && ((d) > -1.1754943508222873e-38))           \
-       (d) = 0.0;                                                      \
+       (OVEFLOW) = 1, (D) = 0.0;                                       \
     }
 \f
 /* Tell final.c how to eliminate redundant test instructions.  */
index 0e1af7dd4575ba66fc02631b6be9e6d10361b583..4e42c220edd21cacf3c188f2a48fed4d42b4b960 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions of target machine for GNU compiler.  Tahoe version.
-   Copyright (C) 1989, 1993 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1993, 1994 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -135,21 +135,19 @@ extern int target_flags;
 /* this section is borrowed from the vax version since the */
 /* formats are the same in both of the architectures      */
 
-#define CHECK_FLOAT_VALUE(mode, d) \
-  if ((mode) == SFmode) \
-    { \
-      if ((d) > 1.7014117331926443e+38) \
-       { error ("magnitude of constant too large for `float'"); \
-         (d) = 1.7014117331926443e+38; } \
-      else if ((d) < -1.7014117331926443e+38) \
-       { error ("magnitude of constant too large for `float'"); \
-         (d) = -1.7014117331926443e+38; } \
-      else if (((d) > 0) && ((d) < 2.9387358770557188e-39)) \
-       { warning ("`float' constant truncated to zero"); \
-         (d) = 0.0; } \
-      else if (((d) < 0) && ((d) > -2.9387358770557188e-39)) \
-       { warning ("`float' constant truncated to zero"); \
-         (d) = 0.0; } \
+#define CHECK_FLOAT_VALUE(MODE, D, OVEFLOW) \
+  if (OVERFLOW)                                                                \
+    (D) = 1.7014117331926443e+38;                                      \
+  else if ((MODE) == SFmode)                                           \
+    {                                                                  \
+      if ((D) > 1.7014117331926443e+38)                                        \
+       (OVERFLOW) = 1, (D) = 1.7014117331926443e+38;                   \
+      else if ((D) < -1.7014117331926443e+38)                          \
+       (OVERFLOW) = 1, (D) = -1.7014117331926443e+38;                  \
+      else if (((D) > 0) && ((D) < 2.9387358770557188e-39))            \
+       (OVERFLOW) = 1, (D) = 0.0;                                      \
+      else if (((D) < 0) && ((D) > -2.9387358770557188e-39))           \
+       (OVERFLOW) = 1, (D) = 0.0;                                      \
     }
 
 
index d5d9c34bb4cecdeb20efa1469b23f0fd45ca4279..4174477c99a0545b1378857c069342e723cac6a3 100644 (file)
@@ -1,5 +1,5 @@
 /* Subroutines for insn-output.c for Vax.
-   Copyright (C) 1987 Free Software Foundation, Inc.
+   Copyright (C) 1987, 1994 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -593,12 +593,12 @@ static REAL_VALUE_TYPE float_values[4];
 static int inited_float_values = 0;
 
 
-void
-check_float_value (mode, d)
+int
+check_float_value (mode, d, overflow)
      enum machine_mode mode;
      REAL_VALUE_TYPE *d;
+     int overflow;
 {
-
   if (inited_float_values == 0)
     {
       int i;
@@ -606,7 +606,14 @@ check_float_value (mode, d)
        {
          float_values[i] = REAL_VALUE_ATOF (float_strings[i], DFmode);
        }
-    inited_float_values = 1;
+
+      inited_float_values = 1;
+    }
+
+  if (overflow)
+    {
+      bcopy (&float_values[0], d, sizeof (REAL_VALUE_TYPE));
+      return 1;
     }
 
   if ((mode) == SFmode)
@@ -615,27 +622,29 @@ check_float_value (mode, d)
       bcopy (d, &r, sizeof (REAL_VALUE_TYPE));
       if (REAL_VALUES_LESS (float_values[0], r))
        {
-         error ("magnitude of constant too large for `float'");
          bcopy (&float_values[0], d, sizeof (REAL_VALUE_TYPE));
+         return 1;
        }
       else if (REAL_VALUES_LESS (r, float_values[1]))
        {
-         error ("magnitude of constant too large for `float'");
          bcopy (&float_values[1], d, sizeof (REAL_VALUE_TYPE));
+         return 1;
        }
       else if (REAL_VALUES_LESS (dconst0, r)
                && REAL_VALUES_LESS (r, float_values[2]))
        {
-         warning ("`float' constant truncated to zero");
          bcopy (&dconst0, d, sizeof (REAL_VALUE_TYPE));
+         return 1;
        }
       else if (REAL_VALUES_LESS (r, dconst0)
                && REAL_VALUES_LESS (float_values[3], r))
        {
-         warning ("`float' constant truncated to zero");
          bcopy (&dconst0, d, sizeof (REAL_VALUE_TYPE));
+         return 1;
        }
     }
+
+  return 0;
 }
 \f
 /* Linked list of all externals that are to be emitted when optimizing
index d675460be2409b92bd3af800cbe722fa80588d1e..fce5b69e92daf520ca4643be905e2b605fe94188 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions of target machine for GNU compiler.  Vax version.
-   Copyright (C) 1987, 1988, 1991, 1993 Free Software Foundation, Inc.
+   Copyright (C) 1987, 1988, 1991, 1993, 1994 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -912,7 +912,8 @@ gen_rtx (PLUS, Pmode, frame, gen_rtx (CONST_INT, VOIDmode, 12))
 /* note that it is very hard to accidentally create a number that fits in a
    double but not in a float, since their ranges are almost the same */
 
-#define CHECK_FLOAT_VALUE(mode, d) (check_float_value (mode, &d))
+#define CHECK_FLOAT_VALUE(MODE, D, OVERFLOW)
+  ((OVERFLOW) = check_float_value (MODE, &D, OVERFLOW))
 
 /* For future reference:
    D Float: 9 bit, sign magnitude, excess 128 binary exponent
This page took 0.083527 seconds and 5 git commands to generate.