From e59d83aa39bdf6bc545649db1737cbe3cc62a136 Mon Sep 17 00:00:00 2001
From: Roman Zippel <zippel@linux-m68k.org>
Date: Wed, 19 Sep 2007 15:20:59 +0000
Subject: [PATCH] m68k.c (output_move_himode): Remove jump table recognition.

	* config/m68k/m68k.c (output_move_himode): Remove jump table
	recognition.
	config/m68k/m68k.md (lea): Likewise.
	* config/m68k/m68k.c (print_operand_address): Use simple pc
	relative addressing.

From-SVN: r128601
---
 gcc/ChangeLog           |  8 ++++++++
 gcc/config/m68k/m68k.c  | 36 ++----------------------------------
 gcc/config/m68k/m68k.md | 23 ++---------------------
 3 files changed, 12 insertions(+), 55 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 27a187336438..2e4a1907503a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2007-09-19  Roman Zippel <zippel@linux-m68k.org>
+
+	* config/m68k/m68k.c (output_move_himode): Remove jump table
+	recognition.
+	config/m68k/m68k.md (lea): Likewise.
+	* config/m68k/m68k.c (print_operand_address): Use simple pc
+	relative addressing.
+
 2007-09-19  Bernd Schmidt  <bernd.schmidt@analog.com>
 
 	* doc/tm.texi (IS_ASM_LOGICAL_LINE_SEPARATOR): Document new argument.
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index 8248e7180ac2..c8e5a6f4a058 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -2359,25 +2359,6 @@ output_move_himode (rtx *operands)
     }
   else if (CONSTANT_P (operands[1]))
     return "move%.l %1,%0";
-  /* Recognize the insn before a tablejump, one that refers
-     to a table of offsets.  Such an insn will need to refer
-     to a label on the insn.  So output one.  Use the label-number
-     of the table of offsets to generate this label.  This code,
-     and similar code below, assumes that there will be at most one
-     reference to each table.  */
-  if (GET_CODE (operands[1]) == MEM
-      && GET_CODE (XEXP (operands[1], 0)) == PLUS
-      && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == LABEL_REF
-      && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) != PLUS)
-    {
-      rtx labelref = XEXP (XEXP (operands[1], 0), 1);
-      if (MOTOROLA)
-	asm_fprintf (asm_out_file, "\t.set %LLI%d,.+2\n",
-		     CODE_LABEL_NUMBER (XEXP (labelref, 0)));
-      else
-	(*targetm.asm_out.internal_label) (asm_out_file, "LI",
-					   CODE_LABEL_NUMBER (XEXP (labelref, 0)));
-    }
   return "move%.w %1,%0";
 }
 
@@ -3819,19 +3800,6 @@ print_operand (FILE *file, rtx op, int letter)
    It is possible for PIC to generate a (plus (label_ref...) (reg...))
    and we handle that just like we would a (plus (symbol_ref...) (reg...)).
 
-   Some SGS assemblers have a bug such that "Lnnn-LInnn-2.b(pc,d0.l*2)"
-   fails to assemble.  Luckily "Lnnn(pc,d0.l*2)" produces the results
-   we want.  This difference can be accommodated by using an assembler
-   define such "LDnnn" to be either "Lnnn-LInnn-2.b", "Lnnn", or any other
-   string, as necessary.  This is accomplished via the ASM_OUTPUT_CASE_END
-   macro.  See m68k/sgs.h for an example; for versions without the bug.
-   Some assemblers refuse all the above solutions.  The workaround is to
-   emit "K(pc,d0.l*2)" with K being a small constant known to give the
-   right behavior.
-
-   They also do not like things like "pea 1.w", so we simple leave off
-   the .w on small constants. 
-
    This routine is responsible for distinguishing between -fpic and -fPIC 
    style relocations in an address.  When generating -fpic code the
    offset is output in word mode (e.g. movel a5@(_foo:w), a0).  When generating
@@ -3902,7 +3870,7 @@ print_operand_address (FILE *file, rtx addr)
 	{
 	  /* Print the "offset(base" component.  */
 	  if (labelno >= 0)
-	    asm_fprintf (file, "%LL%d-%LLI%d.b(%Rpc,", labelno, labelno);
+	    asm_fprintf (file, "%LL%d(%Rpc,", labelno);
 	  else
 	    {
 	      if (address.offset)
@@ -3940,7 +3908,7 @@ print_operand_address (FILE *file, rtx addr)
 	    {
 	      /* Print the "base@(offset" component.  */
 	      if (labelno >= 0)
-		asm_fprintf (file, "%Rpc@(%LL%d-%LLI%d-2:b", labelno, labelno);
+		asm_fprintf (file, "%Rpc@(%LL%d", labelno);
 	      else
 		{
 		  if (address.base)
diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
index 07d40de4f7e3..b3f12d8b6162 100644
--- a/gcc/config/m68k/m68k.md
+++ b/gcc/config/m68k/m68k.md
@@ -7297,30 +7297,11 @@
 
 ;; This should not be used unless the add/sub insns can't be.
 
-(define_insn ""
+(define_insn "*lea"
   [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
 	(match_operand:QI 1 "address_operand" "p"))]
   ""
-{
-  /* Recognize an insn that refers to a table of offsets.  Such an insn will
-     need to refer to a label on the insn.  So output one.  Use the
-     label-number of the table of offsets to generate this label.  This code,
-     and similar code above, assumes that there will be at most one reference
-     to each table.  */
-  if (GET_CODE (operands[1]) == PLUS
-      && GET_CODE (XEXP (operands[1], 1)) == LABEL_REF
-      && GET_CODE (XEXP (operands[1], 0)) != PLUS)
-    {
-      rtx labelref = XEXP (operands[1], 1);
-      if (MOTOROLA)
-        asm_fprintf (asm_out_file, "\\t.set %LLI%d,.+2\\n",
-		     CODE_LABEL_NUMBER (XEXP (labelref, 0)));
-      else
-        (*targetm.asm_out.internal_label) (asm_out_file, "LI",
-		     CODE_LABEL_NUMBER (XEXP (labelref, 0)));
-    }
-  return "lea %a1,%0";
-})
+  "lea %a1,%0")
 
 ;; This is the first machine-dependent peephole optimization.
 ;; It is useful when a floating value is returned from a function call
-- 
GitLab