aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2003-01-05 15:47:36 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2003-01-05 15:47:36 +0000
commitcd9b5ca8cf45fc0a3ae18b06dc8290e0ab500b46 (patch)
treebd71dee77cf7c752c67702c2f699e58d6023d46a
parent30e3682e965c25ed8440c3faf326021d6960ba80 (diff)
downloadgcc-cd9b5ca8cf45fc0a3ae18b06dc8290e0ab500b46.zip
gcc-cd9b5ca8cf45fc0a3ae18b06dc8290e0ab500b46.tar.gz
gcc-cd9b5ca8cf45fc0a3ae18b06dc8290e0ab500b46.tar.bz2
h8300.c (output_a_shift): Do not output a variable shift.
* config/h8300/h8300.c (output_a_shift): Do not output a variable shift. * config/h8300/h8300.md (two splitters): New. From-SVN: r60915
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/h8300/h8300.c17
-rw-r--r--gcc/config/h8300/h8300.md69
3 files changed, 78 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cccad46..6739101 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index f8ec682..8bc9bfc 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -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
{
diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md
index 6a9245e..defe9d4 100644
--- a/gcc/config/h8300/h8300.md
+++ b/gcc/config/h8300/h8300.md
@@ -2234,6 +2234,75 @@
[(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 ();")
;; ----------------------------------------------------------------------
;; ROTATIONS