diff options
author | Michael Meissner <meissner@linux.vnet.ibm.com> | 2016-06-13 19:17:11 +0000 |
---|---|---|
committer | Michael Meissner <meissner@linux.vnet.ibm.com> | 2016-06-13 19:17:11 +0000 |
commit | 96f074375cbd78b6d762d5c0896ff9b4be1ffdd6 (patch) | |
tree | e942205a85b1a2f2bd259b3da2e31b7303905c69 /libgomp/testsuite/libgomp.oacc-c/nested-function-1.c | |
parent | 342a6bf41b8a442ff4325d51d6ee59a4f1402ff6 (diff) | |
parent | c7a32e1a058ac615030cdedc9194ac4d3bda0604 (diff) |
Merge up to 237393ibm/stage-test
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ibm/stage-test@237398 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/testsuite/libgomp.oacc-c/nested-function-1.c')
-rw-r--r-- | libgomp/testsuite/libgomp.oacc-c/nested-function-1.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.oacc-c/nested-function-1.c b/libgomp/testsuite/libgomp.oacc-c/nested-function-1.c new file mode 100644 index 00000000000..fb2a3acdfa9 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c/nested-function-1.c @@ -0,0 +1,52 @@ +/* Exercise nested function decomposition, gcc/tree-nested.c. */ + +int +main (void) +{ + void test1 () + { + int i, j, k; + int a[4][7][8]; + + __builtin_memset (a, 0, sizeof (a)); + +#pragma acc parallel +#pragma acc loop collapse(4 - 1) + for (i = 1; i <= 3; i++) + for (j = 4; j <= 6; j++) + for (k = 5; k <= 7; k++) + a[i][j][k] = i + j + k; + + for (i = 1; i <= 3; i++) + for (j = 4; j <= 6; j++) + for (k = 5; k <= 7; k++) + if (a[i][j][k] != i + j + k) + __builtin_abort(); + } + + void test2 () + { + int i, j, k; + int a[4][4][4]; + + __builtin_memset (a, 0, sizeof (a)); + +#pragma acc parallel +#pragma acc loop collapse(3) + for (i = 1; i <= 3; i++) + for (j = 1; j <= 3; j++) + for (k = 1; k <= 3; k++) + a[i][j][k] = 1; + + for (i = 1; i <= 3; i++) + for (j = 1; j <= 3; j++) + for (k = 1; k <= 3; k++) + if (a[i][j][k] != 1) + __builtin_abort (); + } + + test1 (); + test2 (); + + return 0; +} |