emit-rtl.c (gen_lowpart_common): Fix conversion of REAL_VALUE_TYPEs to an array of target integers.

* emit-rtl.c (gen_lowpart_common): Fix conversion of
        REAL_VALUE_TYPEs to an array of target integers.  Fix extraction
        of low part of those arrays for 32bit and 64bit hosts.

From-SVN: r47446
This commit is contained in:
Geoffrey Keating 2001-11-29 18:12:37 +00:00 committed by Jeff Law
parent c87222f074
commit 8125704bd0
2 changed files with 24 additions and 34 deletions

View File

@ -1,3 +1,9 @@
Thu Nov 29 11:12:59 2001 Geoffrey Keating (geoffk@redhat.com)
* emit-rtl.c (gen_lowpart_common): Fix conversion of
REAL_VALUE_TYPEs to an array of target integers. Fix extraction
of low part of those arrays for 32bit and 64bit hosts.
2001-11-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.in (insn-output.o): Depend on insn-codes.h.

View File

@ -1027,19 +1027,25 @@ gen_lowpart_common (mode, x)
long i[4]; /* Only the low 32 bits of each 'long' are used. */
int endian = WORDS_BIG_ENDIAN ? 1 : 0;
/* Convert 'r' into an array of four 32-bit words in target word
order. */
REAL_VALUE_FROM_CONST_DOUBLE (r, x);
switch (GET_MODE_BITSIZE (GET_MODE (x)))
{
case 32:
REAL_VALUE_TO_TARGET_SINGLE (r, i[endian]);
i[1 - endian] = 0;
break;
REAL_VALUE_TO_TARGET_SINGLE (r, i[3 * endian]);
i[1] = 0;
i[2] = 0;
i[3 - 3 * endian] = 0;
break;
case 64:
REAL_VALUE_TO_TARGET_DOUBLE (r, i);
break;
REAL_VALUE_TO_TARGET_DOUBLE (r, i + 2 * endian);
i[2 - 2 * endian] = 0;
i[3 - 2 * endian] = 0;
break;
case 96:
REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, i + endian);
i[3-3*endian] = 0;
i[3 - 3 * endian] = 0;
break;
case 128:
REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, i);
@ -1047,39 +1053,17 @@ gen_lowpart_common (mode, x)
default:
abort ();
}
/* Now, pack the 32-bit elements of the array into a CONST_DOUBLE
and return it. */
#if HOST_BITS_PER_WIDE_INT == 32
return immed_double_const (i[endian], i[1 - endian], mode);
return immed_double_const (i[3 * endian], i[1 + endian], mode);
#else
{
int c;
if (HOST_BITS_PER_WIDE_INT != 64)
abort ();
if (HOST_BITS_PER_WIDE_INT != 64)
abort ();
for (c = 0; c < 4; c++)
i[c] &= ~ (0L);
switch (GET_MODE_BITSIZE (GET_MODE (x)))
{
case 32:
case 64:
return immed_double_const (((unsigned long) i[endian]) |
(((HOST_WIDE_INT) i[1-endian]) << 32),
0, mode);
case 96:
case 128:
return immed_double_const (((unsigned long) i[endian*3]) |
(((HOST_WIDE_INT) i[1+endian]) << 32),
((unsigned long) i[2-endian]) |
(((HOST_WIDE_INT) i[3-endian*3]) << 32),
mode);
default:
abort ();
}
}
return immed_double_const (i[3 * endian] | (i[1 + endian] << 32),
i[2 - endian] | (i [3 - 3 * endian] << 32),
mode);
#endif
}
#endif /* ifndef REAL_ARITHMETIC */