public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org, Jan Hubicka <jh@suse.de>
Subject: Re: [PATCH] Fix PR84986
Date: Tue, 20 Mar 2018 10:50:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.20.1803201127490.18265@zhemvz.fhfr.qr> (raw)
In-Reply-To: <20180320101631.GZ8577@tucnak>

On Tue, 20 Mar 2018, Jakub Jelinek wrote:

> On Tue, Mar 20, 2018 at 11:08:12AM +0100, Richard Biener wrote:
> > With the x86 vectorizer cost-model rewrite we ended up costing
> > scalar conversions as nothing.  After my patch using the proper
> > target cost estimates for the scalar version this now exposes
> > underestimating scalar cost and thus no longer vectorizing
> > the testcase in this PR.  This fix is to restrict zero-costing
> > to sign-conversions, all other conversions are possibly
> > value-changing.  I guess some zero-extensions are free as well
> > but I didn't want to get too fancy as I'm not sure about
> > QImode -> SImode conversions for example since whether
> > that's free (can just use %eax instead of %ax) likely depends on 
> > context.
> 
> Aren't casts from integral to integral with smaller precision also always
> zero cost, at least for scalar code?  It just expands to using a SUBREG
> of whatever holds the larger value.

If the precision matches the mode maybe.  But I thought we try to
avoid using %al (HImode) or %ax (QImode) operands in the end?
So it doesn't matter what we expand to but the code-generation
in the end is what matters?

Btw, the patched behavior is now that of GCC 7 apart from the
sign-conversion case costing nothing.

If x86 maintainers want to get fancy they can do that but I'm not
too familiar with the code to tell.  The only case I'm reasonably
sure is zero-extension from SImode to DImode which should be
always free since moves to %eax are zero-extending to 64bits.

Btw, float <-> int conversions will run into the generic costing for
vector_stmt and all other conversions into generic vec_promote_demote 
costing.

An alternative patch would be to just cost sign-extensions
(and maybe non-mode-size ones of any kind).

Richard.

  reply	other threads:[~2018-03-20 10:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-20 10:35 Richard Biener
2018-03-20 11:37 ` Jakub Jelinek
2018-03-20 10:50   ` Richard Biener [this message]
2018-03-20 13:36     ` Jakub Jelinek
2018-03-20 11:09       ` Richard Biener
2018-03-20 13:53     ` Jan Hubicka
2018-03-24 17:42 ` H.J. Lu

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=alpine.LSU.2.20.1803201127490.18265@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jh@suse.de \
    /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).