Commit 8125704b by Geoffrey Keating Committed by Jeff Law

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
parent c87222f0
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> 2001-11-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.in (insn-output.o): Depend on insn-codes.h. * Makefile.in (insn-output.o): Depend on insn-codes.h.
......
...@@ -1027,19 +1027,25 @@ gen_lowpart_common (mode, x) ...@@ -1027,19 +1027,25 @@ gen_lowpart_common (mode, x)
long i[4]; /* Only the low 32 bits of each 'long' are used. */ long i[4]; /* Only the low 32 bits of each 'long' are used. */
int endian = WORDS_BIG_ENDIAN ? 1 : 0; 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); REAL_VALUE_FROM_CONST_DOUBLE (r, x);
switch (GET_MODE_BITSIZE (GET_MODE (x))) switch (GET_MODE_BITSIZE (GET_MODE (x)))
{ {
case 32: case 32:
REAL_VALUE_TO_TARGET_SINGLE (r, i[endian]); REAL_VALUE_TO_TARGET_SINGLE (r, i[3 * endian]);
i[1 - endian] = 0; i[1] = 0;
break; i[2] = 0;
i[3 - 3 * endian] = 0;
break;
case 64: case 64:
REAL_VALUE_TO_TARGET_DOUBLE (r, i); REAL_VALUE_TO_TARGET_DOUBLE (r, i + 2 * endian);
break; i[2 - 2 * endian] = 0;
i[3 - 2 * endian] = 0;
break;
case 96: case 96:
REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, i + endian); REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, i + endian);
i[3-3*endian] = 0; i[3 - 3 * endian] = 0;
break; break;
case 128: case 128:
REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, i); REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, i);
...@@ -1047,39 +1053,17 @@ gen_lowpart_common (mode, x) ...@@ -1047,39 +1053,17 @@ gen_lowpart_common (mode, x)
default: default:
abort (); abort ();
} }
/* Now, pack the 32-bit elements of the array into a CONST_DOUBLE /* Now, pack the 32-bit elements of the array into a CONST_DOUBLE
and return it. */ and return it. */
#if HOST_BITS_PER_WIDE_INT == 32 #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 #else
{ if (HOST_BITS_PER_WIDE_INT != 64)
int c; 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))) return immed_double_const (i[3 * endian] | (i[1 + endian] << 32),
{ i[2 - endian] | (i [3 - 3 * endian] << 32),
case 32: mode);
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 ();
}
}
#endif #endif
} }
#endif /* ifndef REAL_ARITHMETIC */ #endif /* ifndef REAL_ARITHMETIC */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment