]> gcc.gnu.org Git - gcc.git/commitdiff
bfin.md (ror_one, [...]): New patterns.
authorBernd Schmidt <bernd.schmidt@analog.com>
Sat, 25 Jun 2005 11:52:32 +0000 (11:52 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Sat, 25 Jun 2005 11:52:32 +0000 (11:52 +0000)
* config/bfin/bfin.md (ror_one, rol_one, ashrdi3, ashldi3, lshrdi3):
New patterns.
(movbi): Add alternative to set CC to zero.
(compare_eq, compare_ne, compare_le, compare_lt, compare_leu,
compare_ltu): Now named patterns.

From-SVN: r101320

gcc/ChangeLog
gcc/config/bfin/bfin.md

index 43d09c2d52cdbe52c86fabd719902c2fa30f1131..634f89a06a311bff90c5a2dccc804666e8694025 100644 (file)
@@ -1,3 +1,11 @@
+2005-06-25  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+       * config/bfin/bfin.md (ror_one, rol_one, ashrdi3, ashldi3, lshrdi3):
+       New patterns.
+       (movbi): Add alternative to set CC to zero.
+       (compare_eq, compare_ne, compare_le, compare_lt, compare_leu,
+       compare_ltu): Now named patterns.
+
 2005-06-25  Kelley Cook  <kcook@gcc.gnu.org>
 
        * all files: Update FSF address in copyright headers.
index 6373c84af584f78c00638edeb491a25223acae37..984f3d0d41c57f136701dc7875367f09b63c1b52 100644 (file)
 })
 
 (define_insn "movbi"
-  [(set (match_operand:BI 0 "nonimmediate_operand" "=x,x,d,mr,C,d")
-        (match_operand:BI 1 "general_operand" "x,xKs3,mr,d,d,C"))]
+  [(set (match_operand:BI 0 "nonimmediate_operand" "=x,x,d,mr,C,d,C")
+        (match_operand:BI 1 "general_operand" "x,xKs3,mr,d,d,C,P0"))]
 
   ""
   "@
    %0 = %1;
    %0 = %1;
    CC = %1;
-   %0 = CC;"
-  [(set_attr "type" "move,mvi,mcld,mcst,compare,compare")
-   (set_attr "length" "2,2,*,*,2,2")])
+   %0 = CC;
+   R0 = R0 | R0; CC = AC0;"
+  [(set_attr "type" "move,mvi,mcld,mcst,compare,compare,alu0")
+   (set_attr "length" "2,2,*,*,2,2,4")])
 
 (define_insn "movpdi"
   [(set (match_operand:PDI 0 "nonimmediate_operand" "=e,<,e")
   "%0 >>>= %2;"
   [(set_attr "type" "shft")])
 
+(define_insn "ror_one"
+  [(set (match_operand:SI 0 "register_operand" "=d")
+       (ior:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "d") (const_int 1))
+               (ashift:SI (zero_extend:SI (reg:BI REG_CC)) (const_int 31))))
+   (set (reg:BI REG_CC)
+       (zero_extract:BI (match_dup 1) (const_int 1) (const_int 0)))]
+  ""
+  "%0 = ROT %1 BY -1;"
+  [(set_attr "type" "shft")
+   (set_attr "length" "4")])
+
+(define_insn "rol_one"
+  [(set (match_operand:SI 0 "register_operand" "+d")
+       (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "d") (const_int 1))
+               (zero_extend:SI (reg:BI REG_CC))))
+   (set (reg:BI REG_CC)
+       (zero_extract:BI (match_dup 1) (const_int 31) (const_int 0)))]
+  ""
+  "%0 = ROT %1 BY 1;"
+  [(set_attr "type" "shft")
+   (set_attr "length" "4")])
+
+(define_expand "lshrdi3"
+  [(set (match_operand:DI 0 "register_operand" "")
+       (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
+                    (match_operand:DI 2 "general_operand" "")))]
+  ""
+{
+  rtx lo_half[2], hi_half[2];
+      
+  if (operands[2] != const1_rtx)
+    FAIL;
+  if (! rtx_equal_p (operands[0], operands[1]))
+    emit_move_insn (operands[0], operands[1]);
+
+  split_di (operands, 2, lo_half, hi_half);
+
+  emit_move_insn (bfin_cc_rtx, const0_rtx);
+  emit_insn (gen_ror_one (hi_half[0], hi_half[0]));
+  emit_insn (gen_ror_one (lo_half[0], lo_half[0]));
+  DONE;
+})
+
+(define_expand "ashrdi3"
+  [(set (match_operand:DI 0 "register_operand" "")
+       (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
+                    (match_operand:DI 2 "general_operand" "")))]
+  ""
+{
+  rtx lo_half[2], hi_half[2];
+      
+  if (operands[2] != const1_rtx)
+    FAIL;
+  if (! rtx_equal_p (operands[0], operands[1]))
+    emit_move_insn (operands[0], operands[1]);
+
+  split_di (operands, 2, lo_half, hi_half);
+
+  emit_insn (gen_compare_lt (gen_rtx_REG (BImode, REG_CC),
+                            hi_half[1], const0_rtx));
+  emit_insn (gen_ror_one (hi_half[0], hi_half[0]));
+  emit_insn (gen_ror_one (lo_half[0], lo_half[0]));
+  DONE;
+})
+
+(define_expand "ashldi3"
+  [(set (match_operand:DI 0 "register_operand" "")
+       (ashift:DI (match_operand:DI 1 "register_operand" "")
+                  (match_operand:DI 2 "general_operand" "")))]
+  ""
+{
+  rtx lo_half[2], hi_half[2];
+      
+  if (operands[2] != const1_rtx)
+    FAIL;
+  if (! rtx_equal_p (operands[0], operands[1]))
+    emit_move_insn (operands[0], operands[1]);
+
+  split_di (operands, 2, lo_half, hi_half);
+
+  emit_move_insn (bfin_cc_rtx, const0_rtx);
+  emit_insn (gen_rol_one (lo_half[0], lo_half[0]));
+  emit_insn (gen_rol_one (hi_half[0], hi_half[0]));
+  DONE;
+})
+
 (define_insn "lshrsi3"
   [(set (match_operand:SI 0 "register_operand" "=d,a")
        (lshiftrt:SI (match_operand:SI 1 "register_operand" " 0,a")
   DONE;
 })
 
-(define_insn ""
+(define_insn "compare_eq"
   [(set (match_operand:BI 0 "cc_operand" "=C,C")
         (eq:BI (match_operand:SI 1 "register_operand" "d,a")
                (match_operand:SI 2 "nonmemory_operand" "dKs3,aKs3")))]
   "cc =%1==%2;"
   [(set_attr "type" "compare")])
 
-(define_insn ""
+(define_insn "compare_ne"
   [(set (match_operand:BI 0 "cc_operand" "=C,C")
         (ne:BI (match_operand:SI 1 "register_operand" "d,a")
                (match_operand:SI 2 "nonmemory_operand" "dKs3,aKs3")))]
   "cc =%1!=%2;"
   [(set_attr "type" "compare")])
 
-(define_insn ""
+(define_insn "compare_lt"
   [(set (match_operand:BI 0 "cc_operand" "=C,C")
         (lt:BI (match_operand:SI 1 "register_operand" "d,a")
                (match_operand:SI 2 "nonmemory_operand" "dKs3,aKs3")))]
   "cc =%1<%2;"
   [(set_attr "type" "compare")])
 
-(define_insn ""
+(define_insn "compare_le"
   [(set (match_operand:BI 0 "cc_operand" "=C,C")
         (le:BI (match_operand:SI 1 "register_operand" "d,a")
                (match_operand:SI 2 "nonmemory_operand" "dKs3,aKs3")))]
   "cc =%1<=%2;"
   [(set_attr "type" "compare")])
 
-(define_insn ""
+(define_insn "compare_leu"
   [(set (match_operand:BI 0 "cc_operand" "=C,C")
         (leu:BI (match_operand:SI 1 "register_operand" "d,a")
                 (match_operand:SI 2 "nonmemory_operand" "dKu3,aKu3")))]
   "cc =%1<=%2 (iu);"
   [(set_attr "type" "compare")])
 
-(define_insn ""
+(define_insn "compare_ltu"
   [(set (match_operand:BI 0 "cc_operand" "=C,C")
         (ltu:BI (match_operand:SI 1 "register_operand" "d,a")
                 (match_operand:SI 2 "nonmemory_operand" "dKu3,aKu3")))]
This page took 0.088642 seconds and 5 git commands to generate.