* [PATCH] RISC-V: Expand fixed-vlmax/vls vector permutation in targethook
@ 2023-09-10 2:33 Juzhe-Zhong
2023-09-10 13:37 ` Jeff Law
0 siblings, 1 reply; 3+ messages in thread
From: Juzhe-Zhong @ 2023-09-10 2:33 UTC (permalink / raw)
To: gcc-patches; +Cc: kito.cheng, kito.cheng, jeffreyalaw, rdapp.gcc, Juzhe-Zhong
When debugging FAIL: gcc.dg/pr92301.c execution test.
Realize a vls vector permutation situation failed to vectorize since early return false:
- /* For constant size indices, we dont't need to handle it here.
- Just leave it to vec_perm<mode>. */
- if (d->perm.length ().is_constant ())
- return false;
To avoid more potential failed vectorization case. Now expand it in targethook.
gcc/ChangeLog:
* config/riscv/riscv-v.cc (shuffle_generic_patterns): Expand fixed-vlmax/vls vector permutation.
---
gcc/config/riscv/riscv-v.cc | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc
index dc8c10f6ed2..bee60de1d26 100644
--- a/gcc/config/riscv/riscv-v.cc
+++ b/gcc/config/riscv/riscv-v.cc
@@ -2792,14 +2792,9 @@ shuffle_generic_patterns (struct expand_vec_perm_d *d)
if (!pow2p_hwi (d->perm.encoding().npatterns ()))
return false;
- /* For constant size indices, we dont't need to handle it here.
- Just leave it to vec_perm<mode>. */
- if (d->perm.length ().is_constant ())
- return false;
-
/* Permuting two SEW8 variable-length vectors need vrgatherei16.vv.
Otherwise, it could overflow the index range. */
- if (GET_MODE_INNER (d->vmode) == QImode
+ if (!nunits.is_constant () && GET_MODE_INNER (d->vmode) == QImode
&& !get_vector_mode (HImode, nunits).exists (&sel_mode))
return false;
@@ -2808,7 +2803,12 @@ shuffle_generic_patterns (struct expand_vec_perm_d *d)
return true;
rtx sel = vec_perm_indices_to_rtx (sel_mode, d->perm);
- expand_vec_perm (d->target, d->op0, d->op1, force_reg (sel_mode, sel));
+ /* 'mov<mode>' generte interleave vector. */
+ if (!nunits.is_constant ())
+ sel = force_reg (sel_mode, sel);
+ /* Some FIXED-VLMAX/VLS vector permutation situations call targethook
+ instead of expand vec_perm<mode>, we handle it directly. */
+ expand_vec_perm (d->target, d->op0, d->op1, sel);
return true;
}
--
2.36.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] RISC-V: Expand fixed-vlmax/vls vector permutation in targethook
2023-09-10 2:33 [PATCH] RISC-V: Expand fixed-vlmax/vls vector permutation in targethook Juzhe-Zhong
@ 2023-09-10 13:37 ` Jeff Law
2023-09-10 23:14 ` Li, Pan2
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2023-09-10 13:37 UTC (permalink / raw)
To: Juzhe-Zhong, gcc-patches; +Cc: kito.cheng, kito.cheng, rdapp.gcc
On 9/9/23 20:33, Juzhe-Zhong wrote:
> When debugging FAIL: gcc.dg/pr92301.c execution test.
> Realize a vls vector permutation situation failed to vectorize since early return false:
>
> - /* For constant size indices, we dont't need to handle it here.
> - Just leave it to vec_perm<mode>. */
> - if (d->perm.length ().is_constant ())
> - return false;
>
> To avoid more potential failed vectorization case. Now expand it in targethook.
>
> gcc/ChangeLog:
>
> * config/riscv/riscv-v.cc (shuffle_generic_patterns): Expand fixed-vlmax/vls vector permutation.
OK.
jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] RISC-V: Expand fixed-vlmax/vls vector permutation in targethook
2023-09-10 13:37 ` Jeff Law
@ 2023-09-10 23:14 ` Li, Pan2
0 siblings, 0 replies; 3+ messages in thread
From: Li, Pan2 @ 2023-09-10 23:14 UTC (permalink / raw)
To: Jeff Law, Juzhe-Zhong, gcc-patches; +Cc: kito.cheng, kito.cheng
Committed, thanks Jeff.
Pan
-----Original Message-----
From: Gcc-patches <gcc-patches-bounces+pan2.li=intel.com@gcc.gnu.org> On Behalf Of Jeff Law via Gcc-patches
Sent: Sunday, September 10, 2023 9:38 PM
To: Juzhe-Zhong <juzhe.zhong@rivai.ai>; gcc-patches@gcc.gnu.org
Cc: kito.cheng@sifive.com; kito.cheng@gmail.com
Subject: Re: [PATCH] RISC-V: Expand fixed-vlmax/vls vector permutation in targethook
On 9/9/23 20:33, Juzhe-Zhong wrote:
> When debugging FAIL: gcc.dg/pr92301.c execution test.
> Realize a vls vector permutation situation failed to vectorize since early return false:
>
> - /* For constant size indices, we dont't need to handle it here.
> - Just leave it to vec_perm<mode>. */
> - if (d->perm.length ().is_constant ())
> - return false;
>
> To avoid more potential failed vectorization case. Now expand it in targethook.
>
> gcc/ChangeLog:
>
> * config/riscv/riscv-v.cc (shuffle_generic_patterns): Expand fixed-vlmax/vls vector permutation.
OK.
jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-10 23:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-10 2:33 [PATCH] RISC-V: Expand fixed-vlmax/vls vector permutation in targethook Juzhe-Zhong
2023-09-10 13:37 ` Jeff Law
2023-09-10 23:14 ` Li, Pan2
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).