public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marc Glisse <marc.glisse@inria.fr>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [i386] scalar ops that preserve the high part of a vector
Date: Fri, 30 Nov 2012 12:36:00 -0000	[thread overview]
Message-ID: <alpine.DEB.2.02.1211301317160.3783@laptop-mg.saclay.inria.fr> (raw)
In-Reply-To: <alpine.DEB.2.02.1210141057010.3752@laptop-mg.saclay.inria.fr>

On Sun, 14 Oct 2012, Marc Glisse wrote:

> On Sun, 14 Oct 2012, Uros Bizjak wrote:
>
>> On Sat, Oct 13, 2012 at 10:52 AM, Marc Glisse <marc.glisse@inria.fr> wrote:
>>> Hello,
>>> 
>>> this patch provides an alternate pattern to let combine recognize scalar
>>> operations that preserve the high part of a vector. If the strategy is all
>>> right, I could do the same for more operations (mul, div, ...). Something
>>> similar is also possible for V4SF (different pattern though), but probably
>>> not as useful.
>> 
>> But, we _do_ have vec_merge pattern that describes the operation.
>> Adding another one to each operation just to satisfy combine is IMO
>> not correct approach.
>
> At some point I wondered about _replacing_ the existing pattern, so there 
> would only be one ;-)
>
> The vec_merge pattern takes as argument 2 vectors instead of a vector and a 
> scalar, and describes the operation as a vector operation where we drop half 
> of the result, instead of a scalar operation where we re-add the top half of 
> the vector. I don't know if that's the most convenient choice. Adding code in 
> simplify-rtx to replace vec_merge with vec_concat / vec_select might be 
> easier than the other way around.
>
>
> If the middle-end somehow gave us:
> (plus X (vec_concat Y 0))
> it would seem a bit strange to add an optimization that turns it into:
> (vec_merge (plus X (subreg:V2DF Y)) X 1)
> but then producing:
> (vec_concat (plus (vec_select X 0) Y) (vec_select X 1))
> would be strange as well.
> (ignoring the signed zero issues here)
>
>> I'd rather see generic RTX simplification that
>> simplifies your proposed pattern to vec_merge pattern.
>
> Ok, I'll see what I can do.
>
>> Also, as you mention in PR54855, Comment #5, the approach is too fragile...
>
> I am not sure I can make the RTX simplification much less fragile... Whenever 
> I see (vec_concat X (vec_select Y 1)), I would have to check whether X is 
> some (possibly large) tree of scalar computations involving Y[0], move it all 
> to vec_merge computations, and fix other users of some of those scalars to 
> now use S[0]. Seems too hard, I would stop at single-operation X that is used 
> only once. Besides, the gain is larger in proportion when there is a single 
> operation :-)
>
> Thank you for your comments,

Hello,

I experimented with the simplify-rtx transformation you suggested, see:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54855

It works when the argument is a register, but not for memory (which is 
where the constant is in the testcase). And the description of the 
operation in sse.md does seem problematic. It says the second argument is:

             (match_operand:VF_128 2 "nonimmediate_operand" "xm,xm"))

but Intel's documentation says "The source operand can be an XMM register 
or a 64-bit memory location", not quite the same.

Do you think the .md description should really stay this way, or could we 
change it to something that better reflects "64-bit memory location"?

-- 
Marc Glisse

  reply	other threads:[~2012-11-30 12:34 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-13  9:33 Marc Glisse
2012-10-14  9:54 ` Uros Bizjak
2012-10-14 12:52   ` Marc Glisse
2012-11-30 12:36     ` Marc Glisse [this message]
2012-11-30 13:55       ` Uros Bizjak
2012-11-30 22:36         ` Marc Glisse
2012-12-01 17:27           ` Marc Glisse
2012-12-02 10:51             ` Uros Bizjak
2012-12-02 12:30               ` Marc Glisse
2012-12-03  8:53                 ` Uros Bizjak
2012-12-03 15:34                   ` Marc Glisse
2012-12-03 17:55                     ` Uros Bizjak
2012-12-04 14:05                       ` Marc Glisse
2012-12-04 16:28                         ` Marc Glisse
2012-12-04 18:06                           ` Uros Bizjak
2012-12-04 18:12                             ` H.J. Lu
2012-12-06 13:42                               ` Kirill Yukhin
2012-12-07  6:50                                 ` Michael Zolotukhin
2012-12-07  8:46                                   ` Uros Bizjak
2012-12-07  8:49                                   ` Marc Glisse
2012-12-07 10:52                                     ` Michael Zolotukhin
2012-12-07 14:02                                       ` Marc Glisse
2012-12-07 14:43                                     ` Richard Henderson
2012-12-07 14:47                                       ` Jakub Jelinek
2012-12-07 14:53                                         ` Richard Henderson
2012-12-07 15:00                                       ` Marc Glisse
2012-12-07 15:06                                         ` Richard Henderson
2012-12-07 15:12                                           ` Marc Glisse
2012-12-07 16:24                                             ` Richard Henderson
2012-12-07 17:23                                               ` Marc Glisse
2012-12-08  5:47                                                 ` Marc Glisse
2012-12-12 15:48                                                   ` Richard Henderson
2012-12-05 14:22                             ` Marc Glisse
2012-12-05 17:07                               ` Paolo Bonzini
2012-12-05 20:22                                 ` Marc Glisse
2012-12-05 21:05                               ` Eric Botcazou

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.DEB.2.02.1211301317160.3783@laptop-mg.saclay.inria.fr \
    --to=marc.glisse@inria.fr \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ubizjak@gmail.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).