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]

Use strict alignment for E500


E500 instructions with memory operands require strict alignment, and 
kernel trap handlers are not generally available to fix things up if used 
with inadequate alignment.  Thus this patch enables -mstrict-align by 
default for those processors.  (Note that the exclusion of 
MASK_STRICT_ALIGN from POWERPC_MASKS is in any case a bug, because another 
processor in the table already uses MASK_STRICT_ALIGN.)

Tested with no regressions with a cross to powerpc-none-linux-gnuspe 
(mainline, 4.2, 4.1).  OK to commit to mainline, 4.2, 4.1?

This patch fixes the following FAILs when used in conjunction with my 
previous patch <http://gcc.gnu.org/ml/gcc-patches/2006-11/msg01642.html> 
(without it, the subregs used to load unaligned objects tend to get 
miscompiled):

FAIL: gcc.c-torture/execute/20040709-2.c execution,  -O0 
FAIL: gcc.c-torture/execute/strct-pack-1.c execution,  -O0 
FAIL: gcc.c-torture/execute/strct-pack-1.c execution,  -O1 
FAIL: gcc.c-torture/execute/strct-pack-1.c execution,  -O2 
FAIL: gcc.dg/compat/struct-align-1 c_compat_x_tst.o-c_compat_y_tst.o execute 
FAIL: tmpdir-gcc.dg-struct-layout-1/t005 c_compat_x_tst.o-c_compat_y_tst.o execute 
FAIL: tmpdir-gcc.dg-struct-layout-1/t007 c_compat_x_tst.o-c_compat_y_tst.o execute 
FAIL: tmpdir-gcc.dg-struct-layout-1/t010 c_compat_x_tst.o-c_compat_y_tst.o execute 
FAIL: tmpdir-gcc.dg-struct-layout-1/t024 c_compat_x_tst.o-c_compat_y_tst.o execute 
FAIL: tmpdir-gcc.dg-struct-layout-1/t027 c_compat_x_tst.o-c_compat_y_tst.o execute 
FAIL: tmpdir-g++.dg-struct-layout-1/t003 cp_compat_x_tst.o-cp_compat_y_tst.o execute 
FAIL: tmpdir-g++.dg-struct-layout-1/t010 cp_compat_x_tst.o-cp_compat_y_tst.o execute 
FAIL: tmpdir-g++.dg-struct-layout-1/t025 cp_compat_x_tst.o-cp_compat_y_tst.o execute 
FAIL: tmpdir-g++.dg-struct-layout-1/t029 cp_compat_x_tst.o-cp_compat_y_tst.o execute 
FAIL: tmpdir-g++.dg-struct-layout-1/t030 cp_compat_x_tst.o-cp_compat_y_tst.o execute 
FAIL: 25_algorithms/copy/streambuf_iterators/char/4.cc execution test
FAIL: 25_algorithms/copy/streambuf_iterators/wchar_t/4.cc execution test

2006-11-23  Joseph Myers  <joseph@codesourcery.com>

	* config/rs6000/eabispe.h (TARGET_DEFAULT): Include
	MASK_STRICT_ALIGN.
	* config/rs6000/linuxspe.h (TARGET_DEFAULT): Likewise.
	* config/rs6000/rs6000.c (rs6000_override_options): Use
	MASK_STRICT_ALIGN for 8540 and 8548.  Add MASK_STRICT_ALIGN to
	POWERPC_MASKS.

Index: eabispe.h
===================================================================
--- eabispe.h	(revision 119097)
+++ eabispe.h	(working copy)
@@ -21,7 +21,8 @@
    MA 02110-1301, USA.  */
 
 #undef  TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_EABI)
+#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_EABI	\
+  | MASK_STRICT_ALIGN)
 
 #undef  TARGET_VERSION
 #define TARGET_VERSION fprintf (stderr, " (PowerPC Embedded SPE)");
Index: linuxspe.h
===================================================================
--- linuxspe.h	(revision 119097)
+++ linuxspe.h	(working copy)
@@ -25,7 +25,7 @@
 
 /* Override rs6000.h and sysv4.h definition.  */
 #undef	TARGET_DEFAULT
-#define	TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
+#define	TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_STRICT_ALIGN)
 
 #undef TARGET_SPE_ABI
 #undef TARGET_SPE
Index: rs6000.c
===================================================================
--- rs6000.c	(revision 119097)
+++ rs6000.c	(working copy)
@@ -1135,9 +1135,11 @@
 	 {"801", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT},
 	 {"821", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT},
 	 {"823", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT},
-	 {"8540", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
+	 {"8540", PROCESSOR_PPC8540,
+	  POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_STRICT_ALIGN},
 	 /* 8548 has a dummy entry for now.  */
-	 {"8548", PROCESSOR_PPC8540, POWERPC_BASE_MASK | MASK_PPC_GFXOPT},
+	 {"8548", PROCESSOR_PPC8540,
+	  POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_STRICT_ALIGN},
 	 {"860", PROCESSOR_MPCCORE, POWERPC_BASE_MASK | MASK_SOFT_FLOAT},
 	 {"970", PROCESSOR_POWER4,
 	  POWERPC_7400_MASK | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64},
@@ -1186,7 +1188,7 @@
 
   enum {
     POWER_MASKS = MASK_POWER | MASK_POWER2 | MASK_MULTIPLE | MASK_STRING,
-    POWERPC_MASKS = (POWERPC_BASE_MASK | MASK_PPC_GPOPT
+    POWERPC_MASKS = (POWERPC_BASE_MASK | MASK_PPC_GPOPT | MASK_STRICT_ALIGN
 		     | MASK_PPC_GFXOPT | MASK_POWERPC64 | MASK_ALTIVEC
 		     | MASK_MFCRF | MASK_POPCNTB | MASK_FPRND)
   };

-- 
Joseph S. Myers
joseph@codesourcery.com


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