This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gomp4.1] Add testcase for negative linear step


Hi!

The spec has been confusing and in one spot said that a linear step
on declare simd has to be constant positive integer, which doesn't
make sense, negative steps are just fine.  As that is what we had
implemented, this patch just adds a testcase for it.

2015-10-13  Jakub Jelinek  <jakub@redhat.com>

	* gcc.dg/vect/vect-simd-clone-15.c: New test.

--- gcc/testsuite/gcc.dg/vect/vect-simd-clone-15.c.jj	2015-10-12 14:02:05.672431442 +0200
+++ gcc/testsuite/gcc.dg/vect/vect-simd-clone-15.c	2015-10-12 14:07:13.383734571 +0200
@@ -0,0 +1,39 @@
+/* { dg-require-effective-target vect_simd_clones } */
+/* { dg-additional-options "-fopenmp-simd" } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+
+#include "tree-vect.h"
+
+#ifndef N
+#define N 1024
+#endif
+
+int array[N];
+
+#pragma omp declare simd linear(val(b):-3), notinbranch
+__attribute__((noinline)) int
+foo (int a, int b)
+{
+  return a + b;
+}
+
+__attribute__((noinline, noclone)) void
+bar ()
+{
+  int i;
+#pragma omp simd
+  for (i = 0; i < N; ++i)
+    array[i] = foo (i >> 1, -i * 3);
+}
+
+int
+main ()
+{
+  int i;
+  check_vect ();
+  bar ();
+  for (i = 0; i < N; i++)
+    if (array[i] != ((i >> 1) + (-3 * i)))
+      abort ();
+  return 0;
+}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]