This is the mail archive of the gcc@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]

Re: 3.1 m68k/coldfire code gen problem!!


Joel Sherrill <joel.sherrill@OARcorp.com> writes:

|> Hi,
|> 
|> I was tracking down problems compiling RTEMS with gcc 3.1
|> and came across a case where my gcc 3.1 produces incorrect
|> code for the ColdFire.  Does anyone have a binary for an
|> m68k compiler newer than mine to doublecheck on?
|> 
|> $ /opt/gcc-3.1-test/bin/m68k-rtems-gcc --version
|> m68k-rtems-gcc (GCC) 3.1 20020430 (prerelease)
|> 
|> bash-2.05$ m68k-rtems-gcc -m5200 -O -c testcase.c 
|> bash-2.05$ m68k-rtems-gcc -m5200 -O2 -c testcase.c 
|> bash-2.05$ m68k-rtems-gcc -m5200 -O4 -c testcase.c 
|> /tmp/ccQJLRmU.s: Assembler messages:
|> /tmp/ccQJLRmU.s:90: Error: operands mismatch -- statement `ext.l %a1'
|> ignored

Could you please test this patch?

2002-05-09  Andreas Schwab  <schwab@suse.de>

	* config/m68k/m68k.md (tabljump+2): Use `move.w %0,%0' for sign
	extending an address register.

--- m68k.md.~1.48.8.1.~	2002-04-04 11:03:09.000000000 +0200
+++ m68k.md	2002-05-09 01:34:57.000000000 +0200
@@ -1,5 +1,5 @@
 ;;- Machine description for GNU compiler, Motorola 68000 Version
-;;  Copyright (C) 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001
+;;  Copyright (C) 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002
 ;;  Free Software Foundation, Inc.
 
 ;; This file is part of GNU CC.
@@ -6943,17 +6943,33 @@
 #ifdef SGS
 #ifdef ASM_OUTPUT_CASE_LABEL
   if (TARGET_5200) 
-    return \"ext%.l %0\;jmp 6(%%pc,%0.l)\";
+    {
+      if (ADDRESS_REG_P (operands[0]))
+	return \"move%.w %0,%0\;jmp 6(%%pc,%0.l)\";
+      else
+	return \"ext%.l %0\;jmp 6(%%pc,%0.l)\";
+    }
   else
     return \"jmp 6(%%pc,%0.w)\";
 #else
   if (TARGET_5200)
     {
+      if (ADDRESS_REG_P (operands[0]))
+	{
+#ifdef CRDS
+	  return \"move%.w %0,%0\;jmp 2(pc,%0.l)\";
+#else
+	  return \"movew %0,%0\;jmp 2(%%pc,%0.l)\";
+#endif  /* end !CRDS */
+	}
+      else
+	{
 #ifdef CRDS
-      return \"ext%.l %0\;jmp 2(pc,%0.l)\";
+	  return \"ext%.l %0\;jmp 2(pc,%0.l)\";
 #else
-      return \"extl %0\;jmp 2(%%pc,%0.l)\";
+	  return \"extl %0\;jmp 2(%%pc,%0.l)\";
 #endif  /* end !CRDS */
+	}
     }
   else
     {
@@ -6967,11 +6983,22 @@
 #else /* not SGS */
   if (TARGET_5200)
     {
+      if (ADDRESS_REG_P (operands[0]))
+	{
 #ifdef MOTOROLA
-      return \"ext%.l %0\;jmp (2,pc,%0.l)\";
+	  return \"move%.w %0,%0\;jmp (2,pc,%0.l)\";
 #else
-      return \"extl %0\;jmp pc@(2,%0:l)\";
+	  return \"movew %0,%0\;jmp pc@(2,%0:l)\";
 #endif
+	}
+      else
+	{
+#ifdef MOTOROLA
+	  return \"ext%.l %0\;jmp (2,pc,%0.l)\";
+#else
+	  return \"extl %0\;jmp pc@(2,%0:l)\";
+#endif
+	}
     }
   else
     {

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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