From: Richard Kenner Date: Thu, 5 May 1994 17:39:17 +0000 (-0400) Subject: (movhi): Simplify code involving jump-table reference. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=83a24b1d0d7894b76f1ad1e31dd149f2c6a79baf;p=gcc.git (movhi): Simplify code involving jump-table reference. (load_address): Handle case of jump-table reference; output required label. From-SVN: r7215 --- diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md index 436582709a8..7e4d89e9d50 100644 --- a/gcc/config/m68k/m68k.md +++ b/gcc/config/m68k/m68k.md @@ -832,19 +832,15 @@ /* 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. */ + 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), 0)) == LABEL_REF - || GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == LABEL_REF) - && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) != PLUS - && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) != PLUS) + && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == LABEL_REF + && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) != PLUS) { - rtx labelref; - if (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF) - labelref = XEXP (XEXP (operands[1], 0), 0); - else - labelref = XEXP (XEXP (operands[1], 0), 1); + rtx labelref = XEXP (XEXP (operands[1], 0), 1); #if defined (MOTOROLA) && !defined (SGS_SWITCH_TABLES) #ifdef SGS asm_fprintf (asm_out_file, \"\\tset %LLI%d,.+2\\n\", @@ -4946,7 +4942,41 @@ [(set (match_operand:SI 0 "general_operand" "=a") (match_operand:QI 1 "address_operand" "p"))] "" - "lea %a1,%0") + "* +{ +#ifndef SGS_NO_LI + /* 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 defined (MOTOROLA) && !defined (SGS_SWITCH_TABLES) +#ifdef SGS + asm_fprintf (asm_out_file, \"\\tset %LLI%d,.+2\\n\", + CODE_LABEL_NUMBER (XEXP (labelref, 0))); +#else /* not SGS */ + asm_fprintf (asm_out_file, \"\\t.set %LLI%d,.+2\\n\", + CODE_LABEL_NUMBER (XEXP (labelref, 0))); +#endif /* not SGS */ +#else /* SGS_SWITCH_TABLES or not MOTOROLA */ + ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"LI\", + CODE_LABEL_NUMBER (XEXP (labelref, 0))); +#ifdef SGS_SWITCH_TABLES + /* Set flag saying we need to define the symbol + LD%n (with value L%n-LI%n) at the end of the switch table. */ + switch_table_difference_label_flag = 1; +#endif /* SGS_SWITCH_TABLES */ +#endif /* SGS_SWITCH_TABLES or not MOTOROLA */ + } +#endif /* SGS_NO_LI */ + + return \"lea %a1,%0\"; +}") ;; This is the first machine-dependent peephole optimization. ;; It is useful when a floating value is returned from a function call