[PATCH] testsuite: add the case to cover vectorization of A[(i+x)*stride] [PR114322]

Hao Liu OS hliu@os.amperecomputing.com
Wed Mar 20 07:55:19 GMT 2024


Hi Richard,

As mentioned in the comments of PR114322 (which has been fixed by PR114151
r14-9540-ge0e9499a), this patch is to cover the case.

Bootstrapped and regression tested on aarch64-linux-gnu, OK for trunk?

gcc/testsuite/ChangeLog:

	PR tree-optimization/114322
	* gcc.dg/vect/pr114322.c: New testcase.

diff --git a/gcc/testsuite/gcc.dg/vect/pr114322.c b/gcc/testsuite/gcc.dg/vect/pr114322.c
new file mode 100644
index 00000000000..7c3a4ffe260
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr114322.c
@@ -0,0 +1,18 @@
+/* PR tree-optimization/114322 */
+/* { dg-do compile } */
+
+int
+foo (short *A, int x, int stride)
+{
+  int sum = 0;
+
+  if (stride > 1)
+    {
+      for (int i = 0; i < 1024; ++i)
+        sum += A[(i + x) * stride];
+    }
+
+  return sum;
+}
+
+/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target aarch64*-*-* } } } */
-- 
2.34.1



More information about the Gcc-patches mailing list