aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-06-24 19:54:13 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2004-06-24 19:54:13 +0200
commitd413e3cc11c3b1d746ed9d187b4a7e695355219a (patch)
treeddac68326a5340d687fafc34eca1acc9157db4c3 /gcc/config
parentd42093a1dbfe8be8a96829b8783da5efe8c3d7c8 (diff)
downloadgcc-d413e3cc11c3b1d746ed9d187b4a7e695355219a.zip
gcc-d413e3cc11c3b1d746ed9d187b4a7e695355219a.tar.gz
gcc-d413e3cc11c3b1d746ed9d187b4a7e695355219a.tar.bz2
i386.md (ffsdi2, clzdi2): New expanders.
* config/i386/i386.md (ffsdi2, clzdi2): New expanders. (ffs_rex64): New splitter. (ffsdi_1, ctzdi2, bsr_rex64): New instructions. From-SVN: r83604
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/i386/i386.md67
1 files changed, 67 insertions, 0 deletions
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index f7270a8..13d32eb 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -14005,6 +14005,44 @@
"bsf{l}\t{%1, %0|%0, %1}"
[(set_attr "prefix_0f" "1")])
+(define_expand "ffsdi2"
+ [(parallel
+ [(set (match_operand:DI 0 "register_operand" "")
+ (ffs:DI (match_operand:DI 1 "nonimmediate_operand" "")))
+ (clobber (match_scratch:DI 2 ""))
+ (clobber (reg:CC 17))])]
+ "TARGET_64BIT && TARGET_CMOVE"
+ "")
+
+(define_insn_and_split "*ffs_rex64"
+ [(set (match_operand:DI 0 "register_operand" "=r")
+ (ffs:DI (match_operand:DI 1 "nonimmediate_operand" "rm")))
+ (clobber (match_scratch:DI 2 "=&r"))
+ (clobber (reg:CC 17))]
+ "TARGET_64BIT && TARGET_CMOVE"
+ "#"
+ "&& reload_completed"
+ [(set (match_dup 2) (const_int -1))
+ (parallel [(set (reg:CCZ 17) (compare:CCZ (match_dup 1) (const_int 0)))
+ (set (match_dup 0) (ctz:DI (match_dup 1)))])
+ (set (match_dup 0) (if_then_else:DI
+ (eq (reg:CCZ 17) (const_int 0))
+ (match_dup 2)
+ (match_dup 0)))
+ (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 1)))
+ (clobber (reg:CC 17))])]
+ "")
+
+(define_insn "*ffsdi_1"
+ [(set (reg:CCZ 17)
+ (compare:CCZ (match_operand:DI 1 "nonimmediate_operand" "rm")
+ (const_int 0)))
+ (set (match_operand:DI 0 "register_operand" "=r")
+ (ctz:DI (match_dup 1)))]
+ "TARGET_64BIT"
+ "bsf{q}\t{%1, %0|%0, %1}"
+ [(set_attr "prefix_0f" "1")])
+
(define_insn "ctzsi2"
[(set (match_operand:SI 0 "register_operand" "=r")
(ctz:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))
@@ -14013,6 +14051,14 @@
"bsf{l}\t{%1, %0|%0, %1}"
[(set_attr "prefix_0f" "1")])
+(define_insn "ctzdi2"
+ [(set (match_operand:DI 0 "register_operand" "=r")
+ (ctz:DI (match_operand:DI 1 "nonimmediate_operand" "rm")))
+ (clobber (reg:CC 17))]
+ "TARGET_64BIT"
+ "bsf{q}\t{%1, %0|%0, %1}"
+ [(set_attr "prefix_0f" "1")])
+
(define_expand "clzsi2"
[(parallel
[(set (match_operand:SI 0 "register_operand" "")
@@ -14033,6 +14079,27 @@
""
"bsr{l}\t{%1, %0|%0, %1}"
[(set_attr "prefix_0f" "1")])
+
+(define_expand "clzdi2"
+ [(parallel
+ [(set (match_operand:DI 0 "register_operand" "")
+ (minus:DI (const_int 63)
+ (clz:DI (match_operand:DI 1 "nonimmediate_operand" ""))))
+ (clobber (reg:CC 17))])
+ (parallel
+ [(set (match_dup 0) (xor:DI (match_dup 0) (const_int 63)))
+ (clobber (reg:CC 17))])]
+ "TARGET_64BIT"
+ "")
+
+(define_insn "*bsr_rex64"
+ [(set (match_operand:DI 0 "register_operand" "=r")
+ (minus:DI (const_int 63)
+ (clz:DI (match_operand:DI 1 "nonimmediate_operand" "rm"))))
+ (clobber (reg:CC 17))]
+ "TARGET_64BIT"
+ "bsr{q}\t{%1, %0|%0, %1}"
+ [(set_attr "prefix_0f" "1")])
;; Thread-local storage patterns for ELF.
;;