parent
89a2944c3b
commit
a874dd182c
|
@ -2172,3 +2172,67 @@ final_prescan_insn (insn, opvec, noperands)
|
|||
trap_pending = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check a floating-point value for validity for a particular machine mode. */
|
||||
|
||||
static char *float_strings[] =
|
||||
{
|
||||
"1.70141173319264430e+38", /* 2^127 (2^24 - 1) / 2^24 */
|
||||
"-1.70141173319264430e+38",
|
||||
"2.93873587705571877e-39", /* 2^-128 */
|
||||
"-2.93873587705571877e-39"
|
||||
};
|
||||
|
||||
static REAL_VALUE_TYPE float_values[4];
|
||||
static int inited_float_values = 0;
|
||||
|
||||
int
|
||||
check_float_value (mode, d, overflow)
|
||||
enum machine_mode mode;
|
||||
REAL_VALUE_TYPE *d;
|
||||
int overflow;
|
||||
{
|
||||
|
||||
if (TARGET_IEEE || TARGET_IEEE_CONFORMANT || TARGET_IEEE_WITH_INEXACT)
|
||||
return 0;
|
||||
|
||||
if (inited_float_values == 0)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; i++)
|
||||
float_values[i] = REAL_VALUE_ATOF (float_strings[i], DFmode);
|
||||
|
||||
inited_float_values = 1;
|
||||
}
|
||||
|
||||
if (mode == SFmode)
|
||||
{
|
||||
REAL_VALUE_TYPE r;
|
||||
|
||||
bcopy (d, &r, sizeof (REAL_VALUE_TYPE));
|
||||
if (REAL_VALUES_LESS (float_values[0], r))
|
||||
{
|
||||
bcopy (&float_values[0], d, sizeof (REAL_VALUE_TYPE));
|
||||
return 1;
|
||||
}
|
||||
else if (REAL_VALUES_LESS (r, float_values[1]))
|
||||
{
|
||||
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]))
|
||||
{
|
||||
bcopy (&dconst0, d, sizeof (REAL_VALUE_TYPE));
|
||||
return 1;
|
||||
}
|
||||
else if (REAL_VALUES_LESS (r, dconst0)
|
||||
&& REAL_VALUES_LESS (float_values[3], r))
|
||||
{
|
||||
bcopy (&dconst0, d, sizeof (REAL_VALUE_TYPE));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue