public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] i386: Don't peephole test to and on CPUs that don't like it
@ 2018-09-20 12:47 Pip Cet
  0 siblings, 0 replies; only message in thread
From: Pip Cet @ 2018-09-20 12:47 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1192 bytes --]

Some AMD CPUs fuse "test" followed by a conditional branch into a
single uop, but don't fuse "and" followed by a conditional branch.
This patch makes the test-to-and peephole rules depend on not tuning
for BDVER. This is a slight improvement in many cases, but it becomes
more significant when combined with the rest of the patch at PR87104.

I think this could be improved further by enabling the peephole rule
if the insn following the peephole is not a conditional branch, but I
don't know whether NONJUMP_INSN_P (peep2_next_insn (...)) works or is
the right approach.

Bootstrapped, but "make check" produces errors which appear unrelated
to this patch.

2018-09-18  Pip Cet  <pipcet@gmail.com>

    PR 87104
    * config/i386/i386.h (TARGET_FUSE_TEST_AND_BRANCH): Add.
    * config/i386/i386.md (test to and peephole2s): Don't use for
    TARGET_FUSE_TEST_AND_BRANCH.
    * config/i386/x86-tune.def (TARGET_FUSE_TEST_AND_BRANCH): New.
    Define for AMD family 15h.

---
 gcc/ChangeLog                | 9 +++++++++
 gcc/config/i386/i386.h       | 2 ++
 gcc/config/i386/i386.md      | 9 ++++++---
 gcc/config/i386/x86-tune.def | 5 +++++
 4 files changed, 22 insertions(+), 3 deletions(-)

[-- Attachment #2: amd-and.diff --]
[-- Type: application/x-patch, Size: 3271 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-09-20 12:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-20 12:47 [PATCH] i386: Don't peephole test to and on CPUs that don't like it Pip Cet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).