@@ -23,7 +23,9 @@ void foo() {
23
23
// expected-error@+1 {{'nofusion' attribute cannot be applied to a declaration}}
24
24
[[intel::nofusion]] int k[10 ];
25
25
// expected-error@+1{{'loop_count_avg' attribute cannot be applied to a declaration}}
26
- [[intel::loop_count_avg (6 )]] int p[10 ];
26
+ [[intel::loop_count_avg (6 )]] int l[10 ];
27
+ // expected-error@+1{{'loop_count' attribute cannot be applied to a declaration}}
28
+ [[intel::loop_count (8 )]] int m[10 ];
27
29
}
28
30
29
31
// Test for deprecated spelling of Intel FPGA loop attributes
@@ -115,7 +117,10 @@ void boo() {
115
117
[[intel::nofusion (0 )]] for (int i = 0 ; i != 10 ; ++i)
116
118
a[i] = 0 ;
117
119
// expected-error@+1 {{'loop_count_avg' attribute takes one argument}}
118
- [[intel::loop_count_avg (3 , 6 )]] for (int i = 0 ; i != 10 ; ++i)
120
+ [[intel::loop_count_avg (3 , 6 )]] for (int i = 0 ; i != 10 ; ++i)
121
+ a[i] = 0 ;
122
+ // expected-error@+1 {{'loop_count' attribute takes one argument}}
123
+ [[intel::loop_count (6 , 9 )]] for (int i = 0 ; i != 10 ; ++i)
119
124
a[i] = 0 ;
120
125
}
121
126
@@ -203,6 +208,14 @@ void goo() {
203
208
// expected-error@+1 {{integral constant expression must have integral or unscoped enumeration type, not 'const char[4]'}}
204
209
[[intel::loop_count_avg (" abc" )]] for (int i = 0 ; i != 10 ; ++i)
205
210
a[i] = 0 ;
211
+ // expected-error@+1 {{integral constant expression must have integral or unscoped enumeration type, not 'const char[4]'}}
212
+ [[intel::loop_count (" abc" )]] for (int i = 0 ; i != 10 ; ++i)
213
+ a[i] = 0 ;
214
+ [[intel::loop_count (0 )]] for (int i = 0 ; i != 10 ; ++i)
215
+ a[i] = 0 ;
216
+ // expected-error@+1 {{'loop_count' attribute requires a non-negative integral compile time constant expression}}
217
+ [[intel::loop_count (-1 )]] for (int i = 0 ; i != 10 ; ++i)
218
+ a[i] = 0 ;
206
219
}
207
220
208
221
// Test for Intel FPGA loop attributes duplication
@@ -316,6 +329,11 @@ void zoo() {
316
329
// expected-error@+1{{duplicate Intel FPGA loop attribute 'loop_count_avg'}}
317
330
[[intel::loop_count_avg (2 )]] for (int i = 0 ; i != 10 ; ++i)
318
331
a[i] = 0 ;
332
+
333
+ [[intel::loop_count (2 )]]
334
+ // expected-error@+1{{duplicate Intel FPGA loop attribute 'loop_count'}}
335
+ [[intel::loop_count (2 )]] for (int i = 0 ; i != 10 ; ++i)
336
+ a[i] = 0 ;
319
337
}
320
338
321
339
// Test for Intel FPGA loop attributes compatibility
@@ -365,6 +383,8 @@ void loop_attrs_compatibility() {
365
383
[[intel::loop_count_max (8 )]]
366
384
for (int i = 0 ; i != 10 ; ++i)
367
385
a[i] = 0 ;
386
+ [[intel::loop_count (8 )]] for (int i = 0 ; i != 10 ; ++i)
387
+ a[i] = 0 ;
368
388
}
369
389
370
390
template <int A, int B, int C>
@@ -499,6 +519,10 @@ void loop_count_control_dependent() {
499
519
for (int i = 0 ; i != 10 ; ++i)
500
520
a[i] = 0 ;
501
521
522
+ // expected-error@+1{{'loop_count' attribute requires a non-negative integral compile time constant expression}}
523
+ [[intel::loop_count (C)]] for (int i = 0 ; i != 10 ; ++i)
524
+ a[i] = 0 ;
525
+
502
526
[[intel::loop_count_avg (A)]]
503
527
// expected-error@+1{{duplicate Intel FPGA loop attribute 'loop_count_avg'}}
504
528
[[intel::loop_count_avg (B)]] for (int i = 0 ; i != 10 ; ++i)
@@ -514,6 +538,10 @@ void loop_count_control_dependent() {
514
538
[[intel::loop_count_max (B)]] for (int i = 0 ; i != 10 ; ++i)
515
539
a[i] = 0 ;
516
540
541
+ [[intel::loop_count (A)]]
542
+ // expected-error@+1{{duplicate Intel FPGA loop attribute 'loop_count'}}
543
+ [[intel::loop_count (B)]] for (int i = 0 ; i != 10 ; ++i)
544
+ a[i] = 0 ;
517
545
}
518
546
519
547
void check_max_concurrency_expression () {
@@ -648,6 +676,11 @@ void check_loop_attr_template_instantiation() {
648
676
// expected-error@+1 {{integral constant expression must have integral or unscoped enumeration type, not 'float'}}
649
677
[[intel::loop_count_min (Ty{})]] for (int i = 0 ; i != 10 ; ++i)
650
678
a[i] = 0 ;
679
+
680
+ // expected-error@+2 {{integral constant expression must have integral or unscoped enumeration type, not 'S'}}
681
+ // expected-error@+1 {{integral constant expression must have integral or unscoped enumeration type, not 'float'}}
682
+ [[intel::loop_count (Ty{})]] for (int i = 0 ; i != 10 ; ++i)
683
+ a[i] = 0 ;
651
684
}
652
685
653
686
int main () {
0 commit comments