@@ -53,7 +53,22 @@ void foo1()
5353 // CHECK: IntelFPGANumBanksAttr
5454 // CHECK-NEXT: ConstantExpr
5555 // 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 ];
5772
5873 int __attribute__ ((__register__)) A;
5974 int __attribute__ ((__numbanks__ (4 ), __bankwidth__ (16 ))) E;
@@ -77,6 +92,12 @@ void foo1()
7792 // expected-note@-2 {{conflicting attribute is here}}
7893 unsigned int reg_six[64 ];
7994
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+
80101 // expected-error@+2{{attributes are not compatible}}
81102 __attribute__ ((__register__))
82103 __attribute__ ((__numbanks__ (8 )))
@@ -117,7 +138,7 @@ void foo1()
117138 __attribute__ ((__bankwidth__ (3 )))
118139 unsigned int bw_three[64 ];
119140
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 }}
121142 __attribute__ ((__bankwidth__ (-4 )))
122143 unsigned int bw_four[64 ];
123144
@@ -131,10 +152,43 @@ void foo1()
131152 __attribute__ ((__bankwidth__ (4 ,8 )))
132153 unsigned int bw_six[64 ];
133154
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 }}
135156 __attribute__ ((__bankwidth__ (0 )))
136157 unsigned int bw_seven[64 ];
137158
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+
138192 // numbanks
139193 // expected-error@+2{{attributes are not compatible}}
140194 __attribute__ ((__numbanks__ (16 )))
@@ -158,7 +212,7 @@ void foo1()
158212 __attribute__ ((__numbanks__ (15 )))
159213 unsigned int nb_three[64 ];
160214
161- // expected-error@+1{{requires integer constant between 1 and 1048576}}
215+ // expected-error@+1{{attribute requires integer constant between 1 and 1048576 inclusive }}
162216 __attribute__ ((__numbanks__ (-4 )))
163217 unsigned int nb_four[64 ];
164218
@@ -172,11 +226,24 @@ void foo1()
172226 __attribute__ ((__numbanks__ (4 ,8 )))
173227 unsigned int nb_six[64 ];
174228
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 }}
176230 __attribute__ ((__numbanks__ (0 )))
177231 unsigned int nb_seven[64 ];
178232}
179233
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+
180247struct foo {
181248 // CHECK: FieldDecl{{.*}}v_two
182249 // CHECK: IntelFPGAMemoryAttr
@@ -207,6 +274,13 @@ struct foo {
207274 // CHECK-NEXT: ConstantExpr
208275 // CHECK-NEXT: IntegerLiteral{{.*}}8{{$}}
209276 __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 ];
210284};
211285
212286template <typename name, typename Func>
0 commit comments