Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / mapping / firstprivate_aligned.cpp
blobae6be0f0c07f47c05b20b4bb6795348118ad3b7a
1 // RUN: %libomptarget-compilexx-generic -O3 && %libomptarget-run-generic
3 #include <stdio.h>
5 // CHECK: rx: 16, ry: 16;
6 // CHECK: rx: 16, ry: 16;
7 // CHECK: rx: 16, ry: 16;
8 // CHECK: rx: 16, ry: 16;
10 template <bool Aligned> void test() {
11 printf("Test %saligned firstprivate\n", Aligned ? "" : "non-");
12 char z1[3 + Aligned], z2[3 + Aligned];
13 int x[4];
14 int y[4];
15 y[0] = y[1] = y[2] = y[3] = 4;
16 x[0] = x[1] = x[2] = x[3] = 4;
17 int rx = -1, ry = -1;
18 #pragma omp target firstprivate(z1, y, z2) map(from : ry, rx) map(to : x)
20 ry = (y[0] + y[1] + y[2] + y[3]);
21 rx = (x[0] + x[1] + x[2] + x[3]);
23 printf(" rx:%i, ry:%i\n", rx, ry);
24 #pragma omp target firstprivate(z1, y, z2) map(from : ry, rx) map(to : x)
26 z1[2] += 5;
27 ry = (y[0] + y[1] + y[2] + y[3]);
28 rx = (x[0] + x[1] + x[2] + x[3]);
29 z2[2] += 7;
31 printf(" rx:%i, ry:%i\n", rx, ry);
34 int main() {
35 test<true>();
36 test<false>();