Commit 19010925 by Uros Bizjak Committed by Uros Bizjak

i386.md (ctz<mode>2): Emit rep;bsf even for !TARGET_BMI.

	* config/i386/i386.md (ctz<mode>2): Emit rep;bsf even for !TARGET_BMI.
	Emit bsf when optimizing for size.
	(*ffs<mode>_1): Ditto.


Co-Authored-By: Paolo Bonzini <bonzini@gnu.org>

From-SVN: r187219
parent 0345d1dd
2012-05-07 Uros Bizjak <ubizjak@gmail.com>
Paolo Bonzini <bonzini@gnu.org>
* config/i386/i386.md (ctz<mode>2): Emit rep;bsf even for !TARGET_BMI.
Emit bsf when optimizing for size.
(*ffs<mode>_1): Ditto.
2012-05-07 Oleg Endo <olegendo@gcc.gnu.org> 2012-05-07 Oleg Endo <olegendo@gcc.gnu.org>
PR target/53250 PR target/53250
......
...@@ -12112,9 +12112,22 @@ ...@@ -12112,9 +12112,22 @@
(set (match_operand:SWI48 0 "register_operand" "=r") (set (match_operand:SWI48 0 "register_operand" "=r")
(ctz:SWI48 (match_dup 1)))] (ctz:SWI48 (match_dup 1)))]
"" ""
"bsf{<imodesuffix>}\t{%1, %0|%0, %1}" {
if (optimize_function_for_size_p (cfun))
return "bsf{<imodesuffix>}\t{%1, %0|%0, %1}";
else if (TARGET_BMI)
return "tzcnt{<imodesuffix>}\t{%1, %0|%0, %1}";
else
/* tzcnt expands to rep;bsf and we can use it even if !TARGET_BMI. */
return "rep; bsf{<imodesuffix>}\t{%1, %0|%0, %1}";
}
[(set_attr "type" "alu1") [(set_attr "type" "alu1")
(set_attr "prefix_0f" "1") (set_attr "prefix_0f" "1")
(set (attr "prefix_rep")
(if_then_else
(match_test "optimize_function_for_size_p (cfun)")
(const_string "0")
(const_string "1")))
(set_attr "mode" "<MODE>")]) (set_attr "mode" "<MODE>")])
(define_insn "ctz<mode>2" (define_insn "ctz<mode>2"
...@@ -12123,14 +12136,21 @@ ...@@ -12123,14 +12136,21 @@
(clobber (reg:CC FLAGS_REG))] (clobber (reg:CC FLAGS_REG))]
"" ""
{ {
if (TARGET_BMI) if (optimize_function_for_size_p (cfun))
return "tzcnt{<imodesuffix>}\t{%1, %0|%0, %1}";
else
return "bsf{<imodesuffix>}\t{%1, %0|%0, %1}"; return "bsf{<imodesuffix>}\t{%1, %0|%0, %1}";
else if (TARGET_BMI)
return "tzcnt{<imodesuffix>}\t{%1, %0|%0, %1}";
else
/* tzcnt expands to rep;bsf and we can use it even if !TARGET_BMI. */
return "rep; bsf{<imodesuffix>}\t{%1, %0|%0, %1}";
} }
[(set_attr "type" "alu1") [(set_attr "type" "alu1")
(set_attr "prefix_0f" "1") (set_attr "prefix_0f" "1")
(set (attr "prefix_rep") (symbol_ref "TARGET_BMI")) (set (attr "prefix_rep")
(if_then_else
(match_test "optimize_function_for_size_p (cfun)")
(const_string "0")
(const_string "1")))
(set_attr "mode" "<MODE>")]) (set_attr "mode" "<MODE>")])
(define_expand "clz<mode>2" (define_expand "clz<mode>2"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment