AVR: Assert minimal required bit width of section_common::flags.
[gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / offset-1.c
blob0bae23a46f79ce864967ccd778a7751f2f14c21d
1 /* { dg-do run } */
2 /* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
4 #include <openacc.h>
5 #include <string.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <stdbool.h>
10 int
11 main(int argc, char **argv)
13 int N = 8;
14 float *a, *b;
15 int i;
17 a = (float *) malloc(N * sizeof (float));
18 b = (float *) malloc(N * sizeof (float));
20 for (i = 0; i < N; i++)
22 a[i] = 2.0;
23 b[i] = 5.0;
26 #pragma acc parallel copyin(a[2:4]) copyout(b[2:4])
28 b[2] = a[2];
29 b[3] = a[3];
32 for (i = 2; i < 4; i++)
34 if (a[i] != 2.0)
35 abort();
37 if (b[i] != 2.0)
38 abort();
41 for (i = 0; i < N; i++)
43 a[i] = 3.0;
44 b[i] = 1.0;
47 #pragma acc parallel copyin(a[0:4]) copyout(b[0:4])
49 b[0] = a[0];
50 b[1] = a[1];
51 b[2] = a[2];
52 b[3] = a[3];
55 for (i = 0; i < 4; i++)
57 if (a[i] != 3.0)
58 abort();
60 if (b[i] != 3.0)
61 abort();
64 for (i = 0; i < N; i++)
66 a[i] = 9.0;
67 b[i] = 6.0;
70 #pragma acc parallel copyin(a[0:4]) copyout(b[4:4])
72 b[4] = a[0];
73 b[5] = a[1];
74 b[6] = a[2];
75 b[7] = a[3];
78 for (i = 0; i < 4; i++)
80 if (a[i] != 9.0)
81 abort();
84 for (i = 4; i < 8; i++)
86 if (b[i] != 9.0)
87 abort();
90 if (acc_is_present (a, (N * sizeof (float))))
91 abort();
93 if (acc_is_present (b, (N * sizeof (float))))
94 abort();
96 return 0;