public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* 3.1 m68k/coldfire code gen problem!!
@ 2002-05-08 16:25 Joel Sherrill
  2002-05-08 18:29 ` Andreas Schwab
  2002-05-15  5:49 ` Philippe De Muyter
  0 siblings, 2 replies; 12+ messages in thread
From: Joel Sherrill @ 2002-05-08 16:25 UTC (permalink / raw)
  To: gcc, law, phdm, Mark Mitchell

[-- Attachment #1: Type: text/plain, Size: 1153 bytes --]


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

Attached is a bzip'ed test case. It is straight out of
RTEMS.

I have cc'ed the folks listed as m68k maintainers 
in the hopes that they have a compiler built and 
can duplicate this with an other m68k target 
before I file a PR with the release pending. :)

Hopefully this has been fixed in the passed week. 

Thanks.

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel@OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

[-- Attachment #2: testcase.c.bz2 --]
[-- Type: application/octet-stream, Size: 5578 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 3.1 m68k/coldfire code gen problem!!
  2002-05-08 16:25 3.1 m68k/coldfire code gen problem!! Joel Sherrill
@ 2002-05-08 18:29 ` Andreas Schwab
  2002-05-09  6:37   ` Joel Sherrill
  2002-05-09  8:34   ` Peter Barada
  2002-05-15  5:49 ` Philippe De Muyter
  1 sibling, 2 replies; 12+ messages in thread
From: Andreas Schwab @ 2002-05-08 18:29 UTC (permalink / raw)
  To: joel.sherrill; +Cc: gcc

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."

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 3.1 m68k/coldfire code gen problem!!
  2002-05-08 18:29 ` Andreas Schwab
@ 2002-05-09  6:37   ` Joel Sherrill
  2002-05-09  7:45     ` Andreas Schwab
  2002-05-09  8:34   ` Peter Barada
  1 sibling, 1 reply; 12+ messages in thread
From: Joel Sherrill @ 2002-05-09  6:37 UTC (permalink / raw)
  To: Andreas Schwab, Mark Mitchell; +Cc: gcc


Thanks Andreas!!! I can now confirm that with this patch,
RTEMS compiles for the Coldfire.  

Mark could it go into 3.1?  

--joel

Andreas Schwab wrote:
> 
> 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."

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel@OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 3.1 m68k/coldfire code gen problem!!
  2002-05-09  6:37   ` Joel Sherrill
@ 2002-05-09  7:45     ` Andreas Schwab
  2002-05-09  9:51       ` Mark Mitchell
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2002-05-09  7:45 UTC (permalink / raw)
  To: joel.sherrill; +Cc: Mark Mitchell, gcc

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

|> Thanks Andreas!!! I can now confirm that with this patch,
|> RTEMS compiles for the Coldfire.  

This is strange, because I didn't work for me in this form in a cross
compiler.  Moreover, I think we can leave out the sign extension for an
address register altogether, since address registers are always
automatically sign extended when written in word mode.

Andreas.

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

	* config/m68k/m68k.md (tablejump+2): Don't sign extend an address
	register.
        * config/m68k/apollo68.h (ASM_RETURN_CASE_JUMP): Likewise.
        * config/m68k/coff.h (ASM_RETURN_CASE_JUMP): Likewise.
        * config/m68k/linux.h (ASM_RETURN_CASE_JUMP): Likewise.
        * config/m68k/m68kelf.h (ASM_RETURN_CASE_JUMP): Likewise.
        * config/m68k/mot3300.h (ASM_RETURN_CASE_JUMP): Likewise.
        * config/m68k/netbsd-elf.h (ASM_RETURN_CASE_JUMP): Likewise.
        * config/m68k/pbb.h (ASM_RETURN_CASE_JUMP): Likewise.

Index: apollo68.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/apollo68.h,v
retrieving revision 1.6
diff -u -p -a -r1.6 apollo68.h
--- apollo68.h	4 Nov 2001 22:37:45 -0000	1.6
+++ apollo68.h	9 May 2002 14:32:23 -0000
@@ -1,5 +1,5 @@
 /* Definitions of target machine for GNU compiler.  Apollo 680X0 version.
-   Copyright (C) 1989, 1992, 1996, 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1992, 1996, 1997, 1999, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -177,12 +177,17 @@ Boston, MA 02111-1307, USA.  */
 /* config/m68k.md has an explicit reference to the program counter,
    prefix this by the register prefix.  */
 
-#define ASM_RETURN_CASE_JUMP    		\
-  do {						\
-    if (TARGET_5200)				\
-      return "ext%.l %0\n\tjmp %%pc@(2,%0:l)";	\
-    else					\
-      return "jmp %%pc@(2,%0:w)";		\
+#define ASM_RETURN_CASE_JUMP				\
+  do {							\
+    if (TARGET_5200)					\
+      {							\
+	if (ADDRESS_REG_P (operands[0]))		\
+	  return "jmp %%pc@(2,%0:l)";			\
+	else						\
+	  return "ext%.l %0\n\tjmp %%pc@(2,%0:l)";	\
+      }							\
+    else						\
+      return "jmp %%pc@(2,%0:w)";			\
   } while (0)
 
 /* Here are the new register names.  */
Index: coff.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/coff.h,v
retrieving revision 1.7
diff -u -p -a -r1.7 coff.h
--- coff.h	15 Nov 2001 17:55:27 -0000	1.7
+++ coff.h	9 May 2002 14:32:23 -0000
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler.
    m68k series COFF object files and debugging, version.
-   Copyright (C) 1994, 1996, 1997, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -55,12 +55,17 @@ Boston, MA 02111-1307, USA.  */
 /* config/m68k.md has an explicit reference to the program counter,
    prefix this by the register prefix.  */
 
-#define ASM_RETURN_CASE_JUMP 			\
-  do {						\
-    if (TARGET_5200)				\
-      return "ext%.l %0\n\tjmp %%pc@(2,%0:l)";	\
-    else					\
-      return "jmp %%pc@(2,%0:w)";		\
+#define ASM_RETURN_CASE_JUMP				\
+  do {							\
+    if (TARGET_5200)					\
+      {							\
+	if (ADDRESS_REG_P (operands[0]))		\
+	  return "jmp %%pc@(2,%0:l)";			\
+	else						\
+	  return "ext%.l %0\n\tjmp %%pc@(2,%0:l)";	\
+      }							\
+    else						\
+      return "jmp %%pc@(2,%0:w)";			\
   } while (0)
 
 /* Here are the new register names.  */
Index: linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/linux.h,v
retrieving revision 1.19.8.2
diff -u -p -a -r1.19.8.2 linux.h
--- linux.h	15 Apr 2002 20:27:31 -0000	1.19.8.2
+++ linux.h	9 May 2002 14:32:23 -0000
@@ -194,12 +194,17 @@ Boston, MA 02111-1307, USA.  */
 
 /* Use the default action for outputting the case label.  */
 #undef ASM_OUTPUT_CASE_LABEL
-#define ASM_RETURN_CASE_JUMP			\
-  do {						\
-    if (TARGET_5200)				\
-      return "ext%.l %0\n\tjmp %%pc@(2,%0:l)";	\
-    else					\
-      return "jmp %%pc@(2,%0:w)";		\
+#define ASM_RETURN_CASE_JUMP				\
+  do {							\
+    if (TARGET_5200)					\
+      {							\
+	if (ADDRESS_REG_P (operands[0]))		\
+	  return "jmp %%pc@(2,%0:l)";			\
+	else						\
+	  return "ext%.l %0\n\tjmp %%pc@(2,%0:l)";	\
+      }							\
+    else						\
+      return "jmp %%pc@(2,%0:w)";			\
   } while (0)
 
 /* This is how to output an assembler line that says to advance the
Index: m68k.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/m68k.md,v
retrieving revision 1.48.8.1
diff -u -p -a -r1.48.8.1 m68k.md
--- m68k.md	2 Apr 2002 08:14:14 -0000	1.48.8.1
+++ m68k.md	9 May 2002 14:32:24 -0000
@@ -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 \"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 \"jmp 2(pc,%0.l)\";
+#else
+	  return \"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 \"jmp (2,pc,%0.l)\";
 #else
-      return \"extl %0\;jmp pc@(2,%0:l)\";
+	  return \"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
     {
Index: m68kelf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/m68kelf.h,v
retrieving revision 1.14
diff -u -p -a -r1.14 m68kelf.h
--- m68kelf.h	17 Dec 2001 15:05:34 -0000	1.14
+++ m68kelf.h	9 May 2002 14:32:24 -0000
@@ -1,7 +1,7 @@
 /* m68kelf support, derived from m68kv4.h */
 
 /* Target definitions for GNU compiler for mc680x0 running System V.4
-   Copyright (C) 1991, 1993, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1993, 2000, 2002 Free Software Foundation, Inc.
 
    Written by Ron Guilmette (rfg@netcom.com) and Fred Fish (fnf@cygnus.com).
 
@@ -73,12 +73,17 @@ Boston, MA 02111-1307, USA.  */
 /* config/m68k.md has an explicit reference to the program counter,
    prefix this by the register prefix.  */
 
-#define ASM_RETURN_CASE_JUMP 			\
-  do {						\
-    if (TARGET_5200)				\
-      return "ext%.l %0\n\tjmp %%pc@(2,%0:l)";	\
-    else					\
-      return "jmp %%pc@(2,%0:w)";		\
+#define ASM_RETURN_CASE_JUMP				\
+  do {							\
+    if (TARGET_5200)					\
+      {							\
+	if (ADDRESS_REG_P (operands[0]))		\
+	  return "jmp %%pc@(2,%0:l)";			\
+	else						\
+	  return "ext%.l %0\n\tjmp %%pc@(2,%0:l)";	\
+      }							\
+    else						\
+      return "jmp %%pc@(2,%0:w)";			\
   } while (0)
 
 /* How to refer to registers in assembler output.
Index: mot3300.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/mot3300.h,v
retrieving revision 1.24
diff -u -p -a -r1.24 mot3300.h
--- mot3300.h	20 Dec 2001 17:36:36 -0000	1.24
+++ mot3300.h	9 May 2002 14:32:24 -0000
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler,
    SysV68 Motorola 3300 Delta Series.
-   Copyright (C) 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+   Copyright (C) 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002
    Free Software Foundation, Inc.
    Contributed by Abramo and Roberto Bagnara (bagnara@dipisa.di.unipi.it)
    based on Alex Crain's 3B1 definitions.
@@ -441,12 +441,17 @@ Boston, MA 02111-1307, USA.  */
 #define ASM_OUTPUT_CASE_FETCH(file, labelno, regname)\
 	asm_fprintf (file, "12(%Rpc,%s.", regname)
 
-#define ASM_RETURN_CASE_JUMP \
-  do {						\
-    if (TARGET_5200)				\
-      return "ext%.l %0\n\tjmp 8(%%pc,%0.l)";	\
-    else					\
-      return "jmp 8(%%pc,%0.w)";		\
+#define ASM_RETURN_CASE_JUMP				\
+  do {							\
+    if (TARGET_5200)					\
+      {							\
+	if (ADDRESS_REG_P (operands[0]))		\
+	  return "jmp 8(%%pc,%0.l)";			\
+	else						\
+	  return "ext%.l %0\n\tjmp 8(%%pc,%0.l)";	\
+      }							\
+    else						\
+      return "jmp 8(%%pc,%0.w)";			\
   } while (0)
 	     
 #else /* USE_GAS */
Index: netbsd-elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/netbsd-elf.h,v
retrieving revision 1.2
diff -u -p -a -r1.2 netbsd-elf.h
--- netbsd-elf.h	5 Feb 2002 19:01:52 -0000	1.2
+++ netbsd-elf.h	9 May 2002 14:32:24 -0000
@@ -11,7 +11,7 @@ This file is part of GNU CC.
 
 GNU CC is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
+the Free Software Foundation; either version 2, or (at your option)
 any later version.
 
 GNU CC is distributed in the hope that it will be useful,
@@ -226,15 +226,18 @@ while (0)
 
 /* Use the default action for outputting the case label.  */
 #undef ASM_OUTPUT_CASE_LABEL
-#define ASM_RETURN_CASE_JUMP						\
-do									\
-  {									\
-    if (TARGET_5200)							\
-      return "ext%.l %0\n\tjmp %%pc@(2,%0:l)";				\
-    else								\
-      return "jmp %%pc@(2,%0:w)";					\
-  }									\
-while (0)
+#define ASM_RETURN_CASE_JUMP				\
+  do {							\
+    if (TARGET_5200)					\
+      {							\
+	if (ADDRESS_REG_P (operands[0]))		\
+	  return "jmp %%pc@(2,%0:l)";			\
+	else						\
+	  return "ext%.l %0\n\tjmp %%pc@(2,%0:l)";	\
+      }							\
+    else						\
+      return "jmp %%pc@(2,%0:w)";			\
+  } while (0)
 
 
 /* This is how to output an assembler line that says to advance the
Index: pbb.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/pbb.h,v
retrieving revision 1.5
diff -u -p -a -r1.5 pbb.h
--- pbb.h	1 Nov 2001 14:49:33 -0000	1.5
+++ pbb.h	9 May 2002 14:32:24 -0000
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler.
    Citicorp/TTI Unicom PBB version (using GAS with a %-register prefix)
-   Copyright (C) 1987, 1988, 1990, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1987, 1988, 1990, 1996, 1997, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -113,12 +113,17 @@ Boston, MA 02111-1307, USA.  */
       && ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode))	\
       asm_fprintf (FILE, "\tmovl %Rd0,%Ra0\n"); } 
 
-#define ASM_RETURN_CASE_JUMP \
-  do {						\
-    if (TARGET_5200)				\
-      return "ext%.l %0\n\tjmp %%pc@(2,%0:l)";	\
-    else					\
-      return "jmp %%pc@(2,%0:w)";		\
+#define ASM_RETURN_CASE_JUMP				\
+  do {							\
+    if (TARGET_5200)					\
+      {							\
+	if (ADDRESS_REG_P (operands[0]))		\
+	  return "jmp %%pc@(2,%0:l)";			\
+	else						\
+	  return "ext%.l %0\n\tjmp %%pc@(2,%0:l)";	\
+      }							\
+    else						\
+      return "jmp %%pc@(2,%0:w)";			\
   } while (0)
 
 /* Although the gas we use can create .ctor and .dtor sections from N_SETT


-- 
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."

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 3.1 m68k/coldfire code gen problem!!
  2002-05-08 18:29 ` Andreas Schwab
  2002-05-09  6:37   ` Joel Sherrill
@ 2002-05-09  8:34   ` Peter Barada
  1 sibling, 0 replies; 12+ messages in thread
From: Peter Barada @ 2002-05-09  8:34 UTC (permalink / raw)
  To: schwab; +Cc: joel.sherrill, gcc


>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.

1) The move.w from memory to the address register did the sign extension
   anyway so in this case the 'move.w %0,%0' is a no-op.

2) What about the case where ASM_RETURN_CASE_JUMP is defined?  You'll
   have to modify the definition to look at operands[0] to see if its
   an address register(m68kelf.h and 6 other files)

I suggest that you modify the defintion of ASM_RETURN_CASE_JUMP to
be(at least from m68kelf.h):

#define ASM_RETURN_CASE_JUMP(operands) 		\
  do {						\
    if (ADDRESS_REG_P (operands[0]))		\
      return "jmp %%pc@(2,%0:l)";		\
    if (TARGET_5200)				\
      return "ext%.l %0\;jmp %%pc@(2,%0:l)";	\
    else					\
      return "jmp %%pc@(2,%0:w)";		\
  } while (0)

Note that 'operands' is now a parameter to the macro.

-- 
Peter Barada                                   Peter.Barada@motorola.com
Wizard                                         781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola)   781-270-0193 (fax)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 3.1 m68k/coldfire code gen problem!!
  2002-05-09  7:45     ` Andreas Schwab
@ 2002-05-09  9:51       ` Mark Mitchell
  2002-05-09 10:19         ` Andreas Schwab
  2002-05-09 13:53         ` Joel Sherrill
  0 siblings, 2 replies; 12+ messages in thread
From: Mark Mitchell @ 2002-05-09  9:51 UTC (permalink / raw)
  To: Andreas Schwab, joel.sherrill; +Cc: gcc



--On Thursday, May 09, 2002 4:40 PM +0200 Andreas Schwab <schwab@suse.de> 
wrote:

> Joel Sherrill <joel.sherrill@OARcorp.com> writes:
>
> |> Thanks Andreas!!! I can now confirm that with this patch,
> |> RTEMS compiles for the Coldfire.
>
> This is strange, because I didn't work for me in this form in a cross
> compiler.

Gentlemen --

This one is going to have wait for GCC 3.1.1.  I understand it is a
regression, but I don't want to be making any more changes at this time,
unless they are absolutely essential.  We've got to find the bugs sooner.

We will definitely solve this for 3.1.1; Joel, make sure you get a
high-priority PR in GNATS as soon as 3.1 is out.

With apologies,

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 3.1 m68k/coldfire code gen problem!!
  2002-05-09  9:51       ` Mark Mitchell
@ 2002-05-09 10:19         ` Andreas Schwab
  2002-05-09 13:53         ` Joel Sherrill
  1 sibling, 0 replies; 12+ messages in thread
From: Andreas Schwab @ 2002-05-09 10:19 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: joel.sherrill, gcc

Mark Mitchell <mark@codesourcery.com> writes:

|> --On Thursday, May 09, 2002 4:40 PM +0200 Andreas Schwab <schwab@suse.de>
|>   wrote:
|> 
|> > Joel Sherrill <joel.sherrill@OARcorp.com> writes:
|> >
|> > |> Thanks Andreas!!! I can now confirm that with this patch,
|> > |> RTEMS compiles for the Coldfire.
|> >
|> > This is strange, because I didn't work for me in this form in a cross
|> > compiler.
|> 
|> Gentlemen --
|> 
|> This one is going to have wait for GCC 3.1.1.

I didn't expect more anyway.  The patch has to be properly tested first
(I can't do that), that's why I didn't post it on gcc-patches.

Andreas.

-- 
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."

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 3.1 m68k/coldfire code gen problem!!
  2002-05-09  9:51       ` Mark Mitchell
  2002-05-09 10:19         ` Andreas Schwab
@ 2002-05-09 13:53         ` Joel Sherrill
  2002-05-10  0:56           ` Richard Henderson
  1 sibling, 1 reply; 12+ messages in thread
From: Joel Sherrill @ 2002-05-09 13:53 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: Andreas Schwab, gcc

Mark Mitchell wrote:
> 
> --On Thursday, May 09, 2002 4:40 PM +0200 Andreas Schwab <schwab@suse.de>
> wrote:
> 
> > Joel Sherrill <joel.sherrill@OARcorp.com> writes:
> >
> > |> Thanks Andreas!!! I can now confirm that with this patch,
> > |> RTEMS compiles for the Coldfire.
> >
> > This is strange, because I didn't work for me in this form in a cross
> > compiler.
> 
> Gentlemen --
> 
> This one is going to have wait for GCC 3.1.1.  I understand it is a
> regression, but I don't want to be making any more changes at this time,
> unless they are absolutely essential.  We've got to find the bugs sooner.
> 
> We will definitely solve this for 3.1.1; Joel, make sure you get a
> high-priority PR in GNATS as soon as 3.1 is out.
> 
> With apologies,

Not a problem on this side either.  If 3.1.0 lasts long enough for
RTEMS RPMs to get built, I will include a patch from Andreas.

As an aside, is it possible to do a compile only run on the
gcc testsuite for targets one can't execute code on?  I would be
happy to do a build-only sweep on the cross targets I can't 
execute.

> --
> Mark Mitchell
> CodeSourcery, LLC
> mark@codesourcery.com

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel@OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 3.1 m68k/coldfire code gen problem!!
  2002-05-09 13:53         ` Joel Sherrill
@ 2002-05-10  0:56           ` Richard Henderson
  2002-05-10  6:01             ` Joel Sherrill
  0 siblings, 1 reply; 12+ messages in thread
From: Richard Henderson @ 2002-05-10  0:56 UTC (permalink / raw)
  To: Joel Sherrill; +Cc: Mark Mitchell, Andreas Schwab, gcc

On Thu, May 09, 2002 at 03:38:54PM -0500, Joel Sherrill wrote:
> As an aside, is it possible to do a compile only run on the
> gcc testsuite for targets one can't execute code on?  I would be
> happy to do a build-only sweep on the cross targets I can't 
> execute.

No, but you can link /bin/true as the $target-run simulator.


r~

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 3.1 m68k/coldfire code gen problem!!
  2002-05-10  0:56           ` Richard Henderson
@ 2002-05-10  6:01             ` Joel Sherrill
  2002-05-10 11:07               ` Richard Henderson
  0 siblings, 1 reply; 12+ messages in thread
From: Joel Sherrill @ 2002-05-10  6:01 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Mark Mitchell, Andreas Schwab, gcc



Richard Henderson wrote:
> 
> On Thu, May 09, 2002 at 03:38:54PM -0500, Joel Sherrill wrote:
> > As an aside, is it possible to do a compile only run on the
> > gcc testsuite for targets one can't execute code on?  I would be
> > happy to do a build-only sweep on the cross targets I can't
> > execute.
> 
> No, but you can link /bin/true as the $target-run simulator.

OK.  That would seem to work for expected passes but what about
expected fails?  Will it invalidate any other category of
tests?

I would just like to know how to filter the results.

> r~

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel@OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 3.1 m68k/coldfire code gen problem!!
  2002-05-10  6:01             ` Joel Sherrill
@ 2002-05-10 11:07               ` Richard Henderson
  0 siblings, 0 replies; 12+ messages in thread
From: Richard Henderson @ 2002-05-10 11:07 UTC (permalink / raw)
  To: Joel Sherrill; +Cc: Mark Mitchell, Andreas Schwab, gcc

On Fri, May 10, 2002 at 06:30:12AM -0500, Joel Sherrill wrote:
> OK.  That would seem to work for expected passes but what about
> expected fails?  Will it invalidate any other category of tests?

That should be about it.


r~

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: 3.1 m68k/coldfire code gen problem!!
  2002-05-08 16:25 3.1 m68k/coldfire code gen problem!! Joel Sherrill
  2002-05-08 18:29 ` Andreas Schwab
@ 2002-05-15  5:49 ` Philippe De Muyter
  1 sibling, 0 replies; 12+ messages in thread
From: Philippe De Muyter @ 2002-05-15  5:49 UTC (permalink / raw)
  To: joel.sherrill; +Cc: gcc, law, Mark Mitchell

Joel Sherrill wrote :

> 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

I have checked the m68k.md patterns to find where a "r" constraint was used
for an ext.l operand and I think the culprit is the `tablejump+2' pattern.
(look for `ASM_OUTPUT_CASE_LABEL')

A simple hack would be to replace the "r" constraint with a "d" constraint,
but that would lead to code pessimization for non-coldfire m68k processors.

The real fix would be to differentiate the pattern for coldfire (with "d"
constraint) and non-coldfire (with "r" constraint) cases.

I hope this helps

Philippe

Philippe De Muyter  phdm@macqel.be  Tel +32 27029044
Macq Electronique SA  rue de l'Aeronef 2  B-1140 Bruxelles  Fax +32 27029077

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2002-05-15 12:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-08 16:25 3.1 m68k/coldfire code gen problem!! Joel Sherrill
2002-05-08 18:29 ` Andreas Schwab
2002-05-09  6:37   ` Joel Sherrill
2002-05-09  7:45     ` Andreas Schwab
2002-05-09  9:51       ` Mark Mitchell
2002-05-09 10:19         ` Andreas Schwab
2002-05-09 13:53         ` Joel Sherrill
2002-05-10  0:56           ` Richard Henderson
2002-05-10  6:01             ` Joel Sherrill
2002-05-10 11:07               ` Richard Henderson
2002-05-09  8:34   ` Peter Barada
2002-05-15  5:49 ` Philippe De Muyter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).