This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
gen_lowpart_common and floating-point yet again
- From: Geoff Keating <geoffk at geoffk dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 3 Dec 2001 14:46:19 -0800
- Subject: gen_lowpart_common and floating-point yet again
- Reply-to: Geoff Keating <geoffk at redhat dot com>
This fixes a sign-extension problem where the array 'i' is signed, and
so gets sign-extended when the 32-bit elements get packed into 64-bit
words.
In particular, it fixes gcc.c-torture/execute/ieee/930529-1.c on
powerpc.
Bootstrapped & tested on powerpc-linux.
--
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>
===File ~/patches/cygnus/gcc-lowpartulong.patch=============
2001-12-03 Geoff Keating <geoffk@redhat.com>
* emit-rtl.c (gen_lowpart_common): Avoid unwanted sign-extension
of array elements.
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.231
diff -p -u -u -p -r1.231 emit-rtl.c
--- emit-rtl.c 2001/12/02 06:06:18 1.231
+++ emit-rtl.c 2001/12/03 22:44:37
@@ -1061,10 +1061,10 @@ gen_lowpart_common (mode, x)
if (HOST_BITS_PER_WIDE_INT != 64)
abort ();
- return immed_double_const (i[3 * endian]
- | ((HOST_WIDE_INT) i[1 + endian] << 32),
- i[2 - endian]
- | ((HOST_WIDE_INT) i[3 - 3 * endian] << 32),
+ return immed_double_const ((((unsigned long) i[3 * endian])
+ | ((HOST_WIDE_INT) i[1 + endian] << 32)),
+ (((unsigned long) i[2 - endian])
+ | ((HOST_WIDE_INT) i[3 - 3 * endian] << 32)),
mode);
#endif
}
============================================================