@@ -53,7 +53,22 @@ void foo1()
53
53
// CHECK: IntelFPGANumBanksAttr
54
54
// CHECK-NEXT: ConstantExpr
55
55
// CHECK-NEXT: IntegerLiteral{{.*}}4{{$}}
56
- __attribute__ ((__numbanks__ (4 ))) unsigned int v_six2[32 ];
56
+ [[intelfpga::numbanks (4 )]] unsigned int v_six2[32 ];
57
+
58
+ // CHECK: VarDecl{{.*}}v_seven
59
+ // CHECK: IntelFPGAMemoryAttr{{.*}}Implicit
60
+ // CHECK: IntelFPGAMaxConcurrencyAttr
61
+ // CHECK-NEXT: ConstantExpr
62
+ // CHECK-NEXT: IntegerLiteral{{.*}}4{{$}}
63
+ __attribute__ ((max_concurrency (4 )))
64
+ unsigned int v_seven[64 ];
65
+
66
+ // CHECK: VarDecl{{.*}}v_seven2
67
+ // CHECK: IntelFPGAMemoryAttr{{.*}}Implicit
68
+ // CHECK: IntelFPGAMaxConcurrencyAttr
69
+ // CHECK-NEXT: ConstantExpr
70
+ // CHECK-NEXT: IntegerLiteral{{.*}}8{{$}}
71
+ [[intelfpga::max_concurrency (8 )]] unsigned int v_seven2[64 ];
57
72
58
73
int __attribute__ ((__register__)) A;
59
74
int __attribute__ ((__numbanks__ (4 ), __bankwidth__ (16 ))) E;
@@ -77,6 +92,12 @@ void foo1()
77
92
// expected-note@-2 {{conflicting attribute is here}}
78
93
unsigned int reg_six[64 ];
79
94
95
+ // expected-error@+2{{attributes are not compatible}}
96
+ __attribute__ ((__register__))
97
+ __attribute__ ((__max_concurrency__ (16 )))
98
+ // expected-note@-2 {{conflicting attribute is here}}
99
+ unsigned int reg_six_two[64 ];
100
+
80
101
// expected-error@+2{{attributes are not compatible}}
81
102
__attribute__ ((__register__))
82
103
__attribute__ ((__numbanks__ (8 )))
@@ -117,7 +138,7 @@ void foo1()
117
138
__attribute__ ((__bankwidth__ (3 )))
118
139
unsigned int bw_three[64 ];
119
140
120
- // expected-error@+1{{requires integer constant between 1 and 1048576}}
141
+ // expected-error@+1{{'bankwidth' attribute requires integer constant between 1 and 1048576 inclusive }}
121
142
__attribute__ ((__bankwidth__ (-4 )))
122
143
unsigned int bw_four[64 ];
123
144
@@ -131,10 +152,43 @@ void foo1()
131
152
__attribute__ ((__bankwidth__ (4 ,8 )))
132
153
unsigned int bw_six[64 ];
133
154
134
- // expected-error@+1{{requires integer constant between 1 and 1048576}}
155
+ // expected-error@+1{{'bankwidth' attribute requires integer constant between 1 and 1048576 inclusive }}
135
156
__attribute__ ((__bankwidth__ (0 )))
136
157
unsigned int bw_seven[64 ];
137
158
159
+ // max_concurrency
160
+ // expected-error@+2{{attributes are not compatible}}
161
+ __attribute__ ((__max_concurrency__ (16 )))
162
+ __attribute__ ((__register__))
163
+ // expected-note@-2 {{conflicting attribute is here}}
164
+ unsigned int mc_one[64 ];
165
+
166
+ // CHECK: VarDecl{{.*}}mc_two
167
+ // CHECK: IntelFPGAMaxConcurrencyAttr
168
+ // CHECK-NEXT: ConstantExpr
169
+ // CHECK-NEXT: IntegerLiteral{{.*}}8{{$}}
170
+ // CHECK: IntelFPGAMaxConcurrencyAttr
171
+ // CHECK-NEXT: ConstantExpr
172
+ // CHECK-NEXT: IntegerLiteral{{.*}}16{{$}}
173
+ // expected-warning@+2{{is already applied}}
174
+ __attribute__ ((__max_concurrency__ (8 )))
175
+ __attribute__ ((__max_concurrency__ (16 )))
176
+ unsigned int mc_two[64 ];
177
+
178
+ // expected-error@+1{{'max_concurrency' attribute requires integer constant between 0 and 1048576 inclusive}}
179
+ __attribute__ ((__max_concurrency__ (-4 )))
180
+ unsigned int mc_four[64 ];
181
+
182
+ int i_max_concurrency = 32 ; // expected-note {{declared here}}
183
+ // expected-error@+1{{expression is not an integral constant expression}}
184
+ __attribute__ ((__max_concurrency__ (i_max_concurrency)))
185
+ // expected-note@-1{{read of non-const variable 'i_max_concurrency' is not allowed in a constant expression}}
186
+ unsigned int mc_five[64 ];
187
+
188
+ // expected-error@+1{{'__max_concurrency__' attribute takes one argument}}
189
+ __attribute__ ((__max_concurrency__ (4 ,8 )))
190
+ unsigned int mc_six[64 ];
191
+
138
192
// numbanks
139
193
// expected-error@+2{{attributes are not compatible}}
140
194
__attribute__ ((__numbanks__ (16 )))
@@ -158,7 +212,7 @@ void foo1()
158
212
__attribute__ ((__numbanks__ (15 )))
159
213
unsigned int nb_three[64 ];
160
214
161
- // expected-error@+1{{requires integer constant between 1 and 1048576}}
215
+ // expected-error@+1{{attribute requires integer constant between 1 and 1048576 inclusive }}
162
216
__attribute__ ((__numbanks__ (-4 )))
163
217
unsigned int nb_four[64 ];
164
218
@@ -172,11 +226,24 @@ void foo1()
172
226
__attribute__ ((__numbanks__ (4 ,8 )))
173
227
unsigned int nb_six[64 ];
174
228
175
- // expected-error@+1{{requires integer constant between 1 and 1048576}}
229
+ // expected-error@+1{{'numbanks' attribute requires integer constant between 1 and 1048576 inclusive }}
176
230
__attribute__ ((__numbanks__ (0 )))
177
231
unsigned int nb_seven[64 ];
178
232
}
179
233
234
+ // expected-error@+1{{attribute only applies to local non-const variables and non-static data members}}
235
+ __attribute__ ((__max_concurrency__(8 )))
236
+ __constant unsigned int ext_two[64] = { 1 , 2 , 3 };
237
+
238
+ void other2 ()
239
+ {
240
+ // expected-error@+1{{attribute only applies to local non-const variables and non-static data members}}
241
+ __attribute__ ((__max_concurrency__ (8 ))) const int ext_six[64 ] = { 0 , 1 };
242
+ }
243
+
244
+ // expected-error@+1{{attribute only applies to local non-const variables and non-static data members}}
245
+ void other3 (__attribute__((__max_concurrency__(8 ))) int pfoo) {}
246
+
180
247
struct foo {
181
248
// CHECK: FieldDecl{{.*}}v_two
182
249
// CHECK: IntelFPGAMemoryAttr
@@ -207,6 +274,13 @@ struct foo {
207
274
// CHECK-NEXT: ConstantExpr
208
275
// CHECK-NEXT: IntegerLiteral{{.*}}8{{$}}
209
276
__attribute__ ((__numbanks__(8 ))) unsigned int v_six[64 ];
277
+
278
+ // CHECK: FieldDecl{{.*}}v_seven
279
+ // CHECK: IntelFPGAMemoryAttr{{.*}}Implicit
280
+ // CHECK: IntelFPGAMaxConcurrencyAttr
281
+ // CHECK-NEXT: ConstantExpr
282
+ // CHECK-NEXT: IntegerLiteral{{.*}}4{{$}}
283
+ __attribute__ ((__max_concurrency__(4 ))) unsigned int v_seven[64 ];
210
284
};
211
285
212
286
template <typename name, typename Func>
0 commit comments