From 01ab55749f71283cfd8416d68c7e34f036b2d51d Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Wed, 18 Feb 2004 19:42:22 +0000 Subject: [PATCH] h8300.c (expand_a_rotate): Don't generate insns by hand. * config/h8300/h8300.c (expand_a_rotate): Don't generate insns by hand. (output_a_rotate): Tweak a comment. * config/h8300/h8300.md (*rotlqi3_1): Change to rotlqi3_1. (*rotlhi3_1): Change to rotlhi3_1. (*rotlsi3_1): Change to rotlsi3_1. From-SVN: r78043 --- gcc/ChangeLog | 9 +++++++++ gcc/config/h8300/h8300.c | 38 ++++++++++++++++++++++++++++++-------- gcc/config/h8300/h8300.md | 6 +++--- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 05145c8d710..2ea80aa80ec 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2004-02-18 Kazu Hirata + + * config/h8300/h8300.c (expand_a_rotate): Don't generate insns + by hand. + (output_a_rotate): Tweak a comment. + * config/h8300/h8300.md (*rotlqi3_1): Change to rotlqi3_1. + (*rotlhi3_1): Change to rotlhi3_1. + (*rotlsi3_1): Change to rotlsi3_1. + 2004-02-18 Richard Earnshaw PR target/13866 diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 8cea2cf433f..3d9633c8c19 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -3861,7 +3861,6 @@ expand_a_rotate (enum rtx_code code, rtx operands[]) rtx src = operands[1]; rtx rotate_amount = operands[2]; enum machine_mode mode = GET_MODE (dst); - rtx tmp; /* We rotate in place. */ emit_move_insn (dst, src); @@ -3883,12 +3882,23 @@ expand_a_rotate (enum rtx_code code, rtx operands[]) emit_label (start_label); /* Rotate by one bit. */ - tmp = gen_rtx_fmt_ee (code, mode, dst, const1_rtx); - emit_insn (gen_rtx_SET (mode, dst, tmp)); + switch (mode) + { + case QImode: + emit_insn (gen_rotlqi3_1 (dst, dst, const1_rtx)); + break; + case HImode: + emit_insn (gen_rotlhi3_1 (dst, dst, const1_rtx)); + break; + case SImode: + emit_insn (gen_rotlsi3_1 (dst, dst, const1_rtx)); + break; + default: + abort (); + } /* Decrement the counter by 1. */ - tmp = gen_rtx_PLUS (QImode, counter, constm1_rtx); - emit_insn (gen_rtx_SET (VOIDmode, counter, tmp)); + emit_insn (gen_addqi3 (counter, counter, constm1_rtx)); /* If the loop counter is nonzero, we go back to the beginning of the loop. */ @@ -3900,8 +3910,20 @@ expand_a_rotate (enum rtx_code code, rtx operands[]) else { /* Rotate by AMOUNT bits. */ - tmp = gen_rtx_fmt_ee (code, mode, dst, rotate_amount); - emit_insn (gen_rtx_SET (mode, dst, tmp)); + switch (mode) + { + case QImode: + emit_insn (gen_rotlqi3_1 (dst, dst, rotate_amount)); + break; + case HImode: + emit_insn (gen_rotlhi3_1 (dst, dst, rotate_amount)); + break; + case SImode: + emit_insn (gen_rotlsi3_1 (dst, dst, rotate_amount)); + break; + default: + abort (); + } } return 1; @@ -4001,7 +4023,7 @@ output_a_rotate (enum rtx_code code, rtx *operands) (rotate_type == SHIFT_ASHIFT) ? SHIFT_LSHIFTRT : SHIFT_ASHIFT; } - /* Emit rotate insns. */ + /* Output rotate insns. */ for (bits = TARGET_H8300S ? 2 : 1; bits > 0; bits /= 2) { if (bits == 2) diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md index 3f231491a49..ad5306f9a5e 100644 --- a/gcc/config/h8300/h8300.md +++ b/gcc/config/h8300/h8300.md @@ -2602,7 +2602,7 @@ "" "if (expand_a_rotate (ROTATE, operands)) DONE; else FAIL;") -(define_insn "*rotlqi3_1" +(define_insn "rotlqi3_1" [(set (match_operand:QI 0 "register_operand" "=r") (rotate:QI (match_operand:QI 1 "register_operand" "0") (match_operand:QI 2 "immediate_operand" "")))] @@ -2618,7 +2618,7 @@ "" "if (expand_a_rotate (ROTATE, operands)) DONE; else FAIL;") -(define_insn "*rotlhi3_1" +(define_insn "rotlhi3_1" [(set (match_operand:HI 0 "register_operand" "=r") (rotate:HI (match_operand:HI 1 "register_operand" "0") (match_operand:QI 2 "immediate_operand" "")))] @@ -2634,7 +2634,7 @@ "TARGET_H8300H || TARGET_H8300S" "if (expand_a_rotate (ROTATE, operands)) DONE; else FAIL;") -(define_insn "*rotlsi3_1" +(define_insn "rotlsi3_1" [(set (match_operand:SI 0 "register_operand" "=r") (rotate:SI (match_operand:SI 1 "register_operand" "0") (match_operand:QI 2 "immediate_operand" "")))] -- 2.30.2