]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Another testcase for PR120687
authorRichard Biener <rguenther@suse.de>
Tue, 29 Jul 2025 12:01:46 +0000 (14:01 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 29 Jul 2025 12:03:27 +0000 (14:03 +0200)
This shows reassoc is harmful even with len == 3.

PR tree-optimization/120687
* gcc.dg/vect/pr120687-3.c: New testcase.

gcc/testsuite/gcc.dg/vect/pr120687-3.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/vect/pr120687-3.c b/gcc/testsuite/gcc.dg/vect/pr120687-3.c
new file mode 100644 (file)
index 0000000..f20a66a
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+/* { dg-additional-options "-ffast-math" } */
+
+float
+frd (float *p, float *lastone)
+{
+  float sum = 0;
+  for (; p <= lastone; p += 2)
+    sum += p[0] + p[1];
+  return sum;
+}
+
+/* { dg-final { scan-tree-dump "reduction: detected reduction chain" "vect" } } */
+/* { dg-final { scan-tree-dump-not "SLP discovery of reduction chain failed" "vect" } } */
+/* { dg-final { scan-tree-dump "optimized: loop vectorized" "vect" } } */