tree-optimization/96854 - testcase for SLP reduction of two-operator
authorRichard Biener <rguenther@suse.de>
Mon, 31 Aug 2020 11:36:09 +0000 (13:36 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 31 Aug 2020 11:42:31 +0000 (13:42 +0200)
This adds the testcase for the already fixed PR.

2020-08-31  Richard Biener  <rguenther@suse.de>

PR tree-optimization/96854
* gcc.dg/vect/pr96854.c: New testcase.

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

diff --git a/gcc/testsuite/gcc.dg/vect/pr96854.c b/gcc/testsuite/gcc.dg/vect/pr96854.c
new file mode 100644 (file)
index 0000000..e3980d4
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-additional-options "-ffast-math" } */
+
+double _Complex __attribute__((noipa))
+foo (double _Complex acc, const double _Complex *x, const double _Complex* y, int N)
+{
+  for (int c = 0; c < N; ++c)
+    acc -= x[c] * y[c];
+  return acc;
+}
+
+int
+main()
+{
+  static const double _Complex y[] = { 1, 2, };
+  static const double _Complex x[] = { 1, 3, };
+  double _Complex ref = foo (0, x, y, 2);
+  if (__builtin_creal (ref) != -7.)
+    __builtin_abort ();
+  return 0;
+}