aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitar Dimitrov <dimitar@dinux.eu>2019-06-17 22:39:01 +0300
committerDimitar Dimitrov <dimitar@dinux.eu>2020-05-05 20:42:56 +0300
commitf886644bd4bad83fe0f6aa8682fb1c33247a1244 (patch)
tree64562b1da4d9c652c33404c8e9e1625ac2920e93
parent3d1ca857784315920338fee4659707a34c283bcb (diff)
downloadgcc-f886644bd4bad83fe0f6aa8682fb1c33247a1244.zip
gcc-f886644bd4bad83fe0f6aa8682fb1c33247a1244.tar.gz
gcc-f886644bd4bad83fe0f6aa8682fb1c33247a1244.tar.bz2
PRU: Simplify machine description
Use the new @insn syntax for simpler gen_* invocation. gcc/ChangeLog: 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. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/pru/pru.c44
-rw-r--r--gcc/config/pru/pru.md6
3 files changed, 23 insertions, 34 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 83b390d..6701bf1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
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>
diff --git a/gcc/config/pru/pru.c b/gcc/config/pru/pru.c
index e20b41c..45b18ed 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 67624e2..2f1bc21 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<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")
@@ -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<mode>"
+(define_insn "@doloop_end_internal<mode>"
[(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<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))]