public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Xionghu Luo <luoxhu@linux.ibm.com>
Cc: gcc-patches@gcc.gnu.org, dje.gcc@gmail.com,
	wschmidt@linux.ibm.com, guojiufu@linux.ibm.com,
	linkw@gcc.gnu.org
Subject: Re: [PATCH 2/4] rs6000: Support variable insert and Expand vec_insert in expander [PR79251]
Date: Tue, 24 Nov 2020 16:37:46 -0600	[thread overview]
Message-ID: <20201124223746.GY2672@gate.crashing.org> (raw)
In-Reply-To: <20201010080825.3599892-3-luoxhu@linux.ibm.com>

Hi!

On Sat, Oct 10, 2020 at 03:08:23AM -0500, Xionghu Luo wrote:
> vec_insert accepts 3 arguments, arg0 is input vector, arg1 is the value
> to be insert, arg2 is the place to insert arg1 to arg0.  Current expander
> generates stxv+stwx+lxv if arg2 is variable instead of constant, which
> causes serious store hit load performance issue on Power.  This patch tries
>  1) Build VIEW_CONVERT_EXPR for vec_insert (i, v, n) like v[n&3] = i to
> unify the gimple code, then expander could use vec_set_optab to expand.
>  2) Expand the IFN VEC_SET to fast instructions: lvsr+insert+lvsl.
> In this way, "vec_insert (i, v, n)" and "v[n&3] = i" won't be expanded too
> early in gimple stage if arg2 is variable, avoid generating store hit load
> instructions.
> 
> For Power9 V4SI:
> 	addi 9,1,-16
> 	rldic 6,6,2,60
> 	stxv 34,-16(1)
> 	stwx 5,9,6
> 	lxv 34,-16(1)
> =>
> 	rlwinm 6,6,2,28,29
> 	mtvsrwz 0,5
> 	lvsr 1,0,6
> 	lvsl 0,0,6
> 	xxperm 34,34,33
> 	xxinsertw 34,0,12
> 	xxperm 34,34,32

It still takes me quite some time to verify this, tricky bit-fiddling!

But the code that generates this is easier to read :-)

> +/* Insert VAL into IDX of TARGET, VAL size is same of the vector element, IDX
> +   is variable and also counts by vector element size.  */

"Set vector element IDX of TARGET to VAL.  IDX is not a constant
integer."?


Okay for trunk (with an improved comment).  Thanks!


Segher

  reply	other threads:[~2020-11-24 22:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-10  8:08 [PATCH 0/4] rs6000: Enable variable vec_insert with IFN VEC_SET Xionghu Luo
2020-10-10  8:08 ` [PATCH 1/4] rs6000: Change rs6000_expand_vector_set param Xionghu Luo
2020-11-24 19:44   ` Segher Boessenkool
2020-10-10  8:08 ` [PATCH 2/4] rs6000: Support variable insert and Expand vec_insert in expander [PR79251] Xionghu Luo
2020-11-24 22:37   ` Segher Boessenkool [this message]
2020-10-10  8:08 ` [PATCH 3/4] rs6000: Enable vec_insert for P8 with rs6000_expand_vector_set_var_p8 Xionghu Luo
2020-11-27  1:04   ` Xionghu Luo
2020-12-03 14:16     ` Xionghu Luo
2020-12-10  3:32       ` Xionghu Luo
2020-12-23  2:18       ` Ping ^ 3: " Xionghu Luo
2021-01-15  2:48         ` Ping ^ 4: " Xionghu Luo
2021-01-21 23:48   ` Segher Boessenkool
2021-01-22 20:08     ` David Edelsohn
2020-10-10  8:08 ` [PATCH 4/4] rs6000: Update testcases' instruction count Xionghu Luo
2021-01-22  0:17   ` Segher Boessenkool
2021-01-22 20:02     ` David Edelsohn
2021-01-23  1:01       ` Segher Boessenkool
2021-01-23  1:24         ` David Edelsohn
2020-11-05  1:34 ` Ping: [PATCH 0/4] rs6000: Enable variable vec_insert with IFN VEC_SET Xionghu Luo
2020-11-13  2:05   ` Ping^2: " Xionghu Luo
2020-11-24  2:29     ` Ping^3: " Xionghu Luo

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=20201124223746.GY2672@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=guojiufu@linux.ibm.com \
    --cc=linkw@gcc.gnu.org \
    --cc=luoxhu@linux.ibm.com \
    --cc=wschmidt@linux.ibm.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).