mips.md (indirect_jump): Use force_reg.
authorRichard Sandiford <rsandifo@redhat.com>
Tue, 24 Aug 2004 19:50:22 +0000 (19:50 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 24 Aug 2004 19:50:22 +0000 (19:50 +0000)
* config/mips/mips.md (indirect_jump): Use force_reg.  Adjust names
of internal patterns.
(indirect_jump[sd]i): Renamed from indirect_jump_internal[12].
Redefine using :P.
(tablejump): Use expand_binop to calculate address.  Adjust names
of internal patterns.
(tablejump[sd]i): Renamed from tablejump_internal[12].
Redefine using :P.
(tablejump_mips16[12]): Delete.

From-SVN: r86509

gcc/ChangeLog
gcc/config/mips/mips.md

index 45634deb2f50fb042c832b6a30cf79d18718b899..e2c252fbfe598cb9d4935264bc87b947384a22b8 100644 (file)
@@ -1,3 +1,15 @@
+2004-08-24  Richard Sandiford  <rsandifo@redhat.com>
+
+       * config/mips/mips.md (indirect_jump): Use force_reg.  Adjust names
+       of internal patterns.
+       (indirect_jump[sd]i): Renamed from indirect_jump_internal[12].
+       Redefine using :P.
+       (tablejump): Use expand_binop to calculate address.  Adjust names
+       of internal patterns.
+       (tablejump[sd]i): Renamed from tablejump_internal[12].
+       Redefine using :P.
+       (tablejump_mips16[12]): Delete.
+
 2004-08-24  Richard Sandiford  <rsandifo@redhat.com>
 
        * config/mips/mips.md (*seq_[sd]i, *seq_[sd]i_mips16, *sne_[sd]i)
index fb7b15d915eca2cb6f11b754cea32bae37f5362d..739307c758ee3bcb1ced61ad5b3023237120ca8d 100644 (file)
@@ -5484,33 +5484,20 @@ beq\t%2,%.,1b\;\
   [(set (pc) (match_operand 0 "register_operand"))]
   ""
 {
-  rtx dest;
-
-  dest = operands[0];
-  if (GET_CODE (dest) != REG || GET_MODE (dest) != Pmode)
-    operands[0] = copy_to_mode_reg (Pmode, dest);
-
-  if (!(Pmode == DImode))
-    emit_jump_insn (gen_indirect_jump_internal1 (operands[0]));
+  operands[0] = force_reg (Pmode, operands[0]);
+  if (Pmode == SImode)
+    emit_jump_insn (gen_indirect_jumpsi (operands[0]));
   else
-    emit_jump_insn (gen_indirect_jump_internal2 (operands[0]));
-
+    emit_jump_insn (gen_indirect_jumpdi (operands[0]));
   DONE;
 })
 
-(define_insn "indirect_jump_internal1"
-  [(set (pc) (match_operand:SI 0 "register_operand" "d"))]
-  "!(Pmode == DImode)"
-  "%*j\t%0%/"
-  [(set_attr "type"    "jump")
-   (set_attr "mode"    "none")])
-
-(define_insn "indirect_jump_internal2"
-  [(set (pc) (match_operand:DI 0 "register_operand" "d"))]
-  "Pmode == DImode"
+(define_insn "indirect_jump<mode>"
+  [(set (pc) (match_operand:P 0 "register_operand" "d"))]
+  ""
   "%*j\t%0%/"
-  [(set_attr "type"    "jump")
-   (set_attr "mode"    "none")])
+  [(set_attr "type" "jump")
+   (set_attr "mode" "none")])
 
 (define_expand "tablejump"
   [(set (pc)
@@ -5519,81 +5506,29 @@ beq\t%2,%.,1b\;\
   ""
 {
   if (TARGET_MIPS16)
-    {
-      if (GET_MODE (operands[0]) != HImode)
-       abort ();
-      if (!(Pmode == DImode))
-       emit_insn (gen_tablejump_mips161 (operands[0], operands[1]));
-      else
-       emit_insn (gen_tablejump_mips162 (operands[0], operands[1]));
-      DONE;
-    }
-
-  if (GET_MODE (operands[0]) != ptr_mode)
-    abort ();
-
-  if (TARGET_GPWORD)
-    operands[0] = expand_binop (ptr_mode, add_optab, operands[0],
+    operands[0] = expand_binop (Pmode, add_optab,
+                               convert_to_mode (Pmode, operands[0], false),
+                               gen_rtx_LABEL_REF (Pmode, operands[1]),
+                               0, 0, OPTAB_WIDEN);
+  else if (TARGET_GPWORD)
+    operands[0] = expand_binop (Pmode, add_optab, operands[0],
                                pic_offset_table_rtx, 0, 0, OPTAB_WIDEN);
 
   if (Pmode == SImode)
-    emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1]));
+    emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
   else
-    emit_jump_insn (gen_tablejump_internal2 (operands[0], operands[1]));
+    emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
   DONE;
 })
 
-(define_insn "tablejump_internal1"
+(define_insn "tablejump<mode>"
   [(set (pc)
-       (match_operand:SI 0 "register_operand" "d"))
+       (match_operand:P 0 "register_operand" "d"))
    (use (label_ref (match_operand 1 "" "")))]
   ""
   "%*j\t%0%/"
-  [(set_attr "type"    "jump")
-   (set_attr "mode"    "none")])
-
-(define_insn "tablejump_internal2"
-  [(set (pc)
-       (match_operand:DI 0 "register_operand" "d"))
-   (use (label_ref (match_operand 1 "" "")))]
-  "TARGET_64BIT"
-  "%*j\t%0%/"
-  [(set_attr "type"    "jump")
-   (set_attr "mode"    "none")])
-
-(define_expand "tablejump_mips161"
-  [(set (pc) (plus:SI (sign_extend:SI (match_operand:HI 0 "register_operand"))
-                     (label_ref:SI (match_operand 1 ""))))]
-  "TARGET_MIPS16 && !(Pmode == DImode)"
-{
-  rtx t1, t2, t3;
-
-  t1 = gen_reg_rtx (SImode);
-  t2 = gen_reg_rtx (SImode);
-  t3 = gen_reg_rtx (SImode);
-  emit_insn (gen_extendhisi2 (t1, operands[0]));
-  emit_move_insn (t2, gen_rtx_LABEL_REF (SImode, operands[1]));
-  emit_insn (gen_addsi3 (t3, t1, t2));
-  emit_jump_insn (gen_tablejump_internal1 (t3, operands[1]));
-  DONE;
-})
-
-(define_expand "tablejump_mips162"
-  [(set (pc) (plus:DI (sign_extend:DI (match_operand:HI 0 "register_operand"))
-                     (label_ref:DI (match_operand 1 ""))))]
-  "TARGET_MIPS16 && Pmode == DImode"
-{
-  rtx t1, t2, t3;
-
-  t1 = gen_reg_rtx (DImode);
-  t2 = gen_reg_rtx (DImode);
-  t3 = gen_reg_rtx (DImode);
-  emit_insn (gen_extendhidi2 (t1, operands[0]));
-  emit_move_insn (t2, gen_rtx_LABEL_REF (DImode, operands[1]));
-  emit_insn (gen_adddi3 (t3, t1, t2));
-  emit_jump_insn (gen_tablejump_internal2 (t3, operands[1]));
-  DONE;
-})
+  [(set_attr "type" "jump")
+   (set_attr "mode" "none")])
 
 ;; For TARGET_ABICALLS, we save the gp in the jmp_buf as well.
 ;; While it is possible to either pull it off the stack (in the