public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/65078] [5 Regression] 4.9 and 5.0 generate more spill-fill in comparison with 4.8.2
Date: Tue, 17 Mar 2015 12:22:00 -0000	[thread overview]
Message-ID: <bug-65078-4-FVE3qDflqc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65078-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65078

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
During the expansion, we don't try vec_extract because we are trying to extract
low DImode (64bits) out of a V16QImode pseudo, which is not really vector
element extraction, and the middle end doesn't know that on this target it is
beneficial to just subreg the V16QImode pseudo to identically sized vector with
different sized elements (V2DImode in this case).

So, in order to handle this at the expansion level, we probably would need to
add some new optab like vec_extract that would be not just about the source
mode, but also target mode (conversion optab?), or some target hook or macro
that would instruct the middle-end to also try to subreg the vector mode to
identically sized other vector mode before trying vec_extract.

Immediately after the vec_extract check, we already convert the V16QImode to
TImode and force_reg it, so that is the last spot that can do something about
it during expansion.

To fix this up before reload, we have the option of either !reload_completed
splitter or some combiner pattern(s).

Short testcase that shows hopefully optimal or close to that output for f5-f8
and really bad code for f1-f4, both with -O2 -m64 and -O2 -msse2 -m32.

typedef unsigned char V __attribute__((vector_size (16)));
typedef unsigned long long W __attribute__((vector_size (16)));
typedef unsigned int T __attribute__((vector_size (16)));

void
f1 (unsigned long long *x, V y)
{
  *x = ((W)y)[0];
}

unsigned long long
f2 (V y)
{
  return ((W)y)[0];
}

void
f3 (unsigned int *x, V y)
{
  *x = ((T)y)[0];
}

unsigned int
f4 (V y)
{
  return ((T)y)[0];
}

void
f5 (unsigned long long *x, W y)
{
  *x = ((W)y)[0];
}

unsigned long long
f6 (W y)
{
  return ((W)y)[0];
}

void
f7 (unsigned int *x, T y)
{
  *x = ((T)y)[0];
}

unsigned int
f8 (T y)
{
  return ((T)y)[0];
}


  parent reply	other threads:[~2015-03-17 12:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-16 14:17 [Bug rtl-optimization/65078] New: [5.0 " ysrumyan at gmail dot com
2015-02-16 14:19 ` [Bug rtl-optimization/65078] " ysrumyan at gmail dot com
2015-02-16 14:38 ` rguenth at gcc dot gnu.org
2015-02-16 14:40 ` ubizjak at gmail dot com
2015-02-16 14:44 ` rguenth at gcc dot gnu.org
2015-02-16 14:44 ` jakub at gcc dot gnu.org
2015-02-16 14:50 ` jakub at gcc dot gnu.org
2015-02-18 17:15 ` [Bug rtl-optimization/65078] [5 " law at redhat dot com
2015-03-17 10:33 ` jakub at gcc dot gnu.org
2015-03-17 11:05 ` jakub at gcc dot gnu.org
2015-03-17 12:22 ` jakub at gcc dot gnu.org [this message]
2015-03-17 15:13 ` jakub at gcc dot gnu.org
2015-03-18 10:59 ` jakub at gcc dot gnu.org
2015-03-18 11:12 ` jakub at gcc dot gnu.org

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=bug-65078-4-FVE3qDflqc@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).