1 // RUN: %clang_cc1 -verify -fopenmp %s 2 3 // RUN: %clang_cc1 -verify -fopenmp-simd %s 4 5 void foo() { 6 } 7 8 bool foobool(int argc) { 9 return argc; 10 } 11 12 struct S1; // expected-note {{declared here}} 13 14 template <class T, typename S, int N, int ST> // expected-note {{declared here}} 15 T tmain(T argc, S **argv) { 16 #pragma omp target 17 #pragma omp teams 18 #pragma omp distribute parallel for simd schedule // expected-error {{expected '(' after 'schedule'}} 19 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 20 #pragma omp target 21 #pragma omp teams 22 #pragma omp distribute parallel for simd schedule ( // expected-error {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}} 23 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 24 #pragma omp target 25 #pragma omp teams 26 #pragma omp distribute parallel for simd schedule () // expected-error {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} 27 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 28 #pragma omp target 29 #pragma omp teams 30 #pragma omp distribute parallel for simd schedule (auto // expected-error {{expected ')'}} expected-note {{to match this '('}} 31 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 32 #pragma omp target 33 #pragma omp teams 34 #pragma omp distribute parallel for simd schedule (auto_dynamic // expected-error {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}} 35 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 36 #pragma omp target 37 #pragma omp teams 38 #pragma omp distribute parallel for simd schedule (auto, // expected-error {{expected ')'}} expected-note {{to match this '('}} 39 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 40 #pragma omp target 41 #pragma omp teams 42 #pragma omp distribute parallel for simd schedule (runtime, 3) // expected-error {{expected ')'}} expected-note {{to match this '('}} 43 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 44 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}} 45 #pragma omp target 46 #pragma omp teams 47 #pragma omp distribute parallel for simd schedule (guided argc 48 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 49 // expected-error@+3 2 {{argument to 'schedule' clause must be a strictly positive integer value}} 50 #pragma omp target 51 #pragma omp teams 52 #pragma omp distribute parallel for simd schedule (static, ST // expected-error {{expected ')'}} expected-note {{to match this '('}} 53 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 54 #pragma omp target 55 #pragma omp teams 56 #pragma omp distribute parallel for simd schedule (dynamic, 1)) // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}} 57 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 58 #pragma omp target 59 #pragma omp teams 60 #pragma omp distribute parallel for simd schedule (guided, (ST > 0) ? 1 + ST : 2) 61 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 62 // expected-error@+4 2 {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'schedule' clause}} 63 // expected-error@+3 {{argument to 'schedule' clause must be a strictly positive integer value}} 64 #pragma omp target 65 #pragma omp teams 66 #pragma omp distribute parallel for simd schedule (static, foobool(argc)), schedule (dynamic, true), schedule (guided, -5) 67 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 68 #pragma omp target 69 #pragma omp teams 70 #pragma omp distribute parallel for simd schedule (static, S) // expected-error {{'S' does not refer to a value}} 71 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 72 // expected-error@+3 2 {{expression must have integral or unscoped enumeration type, not 'char *'}} 73 #pragma omp target 74 #pragma omp teams 75 #pragma omp distribute parallel for simd schedule (guided, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} 76 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 77 #pragma omp target 78 #pragma omp teams 79 #pragma omp distribute parallel for simd schedule (dynamic, 1) 80 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 81 #pragma omp target 82 #pragma omp teams 83 #pragma omp distribute parallel for simd schedule (static, N) // expected-error {{argument to 'schedule' clause must be a strictly positive integer value}} 84 for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; 85 return argc; 86 } 87 88 int main(int argc, char **argv) { 89 #pragma omp target 90 #pragma omp teams 91 #pragma omp distribute parallel for simd schedule // expected-error {{expected '(' after 'schedule'}} 92 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 93 #pragma omp target 94 #pragma omp teams 95 #pragma omp distribute parallel for simd schedule ( // expected-error {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}} 96 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 97 #pragma omp target 98 #pragma omp teams 99 #pragma omp distribute parallel for simd schedule () // expected-error {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} 100 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 101 #pragma omp target 102 #pragma omp teams 103 #pragma omp distribute parallel for simd schedule (auto // expected-error {{expected ')'}} expected-note {{to match this '('}} 104 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 105 #pragma omp target 106 #pragma omp teams 107 #pragma omp distribute parallel for simd schedule (auto_dynamic // expected-error {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}} 108 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 109 #pragma omp target 110 #pragma omp teams 111 #pragma omp distribute parallel for simd schedule (auto, // expected-error {{expected ')'}} expected-note {{to match this '('}} 112 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 113 #pragma omp target 114 #pragma omp teams 115 #pragma omp distribute parallel for simd schedule (runtime, 3) // expected-error {{expected ')'}} expected-note {{to match this '('}} 116 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 117 #pragma omp target 118 #pragma omp teams 119 #pragma omp distribute parallel for simd schedule (guided, 4 // expected-error {{expected ')'}} expected-note {{to match this '('}} 120 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 121 #pragma omp target 122 #pragma omp teams 123 #pragma omp distribute parallel for simd schedule (static, 2+2)) // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}} 124 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 125 #pragma omp target 126 #pragma omp teams 127 #pragma omp distribute parallel for simd schedule (dynamic, foobool(1) > 0 ? 1 : 2) 128 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 129 // expected-error@+4 2 {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'schedule' clause}} 130 // expected-error@+3 {{argument to 'schedule' clause must be a strictly positive integer value}} 131 #pragma omp target 132 #pragma omp teams 133 #pragma omp distribute parallel for simd schedule (guided, foobool(argc)), schedule (static, true), schedule (dynamic, -5) 134 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 135 #pragma omp target 136 #pragma omp teams 137 #pragma omp distribute parallel for simd schedule (guided, S1) // expected-error {{'S1' does not refer to a value}} 138 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 139 // expected-error@+3 {{expression must have integral or unscoped enumeration type, not 'char *'}} 140 #pragma omp target 141 #pragma omp teams 142 #pragma omp distribute parallel for simd schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} 143 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; 144 // expected-error@+5 {{statement after '#pragma omp distribute parallel for simd' must be a for loop}} 145 // expected-note@+3 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}} 146 #pragma omp target 147 #pragma omp teams 148 #pragma omp distribute parallel for simd schedule(dynamic, schedule(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}} 149 foo(); 150 // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 1, 0>' requested here}} 151 return tmain<int, char, 1, 0>(argc, argv); 152 } 153 154