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]

-mstrict-align for m68k



The attached patch implements -mstrict-align for m68k targets, and
fixes some minor bugs I noticed.

I couldn't execution-test it because of some problem with exception
handling with this port that causes linking to fail, but I'm pretty
sure it has no effect if you don't use the new options, and I checked
by eye that it does work, you get
        move.w f1+1,%d0
rather than
        move.b f1+1,%d0
        lsl.l #8,%d0
        or.b f1+2,%d0
or
        lea f1+1,%a0
        bfexts (%a0){#0:#16},%d0

[As a side note, I seem to remember the 020 and higher support this in
hardware, so it might be good to have some more complicated expression
in the definition of STRICT_ALIGNMENT.  I'll leave that to someone who
can test it.]

-- 
Geoffrey Keating <geoffk@cygnus.com>

===File ~/patches/cygnus/ascend-m68kalign.patch=============
md5sum: 4659064d24fc95c0 598aadd0637c818d 428785
Index: egcs/gcc/ChangeLog
0a
Thu Nov 11 20:15:34 1999  Greg McGary  <gkm@gnu.org>
			  Geoffrey Keating  <geoffk@cygnus.com>

	* config/m68k/m68kelf.h: Suppress '/* within comment' warning.

	* config/m68k/m68k.h (MASK_PCREL): Don't use same value as
	MASK_ALIGN_INT.
	
	* config/m68k/m68k.h (MASK_NO_STRICT_ALIGNMENT): New macro.
	(TARGET_STRICT_ALIGNMENT): New macro.
	(TARGET_SWITCHES): Add "strict-align" and "no-strict-align".
	(STRICT_ALIGNMENT): Depend on TARGET_STRICT_ALIGNMENT.
	* invoke.texi (M680x0 Options): Document -mstrict-align.

.
Changed files:
egcs/gcc/ChangeLog
egcs/gcc/cstamp-h.in
egcs/gcc/invoke.texi
egcs/gcc/config/m68k/m68k.h
egcs/gcc/config/m68k/m68kelf.h
md5sum: 1ded054093de910d 1ded054093de910d 10
md5sum: 1a5cc6dc039f87d7 174c12f563c62ea3 291795
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/invoke.texi	Mon Nov  1 12:45:13 1999
+++ egcs/gcc/invoke.texi	Sat Nov 13 15:47:56 1999
@@ -221,7 +221,7 @@ in the following sections.
 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040
 -m68060  -mcpu32 -m5200  -m68881  -mbitfield  -mc68000  -mc68020  
 -mfpa -mnobitfield  -mrtd  -mshort  -msoft-float  -mpcrel
--malign-int
+-malign-int -mstrict-align
 
 @emph{VAX Options}
 -mg  -mgnu  -munix
@@ -3818,6 +3818,12 @@ using a global offset table.  At present
 allowing at most a 16-bit offset for pc-relative addressing.  -fPIC is
 not presently supported with -mpcrel, though this could be supported for
 68020 and higher processors.
+
+@item -mno-strict-align
+@itemx -mstrict-align
+@kindex -mstrict-align
+Do not (do) assume that unaligned memory references will be handled by
+the system.
 
 @end table
 
md5sum: f09608ca45d913a8 60940716816402f8 83383
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/config/m68k/m68k.h	Tue Oct 26 11:42:09 1999
+++ egcs/gcc/config/m68k/m68k.h	Thu Nov 11 20:25:29 1999
@@ -132,9 +132,13 @@ extern int target_flags;
    treated as all containing an implicit PC-relative component, and hence
    cannot be used directly as addresses for memory writes.  See the comments
    in m68k.c for more information.  */
-#define MASK_PCREL	4096
+#define MASK_PCREL	8192
 #define TARGET_PCREL	(target_flags & MASK_PCREL)
 
+/* Relax strict alignment. */
+#define MASK_NO_STRICT_ALIGNMENT 16384
+#define TARGET_STRICT_ALIGNMENT  (~target_flags & MASK_NO_STRICT_ALIGNMENT)
+
 /* Macro to define tables used to set the flags.
    This is a list in braces of pairs in braces,
    each pair being { "NAME", VALUE }
@@ -194,6 +198,8 @@ extern int target_flags;
     { "align-int", MASK_ALIGN_INT },					\
     { "no-align-int", -MASK_ALIGN_INT },				\
     { "pcrel", MASK_PCREL},						\
+    { "strict-align", -MASK_NO_STRICT_ALIGNMENT},			\
+    { "no-strict-align", MASK_NO_STRICT_ALIGNMENT},			\
     SUBTARGET_SWITCHES							\
     { "", TARGET_DEFAULT}}
 /* TARGET_DEFAULT is defined in sun*.h and isi.h, etc.  */
@@ -304,7 +310,7 @@ extern int target_flags;
 
 /* Set this nonzero if move instructions will actually fail to work
    when given unaligned data.  */
-#define STRICT_ALIGNMENT 1
+#define STRICT_ALIGNMENT (TARGET_STRICT_ALIGNMENT)
 
 /* Maximum power of 2 that code can be aligned to.  */
 #define MAX_CODE_ALIGN	2			/* 4 byte alignment */
md5sum: 2699cfd95b5f59ad 94b2308fa316573a 10562
--- /sloth/disk0/co/egcs-mainline/egcs/gcc/config/m68k/m68kelf.h	Mon Sep  6 13:25:40 1999
+++ egcs/gcc/config/m68k/m68kelf.h	Thu Nov 11 20:36:49 1999
@@ -22,7 +22,7 @@ along with GNU CC; see the file COPYING.
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-/* #notinclude "m68k/sgs.h"	/* The m68k/SVR4 assembler is SGS based */
+/* #notinclude "m68k/sgs.h"	/ * The m68k/SVR4 assembler is SGS based */
 
 /* These are necessary for -fpic/-fPIC to work correctly.  */
 #ifndef MOTOROLA
============================================================


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