public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Avoid unnecessary slideup in compress pattern of vec_perm
@ 2023-09-10  3:55 Juzhe-Zhong
  2023-09-10 13:34 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Juzhe-Zhong @ 2023-09-10  3:55 UTC (permalink / raw)
  To: gcc-patches; +Cc: kito.cheng, kito.cheng, jeffreyalaw, rdapp.gcc, Juzhe-Zhong

If a const vector all elements are same, the slide up is unnecessary.

gcc/ChangeLog:

	* config/riscv/riscv-v.cc (shuffle_compress_patterns): Avoid unnecessary slideup.

---
 gcc/config/riscv/riscv-v.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc
index bee60de1d26..7ef884907b8 100644
--- a/gcc/config/riscv/riscv-v.cc
+++ b/gcc/config/riscv/riscv-v.cc
@@ -2697,7 +2697,7 @@ shuffle_compress_patterns (struct expand_vec_perm_d *d)
   rtx mask = force_reg (mask_mode, builder.build ());
 
   rtx merge = d->op1;
-  if (need_slideup_p)
+  if (need_slideup_p && !const_vec_duplicate_p (d->op1))
     {
       int slideup_cnt = vlen - (d->perm[vlen - 1].to_constant () % vlen) - 1;
       rtx ops[] = {d->target, d->op1, gen_int_mode (slideup_cnt, Pmode)};
-- 
2.36.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-10 14:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-10  3:55 [PATCH] RISC-V: Avoid unnecessary slideup in compress pattern of vec_perm Juzhe-Zhong
2023-09-10 13:34 ` Jeff Law
2023-09-10 14:31   ` 钟居哲

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).