diff options
Diffstat (limited to 'gcc-4.9/libgomp/testsuite/libgomp.c')
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.c/for-2.c | 3 | ||||
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.c/for-2.h | 21 | ||||
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.c/loop-16.c | 27 | ||||
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.c/simd-10.c | 26 | ||||
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.c/simd-11.c | 27 | ||||
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.c/simd-12.c | 19 | ||||
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.c/simd-13.c | 18 | ||||
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.c/simd-14.c | 123 | ||||
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.c/simd-15.c | 129 | ||||
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.c/simd-16.c | 67 | ||||
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.c/simd-17.c | 73 | ||||
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.c/simd-7.c | 96 | ||||
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.c/simd-8.c | 44 | ||||
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.c/simd-9.c | 70 | ||||
-rw-r--r-- | gcc-4.9/libgomp/testsuite/libgomp.c/target-8.c | 26 |
15 files changed, 760 insertions, 9 deletions
diff --git a/gcc-4.9/libgomp/testsuite/libgomp.c/for-2.c b/gcc-4.9/libgomp/testsuite/libgomp.c/for-2.c index f5a01ab05..ae8100874 100644 --- a/gcc-4.9/libgomp/testsuite/libgomp.c/for-2.c +++ b/gcc-4.9/libgomp/testsuite/libgomp.c/for-2.c @@ -21,11 +21,14 @@ extern void abort (void); #undef F #undef G +#undef SC +#define SC static #define F for simd #define G f_simd #include "for-1.h" #undef F #undef G +#undef SC int main () diff --git a/gcc-4.9/libgomp/testsuite/libgomp.c/for-2.h b/gcc-4.9/libgomp/testsuite/libgomp.c/for-2.h index 57c385ec8..920d23b52 100644 --- a/gcc-4.9/libgomp/testsuite/libgomp.c/for-2.h +++ b/gcc-4.9/libgomp/testsuite/libgomp.c/for-2.h @@ -8,6 +8,9 @@ noreturn (void) for (;;); } #endif +#ifndef SC +#define SC +#endif __attribute__((noinline, noclone)) void N(f0) (void) @@ -57,7 +60,7 @@ __attribute__((noinline, noclone)) void N(f5) (int n11, int n12, int n21, int n22, int n31, int n32, int s1, int s2, int s3) { - int v1, v2, v3; + SC int v1, v2, v3; #pragma omp F S collapse(3) for (v1 = n11; v1 < n12; v1 += s1) for (v2 = n21; v2 < n22; v2 += s2) @@ -69,8 +72,8 @@ __attribute__((noinline, noclone)) void N(f6) (int n11, int n12, int n21, int n22, long long n31, long long n32, int s1, int s2, long long int s3) { - int v1, v2; - long long v3; + SC int v1, v2; + SC long long v3; #pragma omp F S collapse(3) for (v1 = n11; v1 > n12; v1 += s1) for (v2 = n21; v2 > n22; v2 += s2) @@ -81,8 +84,8 @@ N(f6) (int n11, int n12, int n21, int n22, long long n31, long long n32, __attribute__((noinline, noclone)) void N(f7) (void) { - unsigned int v1, v3; - unsigned long long v2; + SC unsigned int v1, v3; + SC unsigned long long v2; #pragma omp F S collapse(3) for (v1 = 0; v1 < 20; v1 += 2) for (v2 = __LONG_LONG_MAX__ + 16ULL; @@ -94,7 +97,7 @@ N(f7) (void) __attribute__((noinline, noclone)) void N(f8) (void) { - long long v1, v2, v3; + SC long long v1, v2, v3; #pragma omp F S collapse(3) for (v1 = 0; v1 < 20; v1 += 2) for (v2 = 30; v2 < 20; v2++) @@ -118,7 +121,7 @@ N(f9) (void) __attribute__((noinline, noclone)) void N(f10) (void) { - int i; + SC int i; #pragma omp F S collapse(3) for (i = 0; i < 10; i++) for (int j = 10; j < 8; j++) @@ -146,7 +149,7 @@ N(f11) (int n) __attribute__((noinline, noclone)) void N(f12) (int n) { - int i; + SC int i; #pragma omp F S collapse(3) for (i = 0; i < 10; i++) for (int j = n; j < 8; j++) @@ -170,7 +173,7 @@ N(f13) (void) __attribute__((noinline, noclone)) void N(f14) (void) { - float *i; + SC float *i; #pragma omp F S collapse(3) for (i = &b[0][0][0]; i < &b[0][0][10]; i++) for (float *j = &b[0][15][0]; j > &b[0][0][0]; j -= 10) diff --git a/gcc-4.9/libgomp/testsuite/libgomp.c/loop-16.c b/gcc-4.9/libgomp/testsuite/libgomp.c/loop-16.c new file mode 100644 index 000000000..3ef2f6489 --- /dev/null +++ b/gcc-4.9/libgomp/testsuite/libgomp.c/loop-16.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ + +extern void abort (void); + +volatile int count; +static int test (void) +{ + return ++count > 0; +} + +int i; + +int +main () +{ + #pragma omp for lastprivate (i) + for (i = 0; i < 10; ++i) + { + int *p = &i; + if (test ()) + continue; + abort (); + } + if (i != count) + abort (); + return 0; +} diff --git a/gcc-4.9/libgomp/testsuite/libgomp.c/simd-10.c b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-10.c new file mode 100644 index 000000000..70cd9f015 --- /dev/null +++ b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-10.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +int s = 0, i, u; + +void +foo () +{ + #pragma omp for simd schedule(static, 32) reduction(+:s) lastprivate(u) + for (i = 0; i < 128; i++) + { + s++; + u = i; + } + if (i != 128 || s != 128 || u != 127) + __builtin_abort (); +} + +int +main () +{ + foo (); + return 0; +} diff --git a/gcc-4.9/libgomp/testsuite/libgomp.c/simd-11.c b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-11.c new file mode 100644 index 000000000..b09f0dde8 --- /dev/null +++ b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-11.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +int s = 0, i, j, u; + +void +foo () +{ + #pragma omp for simd schedule(static, 32) reduction(+:s) lastprivate(u) collapse(2) + for (i = 0; i < 16; i++) + for (j = 0; j < 16; j++) + { + s++; + u = i + j; + } + if (i != 16 || j != 16 || s != 256 || u != 30) + __builtin_abort (); +} + +int +main () +{ + foo (); + return 0; +} diff --git a/gcc-4.9/libgomp/testsuite/libgomp.c/simd-12.c b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-12.c new file mode 100644 index 000000000..6685111a0 --- /dev/null +++ b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-12.c @@ -0,0 +1,19 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +int +main () +{ + int k = 0, i, s = 0; + #pragma omp parallel + #pragma omp for simd linear(k : 3) reduction(+: s) schedule (static, 16) + for (i = 0; i < 128; i++) + { + k = k + 3; + s = s + k; + } + if (s != 128 * 129 / 2 * 3) __builtin_abort (); + return 0; +} diff --git a/gcc-4.9/libgomp/testsuite/libgomp.c/simd-13.c b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-13.c new file mode 100644 index 000000000..7c817b793 --- /dev/null +++ b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-13.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +int +main () +{ + int k = 0, i, s = 0; + #pragma omp parallel for simd linear(k : 3) reduction(+: s) schedule (static, 16) + for (i = 0; i < 128; i++) + { + k = k + 3; + s = s + k; + } + if (s != 128 * 129 / 2 * 3) __builtin_abort (); + return 0; +} diff --git a/gcc-4.9/libgomp/testsuite/libgomp.c/simd-14.c b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-14.c new file mode 100644 index 000000000..50e8d5e90 --- /dev/null +++ b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-14.c @@ -0,0 +1,123 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +int +main () +{ + int i, j, b, c = 0; + i = 4; j = 4; b = 7; + #pragma omp simd linear(b:2) reduction(+:c) + for (i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + b = b + 2; + } + if (c || i != 64 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd linear(b:3) reduction(+:c) + for (i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + b = b + 3; + } + if (c || i != 64 || b != 7 + 16 * 3) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd linear(i) linear(b:2) reduction(+:c) + for (i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + b = b + 2; + } + if (c || i != 64 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd linear(i:4) linear(b:3) reduction(+:c) + for (i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + b = b + 3; + } + if (c || i != 64 || b != 7 + 16 * 3) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd collapse (2) linear(b:2) reduction(+:c) + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + b = b + 2; + } + if (c || i != 8 || j != 8 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd collapse (2) lastprivate (i, j) linear(b:2) reduction(+:c) + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + b = b + 2; + } + if (c || i != 8 || j != 8 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c) + for (i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + b = b + 2; + } + if (c || i != 64 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c) + for (i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + b = b + 3; + } + if (c || i != 64 || b != 7 + 16 * 3) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(i) linear(b:2) reduction(+:c) + for (i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + b = b + 2; + } + if (c || i != 64 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(i:4) linear(b:3) reduction(+:c) + for (i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + b = b + 3; + } + if (c || i != 64 || b != 7 + 16 * 3) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd lastprivate (i, j) collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + b = b + 2; + } + if (c || i != 8 || j != 8 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + b = b + 2; + } + if (c || i != 8 || j != 8 || b != 7 + 64 * 2) + __builtin_abort (); + return 0; +} diff --git a/gcc-4.9/libgomp/testsuite/libgomp.c/simd-15.c b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-15.c new file mode 100644 index 000000000..e474b81fa --- /dev/null +++ b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-15.c @@ -0,0 +1,129 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +static inline void +foo (int *b, int *i, int *j, int x) +{ + *b = *b + x + (*i - *i) + (*j - *j); +} + +int +main () +{ + int i, j, b, c = 0; + i = 4; j = 4; b = 7; + #pragma omp simd linear(b:2) reduction(+:c) + for (i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + foo (&b, &i, &j, 2); + } + if (c || i != 64 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd linear(b:3) reduction(+:c) + for (i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + foo (&b, &i, &j, 3); + } + if (c || i != 64 || b != 7 + 16 * 3) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd linear(i) linear(b:2) reduction(+:c) + for (i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + foo (&b, &i, &j, 2); + } + if (c || i != 64 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd linear(i:4) linear(b:3) reduction(+:c) + for (i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + foo (&b, &i, &j, 3); + } + if (c || i != 64 || b != 7 + 16 * 3) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd collapse (2) linear(b:2) reduction(+:c) + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + foo (&b, &i, &j, 2); + } + if (c || i != 8 || j != 8 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp simd collapse (2) lastprivate (i, j) linear(b:2) reduction(+:c) + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + foo (&b, &i, &j, 2); + } + if (c || i != 8 || j != 8 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c) + for (i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + foo (&b, &i, &j, 2); + } + if (c || i != 64 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c) + for (i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + foo (&b, &i, &j, 3); + } + if (c || i != 64 || b != 7 + 16 * 3) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(i) linear(b:2) reduction(+:c) + for (i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + foo (&b, &i, &j, 2); + } + if (c || i != 64 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(i:4) linear(b:3) reduction(+:c) + for (i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + foo (&b, &i, &j, 3); + } + if (c || i != 64 || b != 7 + 16 * 3) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd lastprivate (i, j) collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + foo (&b, &i, &j, 2); + } + if (c || i != 8 || j != 8 || b != 7 + 64 * 2) + __builtin_abort (); + i = 4; j = 4; b = 7; + #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) + for (i = 0; i < 8; i++) + for (j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + foo (&b, &i, &j, 2); + } + if (c || i != 8 || j != 8 || b != 7 + 64 * 2) + __builtin_abort (); + return 0; +} diff --git a/gcc-4.9/libgomp/testsuite/libgomp.c/simd-16.c b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-16.c new file mode 100644 index 000000000..c8c29c744 --- /dev/null +++ b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-16.c @@ -0,0 +1,67 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -std=c99" } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +int +main () +{ + int b, c = 0; + b = 7; + #pragma omp simd linear(b:2) reduction(+:c) + for (int i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + b = b + 2; + } + if (c || b != 7 + 64 * 2) + __builtin_abort (); + b = 7; + #pragma omp simd linear(b:3) reduction(+:c) + for (int i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + b = b + 3; + } + if (c || b != 7 + 16 * 3) + __builtin_abort (); + b = 7; + #pragma omp simd collapse (2) linear(b:2) reduction(+:c) + for (int i = 0; i < 8; i++) + for (int j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + b = b + 2; + } + if (c || b != 7 + 64 * 2) + __builtin_abort (); + b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c) + for (int i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + b = b + 2; + } + if (c || b != 7 + 64 * 2) + __builtin_abort (); + b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c) + for (int i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + b = b + 3; + } + if (c || b != 7 + 16 * 3) + __builtin_abort (); + b = 7; + #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) + for (int i = 0; i < 8; i++) + for (int j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + b = b + 2; + } + if (c || b != 7 + 64 * 2) + __builtin_abort (); + return 0; +} diff --git a/gcc-4.9/libgomp/testsuite/libgomp.c/simd-17.c b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-17.c new file mode 100644 index 000000000..136e6e64a --- /dev/null +++ b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-17.c @@ -0,0 +1,73 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -std=c99" } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +static inline void +foo (int *b, int *i, int *j, int x) +{ + *b = *b + x + (*i - *i) + (*j - *j); +} + +int +main () +{ + int b, c = 0; + b = 7; + #pragma omp simd linear(b:2) reduction(+:c) + for (int i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + foo (&b, &i, &i, 2); + } + if (c || b != 7 + 64 * 2) + __builtin_abort (); + b = 7; + #pragma omp simd linear(b:3) reduction(+:c) + for (int i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + foo (&b, &i, &i, 3); + } + if (c || b != 7 + 16 * 3) + __builtin_abort (); + b = 7; + #pragma omp simd collapse (2) linear(b:2) reduction(+:c) + for (int i = 0; i < 8; i++) + for (int j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + foo (&b, &i, &j, 2); + } + if (c || b != 7 + 64 * 2) + __builtin_abort (); + b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(b:2) reduction(+:c) + for (int i = 0; i < 64; i++) + { + c = c + (b != 7 + 2 * i); + foo (&b, &i, &i, 2); + } + if (c || b != 7 + 64 * 2) + __builtin_abort (); + b = 7; + #pragma omp parallel for simd schedule (static, 4) linear(b:3) reduction(+:c) + for (int i = 0; i < 64; i += 4) + { + c = c + (b != 7 + i / 4 * 3); + foo (&b, &i, &i, 3); + } + if (c || b != 7 + 16 * 3) + __builtin_abort (); + b = 7; + #pragma omp parallel for simd collapse (2) schedule (static, 4) linear(b:2) reduction(+:c) + for (int i = 0; i < 8; i++) + for (int j = 0; j < 8; j++) + { + c = c + (b != 7 + 2 * j + 2 * 8 * i); + foo (&b, &i, &j, 2); + } + if (c || b != 7 + 64 * 2) + __builtin_abort (); + return 0; +} diff --git a/gcc-4.9/libgomp/testsuite/libgomp.c/simd-7.c b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-7.c new file mode 100644 index 000000000..ab04fee82 --- /dev/null +++ b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-7.c @@ -0,0 +1,96 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +extern void abort (); +int a[1024] __attribute__((aligned (32))) = { 1 }; +int b[1024] __attribute__((aligned (32))) = { 1 }; +int k, m; +struct U { int u; }; +struct V { int v; }; + +__attribute__((noinline, noclone)) int +foo (int *p) +{ + int i, s = 0; + struct U u; + struct V v; + #pragma omp simd aligned(a, p : 32) linear(k: m + 1) \ + linear(i) reduction(+:s) lastprivate(u, v) + for (i = 0; i < 1024; i++) + { + int *q = &i; + a[i] *= p[i]; + u.u = p[i] + k; + k += m + 1; + v.v = p[i] + k; + s += p[i] + k; + } + if (u.u != 36 + 4 + 3 * 1023 || v.v != 36 + 4 + 3 * 1024 || i != 1024) + abort (); + return s; +} + +__attribute__((noinline, noclone)) int +bar (int *p) +{ + int i, s = 0; + struct U u; + struct V v; + #pragma omp simd aligned(a, p : 32) linear(k: m + 1) \ + reduction(+:s) lastprivate(u, v) + for (i = 0; i < 1024; i++) + { + int *q = &i; + a[i] *= p[i]; + u.u = p[i] + k; + k += m + 1; + v.v = p[i] + k; + s += p[i] + k; + } + if (u.u != 36 + 4 + 3 * 1023 || v.v != 36 + 4 + 3 * 1024 || i != 1024) + abort (); + return s; +} + +int +main () +{ +#if __SIZEOF_INT__ >= 4 + int i; + k = 4; + m = 2; + for (i = 0; i < 1024; i++) + { + a[i] = i - 512; + b[i] = (i - 51) % 39; + } + int s = foo (b); + for (i = 0; i < 1024; i++) + { + if (b[i] != (i - 51) % 39 + || a[i] != (i - 512) * b[i]) + abort (); + } + if (k != 4 + 3 * 1024 || s != 1596127) + abort (); + k = 4; + m = 2; + for (i = 0; i < 1024; i++) + { + a[i] = i - 512; + b[i] = (i - 51) % 39; + } + s = bar (b); + for (i = 0; i < 1024; i++) + { + if (b[i] != (i - 51) % 39 + || a[i] != (i - 512) * b[i]) + abort (); + } + if (k != 4 + 3 * 1024 || s != 1596127) + abort (); +#endif + return 0; +} diff --git a/gcc-4.9/libgomp/testsuite/libgomp.c/simd-8.c b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-8.c new file mode 100644 index 000000000..13f40d583 --- /dev/null +++ b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-8.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +extern void abort (); +int a[32][32] __attribute__((aligned (32))) = { { 1 } }; +struct S { int s; }; +#pragma omp declare reduction (+:struct S:omp_out.s += omp_in.s) +#pragma omp declare reduction (foo:struct S:omp_out.s += omp_in.s) +#pragma omp declare reduction (foo:int:omp_out += omp_in) + +__attribute__((noinline, noclone)) int +foo (void) +{ + int i, j, u = 0; + struct S s, t; + s.s = 0; t.s = 0; + #pragma omp simd aligned(a : 32) reduction(+:s) reduction(foo:t, u) collapse(2) + for (i = 0; i < 32; i++) + for (j = 0; j < 32; j++) + { + int x = a[i][j]; + s.s += x; + t.s += x; + u += x; + } + if (t.s != s.s || u != s.s) + abort (); + return s.s; +} + +int +main () +{ + int i, j; + for (i = 0; i < 32; i++) + for (j = 0; j < 32; j++) + a[i][j] = j + (i / 4); + int s = foo (); + if (s != 19456) + abort (); + return 0; +} diff --git a/gcc-4.9/libgomp/testsuite/libgomp.c/simd-9.c b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-9.c new file mode 100644 index 000000000..b64dd2522 --- /dev/null +++ b/gcc-4.9/libgomp/testsuite/libgomp.c/simd-9.c @@ -0,0 +1,70 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-msse2" { target sse2_runtime } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +extern void abort (); +int a[32][32] __attribute__((aligned (32))) = { { 1 } }; +struct S { int s; }; +#pragma omp declare reduction (+:struct S:omp_out.s += omp_in.s) +#pragma omp declare reduction (foo:struct S:omp_out.s += omp_in.s) +#pragma omp declare reduction (foo:int:omp_out += omp_in) + +__attribute__((noinline, noclone)) int +foo (void) +{ + int i, j, u = 0; + struct S s, t; + s.s = 0; t.s = 0; + #pragma omp simd aligned(a : 32) lastprivate (i, j) reduction(+:s) reduction(foo:t, u) collapse(2) + for (i = 0; i < 32; i++) + for (j = 0; j < 32; j++) + { + int *q = &i; + int *r = &j; + int x = a[i][j]; + s.s += x; + t.s += x; + u += x; + } + if (t.s != s.s || u != s.s || i != 32 || j != 32) + abort (); + return s.s; +} + +__attribute__((noinline, noclone)) int +bar (void) +{ + int i, j, u = 0; + struct S s, t; + s.s = 0; t.s = 0; + #pragma omp simd aligned(a:32)reduction(+:s)reduction(foo:t,u)collapse(2) + for (i = 0; i < 32; i++) + for (j = 0; j < 32; j++) + { + int *q = &i; + int *r = &j; + int x = a[i][j]; + s.s += x; + t.s += x; + u += x; + } + if (t.s != s.s || u != s.s || i != 32 || j != 32) + abort (); + return s.s; +} + +int +main () +{ + int i, j; + for (i = 0; i < 32; i++) + for (j = 0; j < 32; j++) + a[i][j] = j + (i / 4); + int s = foo (); + if (s != 19456) + abort (); + if (bar () != 19456) + abort (); + return 0; +} diff --git a/gcc-4.9/libgomp/testsuite/libgomp.c/target-8.c b/gcc-4.9/libgomp/testsuite/libgomp.c/target-8.c new file mode 100644 index 000000000..350845753 --- /dev/null +++ b/gcc-4.9/libgomp/testsuite/libgomp.c/target-8.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-options "-fopenmp" } */ + +void +foo (int *p) +{ + int i; + #pragma omp parallel + #pragma omp single + #pragma omp target teams distribute parallel for map(p[0:24]) + for (i = 0; i < 24; i++) + p[i] = p[i] + 1; +} + +int +main () +{ + int p[24], i; + for (i = 0; i < 24; i++) + p[i] = i; + foo (p); + for (i = 0; i < 24; i++) + if (p[i] != i + 1) + __builtin_abort (); + return 0; +} |