/* 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.
#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.
/* 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.
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. */
/* 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).
/* 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. */
/* 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.
/* 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; \
}
/* 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.
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;
{
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)
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
/* 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.
/* 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