i386: Add define_insn_and_split patterns for btrl [PR96938]
authorJakub Jelinek <jakub@redhat.com>
Wed, 13 Jan 2021 09:15:13 +0000 (10:15 +0100)
committerJakub Jelinek <jakub@redhat.com>
Wed, 13 Jan 2021 09:15:13 +0000 (10:15 +0100)
commit5d057bfeff70e5b8d00e521844c476f62d51e22c
tree4a2b273b233f5d809538bba3e983fe9a226ced9c
parent6b70fa678b1a5ecf3ee87e2be87c3dc9dd08cc92
i386: Add define_insn_and_split patterns for btrl [PR96938]

In the following testcase we only optimize f2 and f7 to btrl, although we
should optimize that way all of the functions.  The problem is the type
demotion/narrowing (which is performed solely during the generic folding and
not later), without it we see the AND performed in SImode and match it as
btrl, but with it while the shifts are still performed in SImode, the
AND is already done in QImode or HImode low part of the shift.

2021-01-13  Jakub Jelinek  <jakub@redhat.com>

PR target/96938
* config/i386/i386.md (*btr<mode>_1, *btr<mode>_2): New
define_insn_and_split patterns.
(splitter after *btr<mode>_2): New splitter.

* gcc.target/i386/pr96938.c: New test.
gcc/config/i386/i386.md
gcc/testsuite/gcc.target/i386/pr96938.c [new file with mode: 0644]