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]

[m68k] -pcrel fix for TARGET_COLDFIRE


Hello,

this wasn't regression tested as the testsuite can't be (easily) run
on ColdFire targets, but it looks pretty straightforward.

This bug also affects 4.0 and 3.4 so I'd like to backport it
to these branches too.


2005-07-29  Andrea Tarani  <andrea.tarani@gilbarco.com>

	* config/m68k/m68k.c (m68k_output_pic_call): Avoid generating a bsr.l
	opcode on ColdFire targets when compiling with -pcrel enabled.

Index: gcc/config/m68k/m68k.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/m68k.c,v
retrieving revision 1.153
diff -u -p -r1.153 m68k.c
--- gcc/config/m68k/m68k.c	11 Jul 2005 23:32:01 -0000	1.153
+++ gcc/config/m68k/m68k.c	29 Jul 2005 06:31:27 -0000
@@ -1047,15 +1047,19 @@ m68k_output_pic_call(rtx dest)
 
   if (!(GET_CODE (dest) == MEM && GET_CODE (XEXP (dest, 0)) == SYMBOL_REF))
     out = "jsr %0";
-      /* We output a BSR instruction if we're using -fpic or we're building for
-       * a target that supports long branches.  If we're building -fPIC on the
-       * 68000, 68010 or ColdFire we generate one of two sequences:
-       * a shorter one that uses a GOT entry or a longer one that doesn't.
-       * We'll use the -Os command-line flag to decide which to generate.
-       * Both sequences take the same time to execute on the ColdFire.
-       */
+ /* We output a BSR instruction if we're using -fpic or we're building for
+    a target that supports long branches.  If we're building -fPIC on the
+    68000, 68010 or ColdFire we generate one of two sequences:
+    a shorter one that uses a GOT entry or a longer one that doesn't.
+    We'll use the -Os command-line flag to decide which to generate.
+    Both sequences take the same time to execute on the ColdFire.  */
   else if (TARGET_PCREL)
-    out = "bsr.l %o0";
+  {
+    if (TARGET_COLDFIRE && !TARGET_CFV4)
+      out = "lea %o0-.-8,%%a1\n\tjsr 0(%%pc,%%a1)";
+    else
+      out = "bsr.l %o0";
+  }
   else if ((flag_pic == 1) || TARGET_68020)
 #if defined(USE_GAS)
     out = "bsr.l %0@PLTPC";

-- 
  // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/


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