mirror of git://gcc.gnu.org/git/gcc.git
print-rtl.c (print_rtx): Display the real-value equivalent of a const_double when easy.
* print-rtl.c (print_rtx): Display the real-value equivalent of
a const_double when easy.
* real.h (REAL_VALUE_TO_TARGET_SINGLE): Use a union to pun types.
Zero memory first for predictability.
(REAL_VALUE_TO_TARGET_DOUBLE): Likewise.
* varasm.c (immed_real_const_1): Notice width of H_W_I == double.
From-SVN: r20972
This commit is contained in:
parent
4051959be9
commit
800d5c9e17
|
|
@ -29,6 +29,14 @@ Mon Jul 6 22:17:19 1998 Alasdair Baird <alasdair@wildcat.demon.co.uk>
|
||||||
|
|
||||||
Mon Jul 6 22:14:31 1998 Richard Henderson (rth@cygnus.com)
|
Mon Jul 6 22:14:31 1998 Richard Henderson (rth@cygnus.com)
|
||||||
|
|
||||||
|
* print-rtl.c (print_rtx): Display the real-value equivalent of
|
||||||
|
a const_double when easy.
|
||||||
|
|
||||||
|
* real.h (REAL_VALUE_TO_TARGET_SINGLE): Use a union to pun types.
|
||||||
|
Zero memory first for predictability.
|
||||||
|
(REAL_VALUE_TO_TARGET_DOUBLE): Likewise.
|
||||||
|
* varasm.c (immed_real_const_1): Notice width of H_W_I == double.
|
||||||
|
|
||||||
* regclass.c (allocate_reg_info): Initialize the entire reg_data
|
* regclass.c (allocate_reg_info): Initialize the entire reg_data
|
||||||
virtual array.
|
virtual array.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA. */
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "rtl.h"
|
#include "rtl.h"
|
||||||
#include "bitmap.h"
|
#include "bitmap.h"
|
||||||
|
#include "real.h"
|
||||||
|
|
||||||
|
|
||||||
/* How to print out a register name.
|
/* How to print out a register name.
|
||||||
|
|
@ -268,6 +269,15 @@ print_rtx (in_rtx)
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
|
||||||
|
if (GET_CODE (in_rtx) == CONST_DOUBLE && FLOAT_MODE_P (GET_MODE (in_rtx)))
|
||||||
|
{
|
||||||
|
double val;
|
||||||
|
REAL_VALUE_FROM_CONST_DOUBLE (val, in_rtx);
|
||||||
|
fprintf (outfile, " [%.16g]", val);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
fprintf (outfile, ")");
|
fprintf (outfile, ")");
|
||||||
sawclose = 1;
|
sawclose = 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
42
gcc/real.h
42
gcc/real.h
|
|
@ -264,10 +264,18 @@ typedef struct {
|
||||||
value in host format and then to a single type `long' value which
|
value in host format and then to a single type `long' value which
|
||||||
is the bitwise equivalent of the `float' value. */
|
is the bitwise equivalent of the `float' value. */
|
||||||
#ifndef REAL_VALUE_TO_TARGET_SINGLE
|
#ifndef REAL_VALUE_TO_TARGET_SINGLE
|
||||||
#define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) \
|
#define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) \
|
||||||
do { float f = (float) (IN); \
|
do { \
|
||||||
(OUT) = *(long *) &f; \
|
union { \
|
||||||
} while (0)
|
float f; \
|
||||||
|
HOST_WIDE_INT l; \
|
||||||
|
} u; \
|
||||||
|
if (sizeof(HOST_WIDE_INT) < sizeof(float)) \
|
||||||
|
abort(); \
|
||||||
|
u.l = 0; \
|
||||||
|
u.f = (IN); \
|
||||||
|
(OUT) = u.l; \
|
||||||
|
} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Convert a type `double' value in host format to a pair of type `long'
|
/* Convert a type `double' value in host format to a pair of type `long'
|
||||||
|
|
@ -275,18 +283,20 @@ do { float f = (float) (IN); \
|
||||||
proper word order for the target. */
|
proper word order for the target. */
|
||||||
#ifndef REAL_VALUE_TO_TARGET_DOUBLE
|
#ifndef REAL_VALUE_TO_TARGET_DOUBLE
|
||||||
#define REAL_VALUE_TO_TARGET_DOUBLE(IN, OUT) \
|
#define REAL_VALUE_TO_TARGET_DOUBLE(IN, OUT) \
|
||||||
do { REAL_VALUE_TYPE in = (IN); /* Make sure it's not in a register. */\
|
do { \
|
||||||
if (HOST_FLOAT_WORDS_BIG_ENDIAN == FLOAT_WORDS_BIG_ENDIAN) \
|
union { \
|
||||||
{ \
|
REAL_VALUE_TYPE f; \
|
||||||
(OUT)[0] = ((long *) &in)[0]; \
|
HOST_WIDE_INT l[2]; \
|
||||||
(OUT)[1] = ((long *) &in)[1]; \
|
} u; \
|
||||||
} \
|
if (sizeof(HOST_WIDE_INT) * 2 < sizeof(REAL_VALUE_TYPE)) \
|
||||||
else \
|
abort(); \
|
||||||
{ \
|
u.l[0] = u.l[1] = 0; \
|
||||||
(OUT)[1] = ((long *) &in)[0]; \
|
u.f = (IN); \
|
||||||
(OUT)[0] = ((long *) &in)[1]; \
|
if (HOST_FLOAT_WORDS_BIG_ENDIAN == FLOAT_WORDS_BIG_ENDIAN) \
|
||||||
} \
|
(OUT)[0] = u.l[0], (OUT)[1] = u.l[1]; \
|
||||||
} while (0)
|
else \
|
||||||
|
(OUT)[1] = u.l[0], (OUT)[0] = u.l[1]; \
|
||||||
|
} while (0)
|
||||||
#endif
|
#endif
|
||||||
#endif /* HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT */
|
#endif /* HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2070,6 +2070,8 @@ immed_real_const_1 (d, mode)
|
||||||
else if (! REAL_VALUE_ISNAN (d) && REAL_VALUES_EQUAL (dconst1, d))
|
else if (! REAL_VALUE_ISNAN (d) && REAL_VALUES_EQUAL (dconst1, d))
|
||||||
return CONST1_RTX (mode);
|
return CONST1_RTX (mode);
|
||||||
|
|
||||||
|
if (sizeof u == sizeof (HOST_WIDE_INT))
|
||||||
|
return immed_double_const (u.i[0], 0, mode);
|
||||||
if (sizeof u == 2 * sizeof (HOST_WIDE_INT))
|
if (sizeof u == 2 * sizeof (HOST_WIDE_INT))
|
||||||
return immed_double_const (u.i[0], u.i[1], mode);
|
return immed_double_const (u.i[0], u.i[1], mode);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue