(set_attr "prefix_rep" "1")
(set_attr "mode" "SI")])
+(define_insn_and_split "*ctzsidi2_<s>ext"
+ [(set (match_operand:DI 0 "register_operand" "=r")
+ (any_extend:DI
+ (ctz:SI
+ (match_operand:SI 1 "nonimmediate_operand" "rm"))))
+ (clobber (reg:CC FLAGS_REG))]
+ "TARGET_64BIT"
+{
+ if (TARGET_BMI)
+ return "tzcnt{l}\t{%1, %k0|%k0, %1}";
+ else if (TARGET_CPU_P (GENERIC)
+ && !optimize_function_for_size_p (cfun))
+ /* tzcnt expands to 'rep bsf' and we can use it even if !TARGET_BMI. */
+ return "rep%; bsf{l}\t{%1, %k0|%k0, %1}";
+ return "bsf{l}\t{%1, %k0|%k0, %1}";
+}
+ "(TARGET_BMI || TARGET_CPU_P (GENERIC))
+ && TARGET_AVOID_FALSE_DEP_FOR_BMI && epilogue_completed
+ && optimize_function_for_speed_p (cfun)
+ && !reg_mentioned_p (operands[0], operands[1])"
+ [(parallel
+ [(set (match_dup 0)
+ (any_extend:DI (ctz:SI (match_dup 1))))
+ (unspec [(match_dup 0)] UNSPEC_INSN_FALSE_DEP)
+ (clobber (reg:CC FLAGS_REG))])]
+ "ix86_expand_clear (operands[0]);"
+ [(set_attr "type" "alu1")
+ (set_attr "prefix_0f" "1")
+ (set (attr "prefix_rep")
+ (if_then_else
+ (ior (match_test "TARGET_BMI")
+ (and (not (match_test "optimize_function_for_size_p (cfun)"))
+ (match_test "TARGET_CPU_P (GENERIC)")))
+ (const_string "1")
+ (const_string "0")))
+ (set_attr "mode" "SI")])
+
+(define_insn "*ctzsidi2_<s>ext_falsedep"
+ [(set (match_operand:DI 0 "register_operand" "=r")
+ (any_extend:DI
+ (ctz:SI
+ (match_operand:SI 1 "nonimmediate_operand" "rm"))))
+ (unspec [(match_operand:DI 2 "register_operand" "0")]
+ UNSPEC_INSN_FALSE_DEP)
+ (clobber (reg:CC FLAGS_REG))]
+ "TARGET_64BIT"
+{
+ if (TARGET_BMI)
+ return "tzcnt{l}\t{%1, %k0|%k0, %1}";
+ else if (TARGET_CPU_P (GENERIC))
+ /* tzcnt expands to 'rep bsf' and we can use it even if !TARGET_BMI. */
+ return "rep%; bsf{l}\t{%1, %k0|%k0, %1}";
+ else
+ gcc_unreachable ();
+}
+ [(set_attr "type" "alu1")
+ (set_attr "prefix_0f" "1")
+ (set_attr "prefix_rep" "1")
+ (set_attr "mode" "SI")])
+
(define_insn "bsr_rex64"
[(set (reg:CCZ FLAGS_REG)
(compare:CCZ (match_operand:DI 1 "nonimmediate_operand" "rm")