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] |
On Mon, Apr 30, 2012 at 10:09 AM, Uros Bizjak <ubizjak@gmail.com> wrote: > On Fri, Apr 27, 2012 at 3:30 PM, Paolo Bonzini <bonzini@gnu.org> wrote: >> tzcnt is encoded as "rep;bsf" and unlike lzcnt is a drop-in replacement >> if we don't care about the flags (it has the same semantics for non-zero >> values). >> >> Since bsf is usually slower, just emit tzcnt unconditionally. ?However, >> write it as rep;bsf unless -mbmi is in use, to cater for old assemblers. > > Please emit "rep;bsf" when optimize_insn_for_speed_p () is true. > >> Bootstrapped on a non-BMI x86_64-linux host, regtest in progress. >> Ok for mainline? > > OK with the optimize_insn_for_speed_p conditional. I have committed similar patch, where we emit bsf when optimizing for size (saving a whopping one byte) and rep;bsf for !TARGET_BMI. The same functionality can be added to *ffs<mode>_1, since we don't care what ends in the register for input operand == 0 (this is the key difference between tzcnt and bsf). 2012-05-06 Uros Bizjak <ubizjak@gmail.com> Paolo Bonzini <bonzini@gnu.org> * config/i386/i386.md (ctz<mode>2): Emit rep;bsf even for !TARGET_BMI and bsf when optimizing for size. (*ffs<mode>_1): Ditto. Tested on x86_64-pc-linux-gnu {,-m32}, 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] |