(define_insns for ffs[qhs]i2): Deleted.
authorRichard Kenner <kenner@gcc.gnu.org>
Sat, 8 Jun 1996 17:55:15 +0000 (13:55 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Sat, 8 Jun 1996 17:55:15 +0000 (13:55 -0400)
(define_insns for ffs[qhs]i2): Deleted. These patterns only worked
when the input operand was not the same as the output operand.
(define_expand for ffssi2): New pattern. This uses an anonymous
pattern that describes what the ns32k's ffsd instruction (really)
does.

From-SVN: r12244

gcc/config/ns32k/ns32k.md

index 679ca9a6ca5bd0b73841b43b5abb789748292f34..a1a08851f001158a1cad3791c65cdeed077008e1 100644 (file)
 \f
 ;; ffs instructions
 
-(define_insn "ffsqi2"
-  [(set (match_operand:QI 0 "general_operand" "=g")
-       (ffs:QI (match_operand:SI 1 "general_operand" "g")))]
-  ""
-  "*
-{
-  return \"movqb 0,%0; ffsd %1,%0; bfs 1f; addqb 1,%0; 1:\";
-}")
-
-(define_insn "ffshi2"
-  [(set (match_operand:HI 0 "general_operand" "=g")
-       (ffs:HI (match_operand:SI 1 "general_operand" "g")))]
-  ""
-  "*
-{
-  return \"movqw 0,%0; ffsd %1,%0; bfs 1f; addqw 1,%0; 1:\";
-}")
-
-(define_insn "ffssi2"
-  [(set (match_operand:SI 0 "general_operand" "=g")
-       (ffs:SI (match_operand:SI 1 "general_operand" "g")))]
-  ""
-  "*
-{
-  return \"movqd 0,%0; ffsd %1,%0; bfs 1f; addqd 1,%0; 1:\";
-}")
+(define_insn ""
+  [(set (match_operand:SI 0 "general_operand" "ro")
+       (minus:SI 
+               (plus:SI (ffs:SI (zero_extract:SI 
+                               (match_operand:SI 1 "general_operand" "g") 
+                               (minus:SI (const_int 32) (match_dup 0))
+                               (match_dup 0)))
+                       (match_dup 0)) 
+               (const_int 1)))]
+  ""
+  "ffsd %1,%0; bfc 1f; addqd %$-1,%0; 1:")
+
+(define_expand "ffssi2"
+  [(set (match_operand:SI 0 "general_operand" "=g") (const_int 0))
+   (set (match_dup 0)
+       (minus:SI 
+               (plus:SI (ffs:SI (zero_extract:SI 
+                               (match_operand:SI 1 "general_operand" "g") 
+                               (minus:SI (const_int 32) (match_dup 0))
+                               (match_dup 0)))
+                       (match_dup 0)) 
+               (const_int 1)))
+   (set (match_dup 0)
+       (plus:SI (match_dup 0)
+                (const_int 1)))]
+  ""
+  "operands[1] = make_safe_from(operands[1], operands[0]);")
 \f
 ;; Speed up stack adjust followed by a HI fixedpoint push.