From: Jakub Jelinek Date: Thu, 24 Jun 2004 17:54:13 +0000 (+0200) Subject: i386.md (ffsdi2, clzdi2): New expanders. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d413e3cc11c3b1d746ed9d187b4a7e695355219a;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 93efeea9890..7799244f09c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-06-24 Jakub Jelinek + + * config/i386/i386.md (ffsdi2, clzdi2): New expanders. + (ffs_rex64): New splitter. + (ffsdi_1, ctzdi2, bsr_rex64): New instructions. + 2004-06-24 Andrew Pinski * config/darwin7.h (MATH_LIBRARY): Remove. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index f7270a8bb46..13d32eb11ad 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. ;;