public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Richard Biener <rguenther@suse.de>, gcc-patches@gcc.gnu.org
Cc: Jan Hubicka <hubicka@ucw.cz>,
	ubizjak@gmail.com, kirill.yukhin@gmail.com, vmakarov@redhat.com,
	hjl.tools@gmail.com, Martin Jambor <mjambor@suse.de>
Subject: Re: [PATCH][RFC][x86] Fix PR91154, add SImode smax, allow SImode add in SSE regs
Date: Wed, 24 Jul 2019 15:12:00 -0000	[thread overview]
Message-ID: <c7da190d-8a09-88e0-948a-b053894f8711@redhat.com> (raw)
In-Reply-To: <alpine.LSU.2.20.1907231548290.30921@zhemvz.fhfr.qr>

On 7/23/19 8:00 AM, Richard Biener wrote:
> 
> The following fixes the runtime regression of 456.hmmer caused
> by matching ICC in code generation and using cmov more aggressively
> (through GIMPLE level MAX_EXPR usage).  Appearantly (discovered
> by manual assembler editing) using the SSE unit for performing
> SImode loads, adds and then two singed max operations plus stores
> is quite a bit faster than cmovs - even faster than the original
> single cmov plus branchy second max.  Even more so for AMD CPUs
> than Intel CPUs.
> 
> Instead of hacking up some pattern recognition pass to transform
> integer mode memory-to-memory computation chains involving
> conditional moves to "vector" code (similar to what STV does
> for TImode ops on x86_64) the following simply allows SImode
> into SSE registers (support for this is already there in some
> important places like move patterns!).  For the particular
> case of 456.hmmer the required support is loads/stores
> (already implemented), SImode adds and SImode smax.
> 
> So the patch adds a smax pattern for SImode (we don't have any
> for scalar modes but currently expand via a conditional move sequence)
> emitting as SSE vector max or cmp/cmov depending on the alternative.
> 
> And it amends the *add<mode>_1 pattern with SSE alternatives
> (which have to come before the memory alternative as IRA otherwise
> doesn't consider reloading a memory operand to a register).
> 
> With this in place the runtime of 456.hmmer improves by 10%
> on Haswell which is back to before regression speed but not
> to same levels as seen with manually editing just the single
> important loop.
> 
> I'm currently benchmarking all SPEC CPU 2006 on Haswell.  More
> interesting is probably Zen where moves crossing the
> integer - vector domain are excessively expensive (they get
> done via the stack).
> 
> Clearly this approach will run into register allocation issues
> but it looks cleaner than writing yet another STV-like pass
> (STV itself is quite awkwardly structured so I refrain from
> touching it...).
> 
> Anyway - comments?  It seems to me that MMX-in-SSE does
> something very similar.
> 
> Bootstrapped on x86_64-unknown-linux-gnu, previous testing
> revealed some issue.  Forgot that *add<mode>_1 also handles
> DImode..., fixed below, re-testing in progress.
Certainly simpler than most of the options and seems effective.

FWIW, I think all the STV code is still disabled and has been for
several releases.  One could make an argument it should get dropped.  If
someone wants to make something like STV work, they can try again and
hopefully learn from the problems with the first implementation.
jeff

  parent reply	other threads:[~2019-07-24 15:03 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-23 14:03 Richard Biener
2019-07-24  9:14 ` Richard Biener
2019-07-24 11:30   ` Richard Biener
2019-07-24 15:12 ` Jeff Law [this message]
2019-07-27 10:07   ` Uros Bizjak
2019-08-09 22:15     ` Jeff Law
2019-07-25  9:15 ` Martin Jambor
2019-07-25 12:57   ` Richard Biener
2019-07-27 11:14     ` Uros Bizjak
2019-07-27 18:23       ` Uros Bizjak
2019-07-31 12:01         ` Richard Biener
2019-08-01  8:54           ` Uros Bizjak
2019-08-01  9:28             ` Richard Biener
2019-08-01  9:38               ` Uros Bizjak
2019-08-03 17:26                 ` Richard Biener
2019-08-04 17:11                   ` Uros Bizjak
2019-08-04 17:23                     ` Jakub Jelinek
2019-08-04 17:36                       ` Uros Bizjak
2019-08-05  8:47                         ` Richard Biener
2019-08-05  9:13                     ` Richard Sandiford
2019-08-05 10:08                       ` Uros Bizjak
2019-08-05 10:12                         ` Richard Sandiford
2019-08-05 10:24                           ` Uros Bizjak
2019-08-05 10:39                             ` Richard Sandiford
2019-08-05 11:50                     ` Richard Biener
2019-08-05 11:59                       ` Uros Bizjak
2019-08-05 12:16                         ` Richard Biener
2019-08-05 12:23                           ` Uros Bizjak
2019-08-05 12:33                       ` Uros Bizjak
2019-08-08 16:23                         ` Jeff Law
2019-08-05 12:44                       ` Uros Bizjak
2019-08-05 12:51                         ` Uros Bizjak
2019-08-05 12:54                           ` Jakub Jelinek
2019-08-05 12:57                             ` Uros Bizjak
2019-08-05 13:04                               ` Richard Biener
2019-08-05 13:09                                 ` Uros Bizjak
2019-08-05 13:29                                   ` Richard Biener
2019-08-05 19:35                                     ` Uros Bizjak
2019-08-07  9:52                                       ` Richard Biener
2019-08-07 12:04                                         ` Richard Biener
2019-08-07 12:11                                           ` Uros Bizjak
2019-08-07 12:42                                           ` Uros Bizjak
2019-08-07 12:58                                             ` Uros Bizjak
2019-08-07 13:00                                               ` Richard Biener
2019-08-07 13:32                                                 ` Uros Bizjak
2019-08-07 14:15                                         ` Richard Biener
2019-08-09  7:28                                   ` Uros Bizjak
2019-08-09 10:13                                     ` Richard Biener
2019-08-09 10:26                                       ` Jakub Jelinek
2019-08-09 11:15                                         ` Richard Biener
2019-08-09 11:06                                       ` Richard Biener
2019-08-09 13:13                                         ` Richard Biener
2019-08-09 14:39                                           ` Uros Bizjak
2019-08-12 12:57                                             ` Richard Biener
2019-08-12 14:48                                               ` Uros Bizjak
2019-08-13 16:28                                               ` Jeff Law
2019-08-13 20:07                                                 ` H.J. Lu
2019-08-15  9:24                                                   ` Uros Bizjak
2019-08-13 15:20                                           ` Jeff Law
2019-08-14  9:15                                             ` Richard Biener
2019-08-14  9:36                                               ` Uros Bizjak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c7da190d-8a09-88e0-948a-b053894f8711@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=hubicka@ucw.cz \
    --cc=kirill.yukhin@gmail.com \
    --cc=mjambor@suse.de \
    --cc=rguenther@suse.de \
    --cc=ubizjak@gmail.com \
    --cc=vmakarov@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).