i386: Optimize blsi followed by comparison [PR98567]
authorJakub Jelinek <jakub@redhat.com>
Thu, 7 Jan 2021 16:18:58 +0000 (17:18 +0100)
committerJakub Jelinek <jakub@redhat.com>
Thu, 7 Jan 2021 16:18:58 +0000 (17:18 +0100)
commit6bca2ebf10654b8beb5c5737c8652e8262901294
treea85478c609d106005d7b0910b3d5fd49213a1331
parent0f9d2c1a318ed30a66b75bd6b7fa3dc3630e362e
i386: Optimize blsi followed by comparison [PR98567]

The BLSI instruction sets SF and ZF based on the result and clears OF.
CF is set to something unrelated.

The following patch optimizes BLSI followed by comparison, so we don't need
to emit a TEST insn in between.

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

PR target/98567
* config/i386/i386.md (*bmi_blsi_<mode>_cmp, *bmi_blsi_<mode>_ccno):
New define_insn patterns.

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