public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Add VLS to mask vec_extract [PR114668].
@ 2024-04-15 12:43 Robin Dapp
  2024-04-15 12:45 ` =?gb18030?B?1tO+09Xc?=
  0 siblings, 1 reply; 2+ messages in thread
From: Robin Dapp @ 2024-04-15 12:43 UTC (permalink / raw)
  To: gcc-patches, palmer, Kito Cheng, jeffreyalaw, juzhe.zhong; +Cc: rdapp.gcc

Hi,

this adds the missing VLS modes to the mask extract expanders.
I found a dump scan difficult to create reliably so I just
kept the PR's run test case.

Regtested on rv64gcv. 

Regards
 Robin

gcc/ChangeLog:

	PR target/114668

	* config/riscv/autovec.md: Add VLS.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/pr114668.c: New test.
---
 gcc/config/riscv/autovec.md                   |  4 +--
 .../gcc.target/riscv/rvv/autovec/pr114668.c   | 35 +++++++++++++++++++
 2 files changed, 37 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/pr114668.c

diff --git a/gcc/config/riscv/autovec.md b/gcc/config/riscv/autovec.md
index 3b32369f68c..aa1ae0fe075 100644
--- a/gcc/config/riscv/autovec.md
+++ b/gcc/config/riscv/autovec.md
@@ -1427,7 +1427,7 @@ (define_expand "vec_extract<mode><vel>"
 (define_expand "vec_extract<mode>qi"
   [(set (match_operand:QI	  0 "register_operand")
      (vec_select:QI
-       (match_operand:VB	  1 "register_operand")
+       (match_operand:VB_VLS	  1 "register_operand")
        (parallel
 	 [(match_operand	  2 "nonmemory_operand")])))]
   "TARGET_VECTOR"
@@ -1453,7 +1453,7 @@ (define_expand "vec_extract<mode>qi"
 (define_expand "vec_extract<mode>bi"
   [(set (match_operand:QI	  0 "register_operand")
      (vec_select:QI
-       (match_operand:VB	  1 "register_operand")
+       (match_operand:VB_VLS	  1 "register_operand")
        (parallel
 	 [(match_operand	  2 "nonmemory_operand")])))]
   "TARGET_VECTOR"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr114668.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr114668.c
new file mode 100644
index 00000000000..3a13c3c0012
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr114668.c
@@ -0,0 +1,35 @@
+/* { dg-do run } */
+/* { dg-require-effective-target riscv_v } */
+/* { dg-options { -O3 -fno-vect-cost-model -march=rv64gcv -mabi=lp64d  } } */
+
+char a;
+int b;
+short e[14];
+char f[4][12544];
+_Bool c[4][5];
+
+__attribute__ ((noipa))
+void foo (int a)
+{
+  if (a != 1)
+    __builtin_abort ();
+}
+
+int main ()
+{
+  for (int i = 0; i < 4; ++i)
+    for (int l = 0; l < 15; ++l)
+      for (int m = 0; m < 15; ++m)
+	f[i][l * m] = 3;
+  for (int j = 0; j < 4; j += 1)
+    for (int k = 3; k < 13; k += 3)
+      for (_Bool l = 0; l < 1; l = 1)
+	for (int m = 0; m < 4; m += 1)
+	  {
+	    a = 0;
+	    b -= e[k];
+	    c[j][m] = f[j][6];
+	  }
+  for (long i = 2; i < 4; ++i)
+    foo (c[3][3]);
+}
-- 
2.44.0

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

* Re: [PATCH] RISC-V: Add VLS to mask vec_extract [PR114668].
  2024-04-15 12:43 [PATCH] RISC-V: Add VLS to mask vec_extract [PR114668] Robin Dapp
@ 2024-04-15 12:45 ` =?gb18030?B?1tO+09Xc?=
  0 siblings, 0 replies; 2+ messages in thread
From: =?gb18030?B?1tO+09Xc?= @ 2024-04-15 12:45 UTC (permalink / raw)
  To: =?gb18030?B?Um9iaW4gRGFwcA==?=, =?gb18030?B?Z2NjLXBhdGNoZXM=?=,
	=?gb18030?B?cGFsbWVy?=, =?gb18030?B?S2l0byBDaGVuZw==?=,
	=?gb18030?B?amVmZnJleWFsYXc=?=
  Cc: =?gb18030?B?cmRhcHAuZ2Nj?=

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 3375 bytes --]

lgtm








 ----------Reply to Message----------
 On Mon, Apr 15, 2024 20:43 PM Robin Dapp<rdapp.gcc@gmail.com&gt; wrote:

  Hi,

this adds the missing VLS modes to the mask extract expanders.
I found a dump scan difficult to create reliably so I just
kept the PR's run test case.

Regtested on rv64gcv. 

Regards
&nbsp;Robin

gcc/ChangeLog:

PR target/114668

* config/riscv/autovec.md: Add VLS.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/pr114668.c: New test.
---
&nbsp;gcc/config/riscv/autovec.md&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp; 4 +--
&nbsp;.../gcc.target/riscv/rvv/autovec/pr114668.c&nbsp;&nbsp; | 35 +++++++++++++++++++
&nbsp;2 files changed, 37 insertions(+), 2 deletions(-)
&nbsp;create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/autovec/pr114668.c

diff --git a/gcc/config/riscv/autovec.md b/gcc/config/riscv/autovec.md
index 3b32369f68c..aa1ae0fe075 100644
--- a/gcc/config/riscv/autovec.md
+++ b/gcc/config/riscv/autovec.md
@@ -1427,7 +1427,7 @@ (define_expand "vec_extract<mode&gt;<vel&gt;"
&nbsp;(define_expand "vec_extract<mode&gt;qi"
&nbsp;&nbsp; [(set (match_operand:QI&nbsp; 0 "register_operand")
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vec_select:QI
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (match_operand:VB&nbsp; 1 "register_operand")
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (match_operand:VB_VLS&nbsp; 1 "register_operand")
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (parallel
&nbsp; [(match_operand&nbsp; 2 "nonmemory_operand")])))]
&nbsp;&nbsp; "TARGET_VECTOR"
@@ -1453,7 +1453,7 @@ (define_expand "vec_extract<mode&gt;qi"
&nbsp;(define_expand "vec_extract<mode&gt;bi"
&nbsp;&nbsp; [(set (match_operand:QI&nbsp; 0 "register_operand")
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vec_select:QI
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (match_operand:VB&nbsp; 1 "register_operand")
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (match_operand:VB_VLS&nbsp; 1 "register_operand")
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (parallel
&nbsp; [(match_operand&nbsp; 2 "nonmemory_operand")])))]
&nbsp;&nbsp; "TARGET_VECTOR"
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr114668.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr114668.c
new file mode 100644
index 00000000000..3a13c3c0012
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr114668.c
@@ -0,0 +1,35 @@
+/* { dg-do run } */
+/* { dg-require-effective-target riscv_v } */
+/* { dg-options { -O3 -fno-vect-cost-model -march=rv64gcv -mabi=lp64d&nbsp; } } */
+
+char a;
+int b;
+short e[14];
+char f[4][12544];
+_Bool c[4][5];
+
+__attribute__ ((noipa))
+void foo (int a)
+{
+&nbsp; if (a != 1)
+&nbsp;&nbsp;&nbsp; __builtin_abort ();
+}
+
+int main ()
+{
+&nbsp; for (int i = 0; i < 4; ++i)
+&nbsp;&nbsp;&nbsp; for (int l = 0; l < 15; ++l)
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int m = 0; m < 15; ++m)
+f[i][l * m] = 3;
+&nbsp; for (int j = 0; j < 4; j += 1)
+&nbsp;&nbsp;&nbsp; for (int k = 3; k < 13; k += 3)
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (_Bool l = 0; l < 1; l = 1)
+for (int m = 0; m < 4; m += 1)
+&nbsp; {
+&nbsp;&nbsp;&nbsp; a = 0;
+&nbsp;&nbsp;&nbsp; b -= e[k];
+&nbsp;&nbsp;&nbsp; c[j][m] = f[j][6];
+&nbsp; }
+&nbsp; for (long i = 2; i < 4; ++i)
+&nbsp;&nbsp;&nbsp; foo (c[3][3]);
+}
-- 
2.44.0

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

end of thread, other threads:[~2024-04-15 12:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-15 12:43 [PATCH] RISC-V: Add VLS to mask vec_extract [PR114668] Robin Dapp
2024-04-15 12:45 ` =?gb18030?B?1tO+09Xc?=

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