]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/34195 - testcase for fixed vectorization
authorRichard Biener <rguenther@suse.de>
Wed, 7 Jul 2021 11:46:48 +0000 (13:46 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 7 Jul 2021 11:48:26 +0000 (13:48 +0200)
This adds a testcase for an old fixed PR.

2021-07-07  Richard Biener  <rguenther@suse.de>

PR tree-optimization/34195
* gcc.dg/vect/pr34195.c: New testcase.

gcc/testsuite/gcc.dg/vect/pr34195.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/vect/pr34195.c b/gcc/testsuite/gcc.dg/vect/pr34195.c
new file mode 100644 (file)
index 0000000..e36950b
--- /dev/null
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_float } */
+
+#define M 11
+
+struct S
+{
+  float x;
+  float y;
+} pS[100];
+
+float a[1000];
+float b[1000];
+
+void
+foo (int n)
+{
+  int i, j;
+
+  for (i = 0; i < n; i++)
+    {
+      pS[i].x = 0;
+      pS[i].y = 0;
+
+      for (j = 0; j < M; j++)
+        {
+          pS[i].x += (a[i]+b[i]);
+          pS[i].y += (a[i]-b[i]);
+        }
+    }
+}
+
+/* { dg-final { scan-tree-dump "OUTER LOOP VECTORIZED" "vect" } } */