(check_float_value): Underflow and overflow constants are different
authorRichard Kenner <kenner@gcc.gnu.org>
Mon, 9 Jun 1997 21:15:48 +0000 (17:15 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Mon, 9 Jun 1997 21:15:48 +0000 (17:15 -0400)
for FLOAT_VAX and default targets.

From-SVN: r14190

gcc/config/alpha/alpha.c

index 46f621a2c616451dc6fd3218ff84ffa37d439e4a..df888311fd4040b5df258b2ba6c62d64800fa7da 100644 (file)
@@ -2959,13 +2959,20 @@ final_prescan_insn (insn, opvec, noperands)
 
 static char *float_strings[] =
 {
+  /* These are for FLOAT_VAX.  */
    "1.70141173319264430e+38", /* 2^127 (2^24 - 1) / 2^24 */
   "-1.70141173319264430e+38",
    "2.93873587705571877e-39", /* 2^-128 */
-  "-2.93873587705571877e-39"
+  "-2.93873587705571877e-39",
+  /* These are for the default broken IEEE mode, which traps
+     on infinity or denormal numbers.  */
+   "3.402823466385288598117e+38", /* 2^128 (1 - 2^-24) */
+  "-3.402823466385288598117e+38",
+   "1.1754943508222875079687e-38", /* 2^-126 */
+  "-1.1754943508222875079687e-38",
 };
 
-static REAL_VALUE_TYPE float_values[4];
+static REAL_VALUE_TYPE float_values[8];
 static int inited_float_values = 0;
 
 int
@@ -2978,13 +2985,10 @@ check_float_value (mode, d, overflow)
   if (TARGET_IEEE || TARGET_IEEE_CONFORMANT || TARGET_IEEE_WITH_INEXACT)
     return 0;
 
-  if (TARGET_FLOAT_VAX)
-    return 0;
-
   if (inited_float_values == 0)
     {
       int i;
-      for (i = 0; i < 4; i++)
+      for (i = 0; i < 8; i++)
        float_values[i] = REAL_VALUE_ATOF (float_strings[i], DFmode);
 
       inited_float_values = 1;
@@ -2993,28 +2997,34 @@ check_float_value (mode, d, overflow)
   if (mode == SFmode)
     {
       REAL_VALUE_TYPE r;
+      REAL_VALUE_TYPE *fvptr;
+
+      if (TARGET_FLOAT_VAX)
+       fvptr = &float_values[0];
+      else
+       fvptr = &float_values[4];
 
       bcopy ((char *) d, (char *) &r, sizeof (REAL_VALUE_TYPE));
-      if (REAL_VALUES_LESS (float_values[0], r))
+      if (REAL_VALUES_LESS (fvptr[0], r))
        {
-         bcopy ((char *) &float_values[0], (char *) d,
+         bcopy ((char *) &fvptr[0], (char *) d,
                 sizeof (REAL_VALUE_TYPE));
          return 1;
        }
-      else if (REAL_VALUES_LESS (r, float_values[1]))
+      else if (REAL_VALUES_LESS (r, fvptr[1]))
        {
-         bcopy ((char *) &float_values[1], (char *) d,
+         bcopy ((char *) &fvptr[1], (char *) d,
                 sizeof (REAL_VALUE_TYPE));
          return 1;
        }
       else if (REAL_VALUES_LESS (dconst0, r)
-               && REAL_VALUES_LESS (r, float_values[2]))
+               && REAL_VALUES_LESS (r, fvptr[2]))
        {
          bcopy ((char *) &dconst0, (char *) d, sizeof (REAL_VALUE_TYPE));
          return 1;
        }
       else if (REAL_VALUES_LESS (r, dconst0)
-               && REAL_VALUES_LESS (float_values[3], r))
+               && REAL_VALUES_LESS (fvptr[3], r))
        {
          bcopy ((char *) &dconst0, (char *) d, sizeof (REAL_VALUE_TYPE));
          return 1;