match.pd: Check trunc_mod vector obtap before folding.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / declare-vla.c
blobcf423d60327412e6ac9a1ac425bb70fec9a6d244
1 /* Verify OpenACC 'declare' with VLAs. */
3 /* { dg-additional-options "--param=openacc-kernels=decompose" } */
5 /* { dg-additional-options "-fopt-info-omp-all" }
6 { dg-additional-options "-foffload=-fopt-info-all-omp" } */
8 /* { dg-additional-options "--param=openacc-privatization=noisy" }
9 { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
10 Prune a few: uninteresting, and potentially varying depending on GCC configuration (data types):
11 { dg-prune-output {note: variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} } */
13 /* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
14 passed to 'incr' may be unset, and in that case, it will be set to [...]",
15 so to maintain compatibility with earlier Tcl releases, we manually
16 initialize counter variables:
17 { dg-line l_dummy[variable c_compute 0] }
18 { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
19 "WARNING: dg-line var l_dummy defined, but not used". */
22 #include <assert.h>
25 void
26 f (void)
28 int N = 1000;
29 int i, A[N];
30 #pragma acc declare copy(A)
32 for (i = 0; i < N; i++)
33 A[i] = -i;
35 #pragma acc kernels /* { dg-line l_compute[incr c_compute] } */
36 /* { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
37 { dg-note {variable 'i' made addressable} {} { target *-*-* } l_compute$c_compute } */
38 /* { dg-note {OpenACC 'kernels' decomposition: variable 'N' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
39 { dg-note {variable 'N' made addressable} {} { target *-*-* } l_compute$c_compute } */
40 /* { dg-optimized {assigned OpenACC seq loop parallelism} {} { target { ! __OPTIMIZE__ } } l_compute$c_compute }
41 { dg-optimized {assigned OpenACC gang loop parallelism} {} { target __OPTIMIZE__ } l_compute$c_compute } */
42 /* { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} {} { target *-*-* } .+1 } */
43 for (i = 0; i < N; i++)
44 A[i] = i;
46 #pragma acc update host(A)
48 for (i = 0; i < N; i++)
49 assert (A[i] == i);
53 /* The same as 'f' but everything contained in an OpenACC 'data' construct. */
55 void
56 f_data (void)
58 #pragma acc data
59 /* { dg-bogus {note: variable [^\n\r]+ candidate for adjusting OpenACC privatization level} {TODO 'data'} { xfail *-*-* } .-1 } */
61 int N = 1000;
62 int i, A[N];
63 # pragma acc declare copy(A)
65 for (i = 0; i < N; i++)
66 A[i] = -i;
68 # pragma acc kernels /* { dg-line l_compute[incr c_compute] } */
69 /* { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
70 { dg-note {variable 'i' made addressable} {} { target *-*-* } l_compute$c_compute } */
71 /* { dg-note {OpenACC 'kernels' decomposition: variable 'N' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
72 { dg-note {variable 'N' made addressable} {} { target *-*-* } l_compute$c_compute } */
73 /* { dg-optimized {assigned OpenACC seq loop parallelism} {} { target { ! __OPTIMIZE__ } } l_compute$c_compute }
74 { dg-optimized {assigned OpenACC gang loop parallelism} {} { target __OPTIMIZE__ } l_compute$c_compute } */
75 /* { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} {} { target *-*-* } .+1 } */
76 for (i = 0; i < N; i++)
77 A[i] = i;
79 # pragma acc update host(A)
81 for (i = 0; i < N; i++)
82 assert (A[i] == i);
87 int
88 main ()
90 f ();
92 f_data ();
94 return 0;