From 3b5e8a16ba3595b38727c8e6242db740b66dae63 Mon Sep 17 00:00:00 2001 From: Michael Hayes Date: Fri, 15 Oct 1999 23:37:53 +0000 Subject: [PATCH] c4x.c (c4x_rptb_insert): Emit rpts_top pattern if appropriate. * config/c4x/c4x.c (c4x_rptb_insert): Emit rpts_top pattern if appropriate. * config/c4x/c4x.md (rpts_top): New pattern and splitter. From-SVN: r30027 --- gcc/ChangeLog | 6 ++++++ gcc/config/c4x/c4x.c | 5 ++++- gcc/config/c4x/c4x.md | 38 +++++++++++++++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1783d3bd759..d80b7fc716b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +Sat Oct 16 12:34:44 1999 Michael Hayes + + * config/c4x/c4x.c (c4x_rptb_insert): Emit rpts_top pattern + if appropriate. + * config/c4x/c4x.md (rpts_top): New pattern and splitter. + Sat Oct 16 12:26:30 1999 Michael Hayes * config/c4x/c4x.c (src_operand): Check SYMBOL_REF and LABEL_REF diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index 34b57f0638c..b927413e4b4 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -2176,7 +2176,10 @@ c4x_rptb_insert (insn) fatal_insn ("c4x_rptb_insert: Cannot find start label", start_label); /* We'll have to update the basic blocks. */ - emit_insn_before (gen_rptb_top (start_label, end_label), insn); + if (TARGET_RPTS && c4x_rptb_rpts_p (PREV_INSN (insn), 0)) + emit_insn_before (gen_rpts_top (start_label, end_label), insn); + else + emit_insn_before (gen_rptb_top (start_label, end_label), insn); } diff --git a/gcc/config/c4x/c4x.md b/gcc/config/c4x/c4x.md index d8979b65466..e1a39fa2ca5 100644 --- a/gcc/config/c4x/c4x.md +++ b/gcc/config/c4x/c4x.md @@ -4908,10 +4908,20 @@ " [(set_attr "type" "repeat_top")]) +(define_insn "rpts_top" + [(unspec [(use (label_ref (match_operand 0 "" ""))) + (use (label_ref (match_operand 1 "" "")))] 2)] + "" + "* + return ! final_sequence && c4x_rptb_rpts_p (insn, operands[0]) + ? \"rpts\\trc\" : \"rptb%#\\t%l1-1\"; + " + [(set_attr "type" "repeat")]) + ; This pattern needs to be emitted at the start of the loop to ; say that RS and RE are loaded. (define_insn "rptb_init" - [(unspec[(match_operand:QI 0 "register_operand" "va")] 22) + [(unspec [(match_operand:QI 0 "register_operand" "va")] 22) (clobber (reg:QI 25)) (clobber (reg:QI 26))] "" @@ -4965,6 +4975,32 @@ " [(set_attr "type" "repeat,db,jmpc,jmpc,jmpc")]) +(define_split + [(set (pc) + (if_then_else (ge (match_operand:QI 0 "addr_reg_operand" "") + (const_int 0)) + (label_ref (match_operand 1 "" "")) + (pc))) + (set (match_dup 0) + (plus:QI (match_dup 0) + (const_int -1))) + (use (match_operand:QI 2 "const_int_operand" "")) + (use (match_operand:QI 3 "const_int_operand" "")) + (use (match_operand:QI 4 "const_int_operand" "")) + (use (reg:QI 25)) + (use (reg:QI 26)) + (clobber (reg:CC_NOOV 21))] + "reload_completed" + [(parallel [(set (pc) + (if_then_else (ge (match_dup 0) + (const_int 0)) + (label_ref (match_dup 1)) + (pc))) + (set (match_dup 0) + (plus:QI (match_dup 0) + (const_int -1)))])] + "") + ; operand 0 is the loop count pseudo register ; operand 1 is the number of loop iterations or 0 if it is unknown ; operand 2 is the maximum number of loop iterations -- 2.30.2