From 3d71ed48b391bd71776d232e42d2f74f484ba967 Mon Sep 17 00:00:00 2001 From: kazu Date: Sun, 5 Jan 2003 15:47:36 +0000 Subject: [PATCH] * config/h8300/h8300.c (output_a_shift): Do not output a variable shift. * config/h8300/h8300.md (two splitters): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@60915 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 +++++ gcc/config/h8300/h8300.c | 17 +++--------- gcc/config/h8300/h8300.md | 69 +++++++++++++++++++++++++++++++++++++++++++++++ 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 + + * 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 * 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 -- 2.7.4