summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cilk-plus/pragma_simd_tests/compile/tst1.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cilk-plus/pragma_simd_tests/compile/tst1.cc')
-rw-r--r--gcc/testsuite/g++.dg/cilk-plus/pragma_simd_tests/compile/tst1.cc52
1 files changed, 52 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cilk-plus/pragma_simd_tests/compile/tst1.cc b/gcc/testsuite/g++.dg/cilk-plus/pragma_simd_tests/compile/tst1.cc
new file mode 100644
index 00000000000..b726af792da
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cilk-plus/pragma_simd_tests/compile/tst1.cc
@@ -0,0 +1,52 @@
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus -O3 -w" } */
+
+#define VLEN 4
+
+/* The clauses really doesn't make sense in this, the main thing this code
+ is checking is to see if it can catch the for-loop correctly after
+ the clauses, and compile successfully. */
+int main (void)
+{
+ int array[1000];
+ int i, nphi = 100, w;
+
+
+#pragma simd vectorlength(VLEN) reduction(+:w)
+for (i = 0; i < nphi; i++)
+{
+ w += array[i];
+}
+
+#pragma simd reduction(+:w) vectorlength (VLEN)
+for (i = 0; i < nphi; i++)
+{
+ w += array[i];
+}
+
+#pragma simd vectorlength (VLEN) private(array)
+for (i = 0; i < nphi; i++)
+{
+ w += array[i];
+}
+
+#pragma simd reduction(+:w) noassert
+for (i = 0; i < nphi; i++)
+{
+ w += array[i];
+}
+
+#pragma simd vectorlength(VLEN) linear(nphi:1)
+for (i = 0; i < nphi; i++)
+{
+ w += array[i];
+}
+
+#pragma simd linear(nphi) vectorlength(VLEN) linear(nphi:1)
+for (i = 0; i < nphi; i++)
+{
+ w += array[i];
+}
+return w;
+}
+