aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-03-13 08:34:34 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1994-03-13 08:34:34 -0500
commit2e15b172de724f57679d6cf2acba6b366bc4c7dd (patch)
tree05c3b0be279a8809c40e15d47e4422915783d3f9 /gcc
parentc05f751c24182e733cb986b7660ec1223be52428 (diff)
downloadgcc-2e15b172de724f57679d6cf2acba6b366bc4c7dd.zip
gcc-2e15b172de724f57679d6cf2acba6b366bc4c7dd.tar.gz
gcc-2e15b172de724f57679d6cf2acba6b366bc4c7dd.tar.bz2
Add OVERFLOW operand to CHECK_FLOAT_VALUE.
From-SVN: r6770
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/convex/convex.c21
-rw-r--r--gcc/config/convex/convex.h6
-rw-r--r--gcc/config/fx80/fx80.h22
-rw-r--r--gcc/config/tahoe/tahoe.h30
-rw-r--r--gcc/config/vax/vax.c27
-rw-r--r--gcc/config/vax/vax.h5
6 files changed, 64 insertions, 47 deletions
diff --git a/gcc/config/convex/convex.c b/gcc/config/convex/convex.c
index 2595e19..ce1b756 100644
--- a/gcc/config/convex/convex.c
+++ b/gcc/config/convex/convex.c
@@ -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;
}
/* Output the label at the start of a function.
diff --git a/gcc/config/convex/convex.h b/gcc/config/convex/convex.h
index 9bb8e70..af1a0f5 100644
--- a/gcc/config/convex/convex.h
+++ b/gcc/config/convex/convex.h
@@ -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)
/* Tell final.c how to eliminate redundant test instructions. */
diff --git a/gcc/config/fx80/fx80.h b/gcc/config/fx80/fx80.h
index 6dbfed8..d8c1bce1 100644
--- a/gcc/config/fx80/fx80.h
+++ b/gcc/config/fx80/fx80.h
@@ -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; \
}
/* Tell final.c how to eliminate redundant test instructions. */
diff --git a/gcc/config/tahoe/tahoe.h b/gcc/config/tahoe/tahoe.h
index 0e1af7d..4e42c22 100644
--- a/gcc/config/tahoe/tahoe.h
+++ b/gcc/config/tahoe/tahoe.h
@@ -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; \
}
diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c
index d5d9c34..4174477 100644
--- a/gcc/config/vax/vax.c
+++ b/gcc/config/vax/vax.c
@@ -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;
}
/* Linked list of all externals that are to be emitted when optimizing
diff --git a/gcc/config/vax/vax.h b/gcc/config/vax/vax.h
index d675460..fce5b69 100644
--- a/gcc/config/vax/vax.h
+++ b/gcc/config/vax/vax.h
@@ -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