c4x.c (c4x_rptb_insert): Emit rpts_top pattern if appropriate.
authorMichael Hayes <m.hayes@elec.canterbury.ac.nz>
Fri, 15 Oct 1999 23:37:53 +0000 (23:37 +0000)
committerMichael Hayes <m.hayes@gcc.gnu.org>
Fri, 15 Oct 1999 23:37:53 +0000 (23:37 +0000)
* 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
gcc/config/c4x/c4x.c
gcc/config/c4x/c4x.md

index 1783d3bd75977e3804c4d598b3655eff4b24de02..d80b7fc716b38fbf457dba44755f29a770017ef9 100644 (file)
@@ -1,3 +1,9 @@
+Sat Oct 16 12:34:44 1999  Michael Hayes  <m.hayes@elec.canterbury.ac.nz>
+
+       * 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  <m.hayes@elec.canterbury.ac.nz>
 
        * config/c4x/c4x.c (src_operand):  Check SYMBOL_REF and LABEL_REF
index 34b57f0638c6233d3a39a48abe081fff2d9002e8..b927413e4b46f8781848b86262b6ea2a18bd0f92 100644 (file)
@@ -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);
 }
 
 
index d8979b654668b85135e7ee4cba86ce8ca25e914f..e1a39fa2ca5fed1c2a710bd32a01e589d8b4d677 100644 (file)
   "
   [(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))]
   ""
   "
   [(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