This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gen_lowpart_common and floating-point yet again



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
     }
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]