Debian Codegraph @

gcc/testsuite/g++.dg/gomp/attrs-19.C

raw
1 // { dg-do compile { target c++11 } }
2
3 void foo1 ();
4
5 void
6 foo ()
7 {
8 [[omp::decl (declare variant (foo1) match (construct={parallel,for}))]]
9 extern void foo2 ();
10 [[omp::sequence (directive (parallel), directive (for))]]
11 for (int i = 0; i < 5; i++)
12 foo2 ();
13 [[omp::decl (declare simd simdlen(4) linear(l) aligned(p:4) uniform(p) inbranch),
14 omp::directive (declare simd simdlen(8) notinbranch)]]
15 extern int foo3 (int l, int *p);
16 [[omp::directive (declare simd simdlen(4) linear(l) aligned(p:4) uniform(p) inbranch),
17 omp::decl (declare simd simdlen(8) notinbranch)]]
18 extern int foo4 (int l, int *p);
19 [[omp::decl (declare simd simdlen(4) linear(l) aligned(p:4) uniform(p) inbranch),
20 omp::decl (declare simd simdlen(8) notinbranch)]]
21 extern int foo5 (int l, int *p);
22 }
23
24 void bar1 ();
25
26 void
27 bar ()
28 {
29 [[using omp : decl (declare variant (bar1), match (construct={parallel,for}))]] // { dg-warning "attribute using prefix only available with" "" { target c++14_down } }
30 extern void bar2 ();
31 [[using omp : sequence (directive (parallel), directive (for))]] // { dg-warning "attribute using prefix only available with" "" { target c++14_down } }
32 for (int i = 0; i < 5; i++)
33 bar2 ();
34 [[omp::decl (declare simd, simdlen(4), linear(l), aligned(p:4),uniform(p),inbranch),
35 omp::directive (declare simd simdlen(8) notinbranch)]]
36 extern int bar3 (int l, int *p);
37 [[using omp : directive (declare simd,simdlen(4),linear(l),aligned(p:4),uniform(p),inbranch), // { dg-warning "attribute using prefix only available with" "" { target c++14_down } }
38 decl (declare simd, simdlen(8), notinbranch)]]
39 extern int bar4 (int l, int *p);
40 [[omp::decl (declare simd, simdlen(4), linear(l), aligned(p:4), uniform(p), inbranch),
41 omp::decl (declare simd, simdlen(8), notinbranch)]]
42 extern int bar5 (int l, int *p);
43 }
44
45 struct S { S (); ~S (); int s; };
46
47 [[omp::decl (threadprivate)]] int t1, t2;
48 int x1, t3 [[omp::decl (threadprivate)]], x2, t4 [[omp::decl (threadprivate)]] [5];
49 [[maybe_unused, omp::decl (threadprivate)]] int t5, t6;
50 [[using omp : decl (threadprivate)]] S t7, t8; // { dg-warning "attribute using prefix only available with" "" { target c++14_down } }
51 [[using omp : decl (declare target enter device_type (host))]] int d1, d2, d3 (int, int), d4; // { dg-warning "attribute using prefix only available with" "" { target c++14_down } }
52 int x3, d5 [[omp::decl (declare target, enter, device_type (any))]], d6 [[omp::decl (declare target link)]], x4;
53 int d7 [[omp::decl (declare target)]];
54 [[using omp : decl (declare target), decl (declare target)]] int d8, d9; // { dg-warning "attribute using prefix only available with" "" { target c++14_down } }
55
56 void
57 baz ()
58 {
59 [[omp::decl (threadprivate)]] static int t1, t2;
60 static int x1, t3 [[omp::decl (threadprivate)]], x2, t4 [[omp::decl (threadprivate)]] [5];
61 [[maybe_unused, omp::decl (threadprivate)]] extern int t5, t6;
62 [[using omp : decl (declare target enter)]] extern int d1, d2, d3 (int, int), d4; // { dg-warning "attribute using prefix only available with" "" { target c++14_down } }
63 static int x3, d5 [[omp::decl (declare target, enter, device_type (any))]], d6 [[omp::decl (declare target link)]], x4;
64 ++t1; ++t2;
65 ++t3; ++t4[2];
66 ++t5; ++t6;
67 ++d1;
68 }