This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, i386]: Fix PR 53399, "*ffs" pattern generates wrong code with BMI enabled


Hello!

It turned out that "rep; bsf" is not a 100% substitute for "tzcnt"
since the former sets ZF for zero input, while the later sets CF.
Attached patch fixes this oversight in ffs sequence.

2012-05-24  Uros Bizjak  <ubizjak@gmail.com>

	PR target/53399
	* config/i386/i386.md (ffs<mode>2): Generate CCCmode compare
	for TARGET_BMI.
	(ffssi2_no_cmove): Ditto.
	(*ffs<mode>_1): Remove insn pattern.
	(*tzcnt<mode>_1): New insn pattern.
	(*bsf<mode>1): Ditto.

Tested on x86_64-pc-linux-gnu {,-m32}. Tested on BMI target by Kirill.

Committed to mainline SVN.

Uros.

Attachment: p.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]