This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[m68k] Incorrect "U" constraint (PR23482)
- From: Paul Brook <paul at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 20 Dec 2005 17:44:56 +0000
- Subject: [m68k] Incorrect "U" constraint (PR23482)
PR23482 is an ICE on ColdFire where gcc is generating invalid memory->memory
moves in functions with large stack frames. This appears to be because reload
correctly determines that (fp + large_offset) is an invalid address, but it's
then accepted by the U alternative in the movsi_cf pattern.
The same problem also occurred in
gcc.c-torture/compile/20020604-1.c
gcc.c-torture/compile/20050303-1.c
The attached patch tightens the U constraint to only accept 16-bit offsets.
This constraint is only even used in ColdFire instructions, so we don't have
to worry about 68020+ which have 32-bit displacements.
It also documents the Q,S,T and U constraints.
Tested with cross to m68k-elf/-m5200
Ok?
Paul
2005-12-20 Paul Brook <paul@codesourcery.com>
PR target/23482
* doc/md.texi: Document m68k Q, S, T and U constraints.
* config/m68k/m68k.h (EXTRA_CONSTRAINTS): Restrict U to 16-bit
offsets.
Index: gcc/doc/md.texi
===================================================================
--- gcc/doc/md.texi (revision 108736)
+++ gcc/doc/md.texi (working copy)
@@ -2421,7 +2421,7 @@
(@samp{m} is preferable for @code{asm} statements)
@end table
-@item Motorola 680x0---@file{m68k.h}
+@item Motorola 680x0 and ColdFire---@file{m68k.h}
@table @code
@item a
Address register
@@ -2447,6 +2447,18 @@
@item M
Signed number whose magnitude is greater than 0x100
+@item Q
+Address register indirect addressing mode
+
+@item S
+Operands that satisfy @code{m} when -mpcrel is in effect
+
+@item T
+Operands that satisfy @code{s} when -mpcrel is not in effect
+
+@item U
+Register offset addressing mode
+
@item G
Floating point constant that is not a 68881 constant
@end table
Index: gcc/config/m68k/m68k.h
===================================================================
--- gcc/config/m68k/m68k.h (revision 108736)
+++ gcc/config/m68k/m68k.h (working copy)
@@ -397,7 +397,9 @@
? (GET_CODE (OP) == MEM \
&& GET_CODE (XEXP (OP, 0)) == PLUS \
&& GET_CODE (XEXP (XEXP (OP, 0), 0)) == REG \
- && GET_CODE (XEXP (XEXP (OP, 0), 1)) == CONST_INT) \
+ && GET_CODE (XEXP (XEXP (OP, 0), 1)) == CONST_INT \
+ && INTVAL (XEXP (XEXP (OP, 0), 1)) < 0x8000 \
+ && INTVAL (XEXP (XEXP (OP, 0), 1)) >= -0x8000) \
: \
0))))