From: Dimitar Dimitrov Date: Mon, 17 Jun 2019 19:39:01 +0000 (+0300) Subject: PRU: Simplify machine description X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f886644bd4bad83fe0f6aa8682fb1c33247a1244;p=gcc.git PRU: Simplify machine description Use the new @insn syntax for simpler gen_* invocation. gcc/ChangeLog: 2020-05-05 Dimitar Dimitrov * config/pru/pru.c (pru_emit_doloop): Use new gen_doloop_end_internal and gen_doloop_begin_internal. (pru_reorg_loop): Use gen_pruloop with mode. * config/pru/pru.md: Use new @insn syntax. Signed-off-by: Dimitar Dimitrov --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 83b390d3822..6701bf168e0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2020-05-05 Dimitar Dimitrov + + * config/pru/pru.c (pru_emit_doloop): Use new gen_doloop_end_internal + and gen_doloop_begin_internal. + (pru_reorg_loop): Use gen_pruloop with mode. + * config/pru/pru.md: Use new @insn syntax. + 2020-05-05 Dimitar Dimitrov * config/pru/pru.c (pru_print_operand): Fix fall through comment. diff --git a/gcc/config/pru/pru.c b/gcc/config/pru/pru.c index e20b41c6d1f..45b18ed6fe4 100644 --- a/gcc/config/pru/pru.c +++ b/gcc/config/pru/pru.c @@ -2345,26 +2345,14 @@ pru_emit_doloop (rtx *operands, int is_end) tag = GEN_INT (cfun->machine->doloop_tags - 1); machine_mode opmode = GET_MODE (operands[0]); + gcc_assert (opmode == HImode || opmode == SImode); + if (is_end) - { - if (opmode == HImode) - emit_jump_insn (gen_doloop_end_internalhi (operands[0], - operands[1], tag)); - else if (opmode == SImode) - emit_jump_insn (gen_doloop_end_internalsi (operands[0], - operands[1], tag)); - else - gcc_unreachable (); - } + emit_jump_insn (gen_doloop_end_internal (opmode, operands[0], + operands[1], tag)); else - { - if (opmode == HImode) - emit_insn (gen_doloop_begin_internalhi (operands[0], operands[0], tag)); - else if (opmode == SImode) - emit_insn (gen_doloop_begin_internalsi (operands[0], operands[0], tag)); - else - gcc_unreachable (); - } + emit_insn (gen_doloop_begin_internal (opmode, operands[0], + operands[0], tag)); } @@ -2607,6 +2595,7 @@ pru_reorg_loop (rtx_insn *insns) /* Case (1) or (2). */ rtx_code_label *repeat_label; rtx label_ref; + rtx loop_rtx; /* Create a new label for the repeat insn. */ repeat_label = gen_label_rtx (); @@ -2616,23 +2605,16 @@ pru_reorg_loop (rtx_insn *insns) will utilize an internal for the PRU core LOOP register. */ label_ref = gen_rtx_LABEL_REF (VOIDmode, repeat_label); machine_mode loop_mode = GET_MODE (loop->begin->loop_count); - if (loop_mode == HImode) - emit_insn_before (gen_pruloophi (loop->begin->loop_count, label_ref), - loop->begin->insn); - else if (loop_mode == SImode) - { - rtx loop_rtx = gen_pruloopsi (loop->begin->loop_count, label_ref); - emit_insn_before (loop_rtx, loop->begin->insn); - } - else if (loop_mode == VOIDmode) + if (loop_mode == VOIDmode) { gcc_assert (CONST_INT_P (loop->begin->loop_count)); gcc_assert (UBYTE_INT ( INTVAL (loop->begin->loop_count))); - rtx loop_rtx = gen_pruloopsi (loop->begin->loop_count, label_ref); - emit_insn_before (loop_rtx, loop->begin->insn); + loop_mode = SImode; } - else - gcc_unreachable (); + gcc_assert (loop_mode == HImode || loop_mode == SImode); + loop_rtx = gen_pruloop (loop_mode, loop->begin->loop_count, label_ref); + emit_insn_before (loop_rtx, loop->begin->insn); + delete_insn (loop->begin->insn); /* Insert the repeat label before the first doloop_end. diff --git a/gcc/config/pru/pru.md b/gcc/config/pru/pru.md index 67624e2aac0..2f1bc21f025 100644 --- a/gcc/config/pru/pru.md +++ b/gcc/config/pru/pru.md @@ -887,7 +887,7 @@ ;; This insn is volatile because we'd like it to stay in its original ;; position, just before the loop header. If it stays there, we might ;; be able to convert it into a "loop" insn. -(define_insn "doloop_begin_internal" +(define_insn "@doloop_begin_internal" [(set (match_operand:HISI 0 "register_operand" "=r") (unspec_volatile:HISI [(match_operand:HISI 1 "reg_or_ubyte_operand" "rI") @@ -909,7 +909,7 @@ ; Note: "JUMP_INSNs and CALL_INSNs are not allowed to have any output ; reloads;". Hence this insn must be prepared for a counter that is ; not a register. -(define_insn "doloop_end_internal" +(define_insn "@doloop_end_internal" [(set (pc) (if_then_else (ne (match_operand:HISI 0 "nonimmediate_operand" "+r,*m") (const_int 1)) @@ -951,7 +951,7 @@ DONE; }) -(define_insn "pruloop" +(define_insn "@pruloop" [(set (reg:HISI LOOPCNTR_REGNUM) (unspec:HISI [(match_operand:HISI 0 "reg_or_ubyte_operand" "rI") (label_ref (match_operand 1))]