public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [gomp4.1] Add testcase for negative linear step
@ 2015-10-13  7:24 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2015-10-13  7:24 UTC (permalink / raw)
  To: gcc-patches

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-13  7:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-13  7:24 [gomp4.1] Add testcase for negative linear step Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).