]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
h8300.c (expand_a_rotate): Don't generate insns by hand.
authorKazu Hirata <kazu@cs.umass.edu>
Wed, 18 Feb 2004 19:42:22 +0000 (19:42 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Wed, 18 Feb 2004 19:42:22 +0000 (19:42 +0000)
* 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
gcc/config/h8300/h8300.c
gcc/config/h8300/h8300.md

index 05145c8d7102894c12d00fde79fa96097418fdcb..2ea80aa80ecfcc27e78e0b44097ed9fd4a4e698b 100644 (file)
@@ -1,3 +1,12 @@
+2004-02-18  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * 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  <rearnsha@arm.com>
 
        PR target/13866
index 8cea2cf433f489cdf39d44ff066cefbfcbd4d78c..3d9633c8c19895c51802a213a8fa264a1fa320fa 100644 (file)
@@ -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)
index 3f231491a491511deb302efde7d89b8f2ea3219b..ad5306f9a5edf68bedf08d87fc9fcd112649b3f4 100644 (file)
   ""
   "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" "")))]
   ""
   "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" "")))]
   "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" "")))]