This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATXH, i386]: Add BT setcc patterns
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 20 Sep 2017 15:55:01 +0200
- Subject: Re: [PATXH, i386]: Add BT setcc patterns
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4Y+TvB34DYNL2VO_M=isTCs1rjTeq+QEMcgWMs24t+vvg@mail.gmail.com>
On Tue, Sep 19, 2017 at 11:17 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> Hello!
>
> As mentioned in PR 82259. These are similar to existing BT jcc patterns.
>
> 2017-09-19 Uros Bizjak <ubizjak@gmail.com>
>
> * config/i386/i386.md (*scc_bt<mode>): New insn_and_split pattern.
> (*scc_bt<mode>_1): Ditto.
> (*scc_bt<mode>_mask): Ditto.
>
> testsuite/ChangeLog:
>
> 2017-09-19 Uros Bizjak <ubizjak@gmail.com>
>
> * gcc.target/i386/bt-5.c: New test.
> * gcc.target/i386/bt-6.c: Ditto.
> * gcc.target/i386/bt-mask-3.c: Ditto.
> * gcc.target/i386/bt-mask-4.c: Ditto.
>
> Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.
>
> Committed to mainline SVN.
I have reverted the patch. The combination of shift+and is better than
bt+setcc, since the former avoids partial registers, and allows the
compiler to emit better code when cmove is involved:
sarl %cl, %edi
andl $1, %edi
cmovne %edx, %eax
When patched gcc generates bt insn, following asm is created:
xorl %edx, %edx
btl %esi, %edi
setc %dl
testl %edx, %edx
cmovne %ecx, %eax.
Uros.