Commit 2903ad2d by Uros Bizjak Committed by Uros Bizjak

re PR target/85073 ([x86] extra check after BLSR)

	PR target/85073
	* config/i386/i386.md (*bmi_blsr_<mode>_cmp): New insn pattern.
	(*bmi_blsr_<mode>_ccz): Ditto.

testsuite/ChangeLog:

	PR target/85073
	* gcc.target/i386/pr85073.c: New test.

From-SVN: r258864
parent 125c297c
2018-03-26 Uros Bizjak <ubizjak@gmail.com>
PR target/85073
* config/i386/i386.md (*bmi_blsr_<mode>_cmp): New insn pattern.
(*bmi_blsr_<mode>_ccz): Ditto.
2018-03-26 Tom de Vries <tom@codesourcery.com> 2018-03-26 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/85063 PR tree-optimization/85063
......
...@@ -13774,6 +13774,43 @@ ...@@ -13774,6 +13774,43 @@
(set_attr "btver2_decode" "double") (set_attr "btver2_decode" "double")
(set_attr "mode" "<MODE>")]) (set_attr "mode" "<MODE>")])
(define_insn "*bmi_blsr_<mode>_cmp"
[(set (reg:CCZ FLAGS_REG)
(compare:CCZ
(and:SWI48
(plus:SWI48
(match_operand:SWI48 1 "nonimmediate_operand" "rm")
(const_int -1))
(match_dup 1))
(const_int 0)))
(set (match_operand:SWI48 0 "register_operand" "=r")
(and:SWI48
(plus:SWI48
(match_dup 1)
(const_int -1))
(match_dup 1)))]
"TARGET_BMI"
"blsr\t{%1, %0|%0, %1}"
[(set_attr "type" "bitmanip")
(set_attr "btver2_decode" "double")
(set_attr "mode" "<MODE>")])
(define_insn "*bmi_blsr_<mode>_ccz"
[(set (reg:CCZ FLAGS_REG)
(compare:CCZ
(and:SWI48
(plus:SWI48
(match_operand:SWI48 1 "nonimmediate_operand" "rm")
(const_int -1))
(match_dup 1))
(const_int 0)))
(clobber (match_scratch:SWI48 0 "=r"))]
"TARGET_BMI"
"blsr\t{%1, %0|%0, %1}"
[(set_attr "type" "bitmanip")
(set_attr "btver2_decode" "double")
(set_attr "mode" "<MODE>")])
;; BMI2 instructions. ;; BMI2 instructions.
(define_expand "bmi2_bzhi_<mode>3" (define_expand "bmi2_bzhi_<mode>3"
[(parallel [(parallel
......
2018-03-26 Uros Bizjak <ubizjak@gmail.com>
PR target/85073
* gcc.target/i386/pr85073.c: New test.
2018-03-26 Richard Biener <rguenther@suse.de> 2018-03-26 Richard Biener <rguenther@suse.de>
PR testsuite/85066 PR testsuite/85066
......
/* PR target/85073 */
/* { dg-do compile } */
/* { dg-options "-O2 -mbmi" } */
int
foo (unsigned x)
{
int c = 0;
while (x)
{
c += 1;
x = (x - 1) & x;
}
return c;
}
/* { dg-final { scan-assembler-times "test" 1 } } */
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