h8300.c (output_a_shift): Do not output a variable shift.
authorKazu Hirata <kazu@cs.umass.edu>
Sun, 5 Jan 2003 15:47:36 +0000 (15:47 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Sun, 5 Jan 2003 15:47:36 +0000 (15:47 +0000)
* config/h8300/h8300.c (output_a_shift): Do not output a
variable shift.
* config/h8300/h8300.md (two splitters): New.

From-SVN: r60915

gcc/ChangeLog
gcc/config/h8300/h8300.c
gcc/config/h8300/h8300.md

index cccad46..6739101 100644 (file)
@@ -1,3 +1,9 @@
+2003-01-05  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * config/h8300/h8300.c (output_a_shift): Do not output a
+       variable shift.
+       * config/h8300/h8300.md (two splitters): New.
+
 2003-01-05  Richard Sandiford  <rsandifo@redhat.com>
 
        * config/mips/mips.md: Disable the movstrsi define_split.
index f8ec682..8bc9bfc 100644 (file)
@@ -3197,20 +3197,9 @@ output_a_shift (operands)
 
   if (GET_CODE (operands[2]) != CONST_INT)
     {
-      /* Indexing by reg, so have to loop and test at top.  */
-      output_asm_insn ("mov.b  %X2,%X4", operands);
-      fprintf (asm_out_file, "\tble    .Lle%d\n", loopend_lab);
-
-      /* Get the assembler code to do one shift.  */
-      get_shift_alg (shift_type, shift_mode, 1, &info);
-
-      fprintf (asm_out_file, ".Llt%d:\n", loopend_lab);
-      output_asm_insn (info.shift1, operands);
-      output_asm_insn ("add    #0xff,%X4", operands);
-      fprintf (asm_out_file, "\tbne    .Llt%d\n", loopend_lab);
-      fprintf (asm_out_file, ".Lle%d:\n", loopend_lab);
-
-      return "";
+      /* This case must be taken care of by one of the two splitters
+        that convert a variable shift into a loop.  */
+      abort ();
     }
   else
     {
index 6a9245e..defe9d4 100644 (file)
   [(set (attr "length")
        (symbol_ref "compute_a_shift_length (insn, operands)"))
    (set_attr "cc" "clobber")])
+
+;; Split a variable shift into a loop.  If the register containing
+;; the shift count dies, then we just use that register.
+
+(define_split
+  [(parallel
+     [(set (match_operand 0 "register_operand" "")
+          (match_operator 2 "nshift_operator"
+            [(match_dup 0)
+             (match_operand:QI 1 "register_operand" "")]))
+      (clobber (match_operand:QI 3 "register_operand" ""))])]
+  "flow2_completed
+   && find_regno_note (insn, REG_DEAD, REGNO (operands[1]))"
+  [(set (cc0)
+       (match_dup 1))
+   (set (pc)
+        (if_then_else (le (cc0) (const_int 0))
+                     (label_ref (match_dup 5))
+                     (pc)))
+   (match_dup 4)
+   (parallel
+     [(set (match_dup 0)
+          (match_op_dup 2 [(match_dup 0) (const_int 1)]))
+      (clobber (scratch:QI))])
+   (set (match_dup 1)
+       (plus:QI (match_dup 1) (const_int -1)))
+   (set (cc0)
+       (match_dup 1))
+   (set (pc)
+        (if_then_else (ne (cc0) (const_int 0))
+                     (label_ref (match_dup 4))
+                     (pc)))
+   (match_dup 5)]
+  "operands[4] = gen_label_rtx ();
+   operands[5] = gen_label_rtx ();")
+
+(define_split
+  [(parallel
+     [(set (match_operand 0 "register_operand" "")
+          (match_operator 2 "nshift_operator"
+            [(match_dup 0)
+             (match_operand:QI 1 "register_operand" "")]))
+      (clobber (match_operand:QI 3 "register_operand" ""))])]
+  "flow2_completed
+   && !find_regno_note (insn, REG_DEAD, REGNO (operands[1]))"
+  [(set (match_dup 3)
+       (match_dup 1))
+   (set (cc0)
+       (match_dup 3))
+   (set (pc)
+        (if_then_else (le (cc0) (const_int 0))
+                     (label_ref (match_dup 5))
+                     (pc)))
+   (match_dup 4)
+   (parallel
+     [(set (match_dup 0)
+          (match_op_dup 2 [(match_dup 0) (const_int 1)]))
+      (clobber (scratch:QI))])
+   (set (match_dup 3)
+       (plus:QI (match_dup 3) (const_int -1)))
+   (set (cc0)
+       (match_dup 3))
+   (set (pc)
+        (if_then_else (ne (cc0) (const_int 0))
+                     (label_ref (match_dup 4))
+                     (pc)))
+   (match_dup 5)]
+  "operands[4] = gen_label_rtx ();
+   operands[5] = gen_label_rtx ();")
 \f
 ;; ----------------------------------------------------------------------
 ;; ROTATIONS