From: Richard Sandiford Date: Tue, 24 Aug 2004 19:50:22 +0000 (+0000) Subject: mips.md (indirect_jump): Use force_reg. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=92dcb88270268c66c7394e2254ebfa0872fcfe7f;p=gcc.git mips.md (indirect_jump): Use force_reg. * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 45634deb2f5..e2c252fbfe5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2004-08-24 Richard Sandiford + + * 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 * config/mips/mips.md (*seq_[sd]i, *seq_[sd]i_mips16, *sne_[sd]i) diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index fb7b15d915e..739307c758e 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -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" + [(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" [(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