2020-05-05 Dimitar Dimitrov <dimitar@dinux.eu>
+ * 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 <dimitar@dinux.eu>
+
* config/pru/pru.c (pru_print_operand): Fix fall through comment.
2020-05-05 Uroš Bizjak <ubizjak@gmail.com>
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));
}
/* 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 ();
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.
;; 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<mode>"
+(define_insn "@doloop_begin_internal<mode>"
[(set (match_operand:HISI 0 "register_operand" "=r")
(unspec_volatile:HISI
[(match_operand:HISI 1 "reg_or_ubyte_operand" "rI")
; 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<mode>"
+(define_insn "@doloop_end_internal<mode>"
[(set (pc)
(if_then_else (ne (match_operand:HISI 0 "nonimmediate_operand" "+r,*m")
(const_int 1))
DONE;
})
-(define_insn "pruloop<mode>"
+(define_insn "@pruloop<mode>"
[(set (reg:HISI LOOPCNTR_REGNUM)
(unspec:HISI [(match_operand:HISI 0 "reg_or_ubyte_operand" "rI")
(label_ref (match_operand 1))]