6
6
; int i = 0;
7
7
; int m = 42;
8
8
9
- ; [[intelfpga ::ivdep]]
9
+ ; [[intel ::ivdep]]
10
10
; while (i < m) {
11
11
; if (i % 2) {
12
12
; ++i;
15
15
; }
16
16
17
17
; i = 0;
18
- ; [[intelfpga ::ii(2)]]
18
+ ; [[intel ::ii(2)]]
19
19
; while (i < m) {
20
20
; if (i % 3) {
21
21
; ++i;
24
24
; }
25
25
26
26
; i = 0;
27
- ; [[intelfpga ::max_concurrency(4)]]
27
+ ; [[intel ::max_concurrency(4)]]
28
28
; while (i < m) {
29
29
; if (i % 5) {
30
30
; ++i;
33
33
; }
34
34
35
35
; i = 0;
36
- ; [[intelfpga ::ivdep(2)]]
36
+ ; [[intel ::ivdep(2)]]
37
37
; while (true) {
38
38
; if (i % 2) {
39
39
; ++i;
46
46
47
47
; void loop_pipelining() {
48
48
; int a[10];
49
- ; [[intelfpga ::disable_loop_pipelining]]
49
+ ; [[intel ::disable_loop_pipelining]]
50
50
; for (int i = 0; i != 10; ++i)
51
51
; a[i] = 0;
52
52
; }
53
53
54
54
; void loop_coalesce() {
55
55
; int i = 0, m = 42;
56
- ; [[intelfpga ::loop_coalesce(4)]]
56
+ ; [[intel ::loop_coalesce(4)]]
57
57
; while (i < m) {
58
58
; if (i % 2) {
59
59
; ++i;
60
60
; continue;
61
61
; }
62
62
; }
63
63
; i = 0;
64
- ; [[intelfpga ::loop_coalesce]]
64
+ ; [[intel ::loop_coalesce]]
65
65
; while (i < m) {
66
66
; if (i % 3) {
67
67
; ++i;
72
72
73
73
; void max_interleaving() {
74
74
; int a[10];
75
- ; [[intelfpga ::max_interleaving(3)]]
75
+ ; [[intel ::max_interleaving(3)]]
76
76
; for (int i = 0; i != 10; ++i)
77
77
; a[i] = 0;
78
78
; }
79
79
80
80
; void speculated_iterations() {
81
81
; int a[10];
82
- ; [[intelfpga::speculated_iterations(4)]]
82
+ ; [[intel::speculated_iterations(4)]]
83
+ ; for (int i = 0; i != 10; ++i)
84
+ ; a[i] = 0;
85
+ ; }
86
+ ;
87
+ ; void nofusion() {
88
+ ; int a[10];
89
+ ; [[intel::nofusion]]
83
90
; for (int i = 0; i != 10; ++i)
84
91
; a[i] = 0;
85
92
; }
86
93
87
94
; TODO: This source code will result in different LLVM IR after
88
95
; rev [a47242e4b2c1c9] of https://github.com/intel/llvm (the
89
- ; [[intelfpga ::ivdep]] attribute will be represented otherwise).
96
+ ; [[intel ::ivdep]] attribute will be represented otherwise).
90
97
; It's worth factoring out the old representation's translation:
91
98
; (!"llvm.loop.ivdep.*" <-> LoopControlDependency*Mask)
92
99
; into a separate test file
@@ -437,6 +444,40 @@ for.end: ; preds = %for.cond
437
444
ret void
438
445
}
439
446
447
+ ; Function Attrs: noinline nounwind optnone
448
+ define spir_func void @nofusion () #3 {
449
+ entry:
450
+ %a = alloca [10 x i32 ], align 4
451
+ %i = alloca i32 , align 4
452
+ store i32 0 , i32* %i , align 4
453
+ br label %for.cond
454
+
455
+ ; Per SPIR-V spec, LoopControlNoFusionINTELMask = 0x800000 (8388608)
456
+ ; CHECK-SPIRV: 4 LoopMerge {{[0-9]+}} {{[0-9]+}} 8388608
457
+ ; CHECK-SPIRV-NEXT: 4 BranchConditional {{[0-9]+}} {{[0-9]+}} {{[0-9]+}}
458
+ ; CHECK-SPIRV-NEGATIVE-NOT: 4 LoopMerge {{[0-9]+}} {{[0-9]+}} 8388608
459
+ for.cond: ; preds = %for.inc, %entry
460
+ %0 = load i32 , i32* %i , align 4
461
+ %cmp = icmp ne i32 %0 , 10
462
+ br i1 %cmp , label %for.body , label %for.end
463
+
464
+ for.body: ; preds = %for.cond
465
+ %1 = load i32 , i32* %i , align 4
466
+ %idxprom = sext i32 %1 to i64
467
+ %arrayidx = getelementptr inbounds [10 x i32 ], [10 x i32 ]* %a , i64 0 , i64 %idxprom
468
+ store i32 0 , i32* %arrayidx , align 4
469
+ br label %for.inc
470
+
471
+ for.inc: ; preds = %for.body
472
+ %2 = load i32 , i32* %i , align 4
473
+ %inc = add nsw i32 %2 , 1
474
+ store i32 %inc , i32* %i , align 4
475
+ br label %for.cond , !llvm.loop !29
476
+
477
+ for.end: ; preds = %for.cond
478
+ ret void
479
+ }
480
+
440
481
attributes #0 = { "correctly-rounded-divide-sqrt-fp-math" ="false" "disable-tail-calls" ="false" "frame-pointer" ="all" "less-precise-fpmad" ="false" "min-legal-vector-width" ="0" "no-infs-fp-math" ="false" "no-jump-tables" ="false" "no-nans-fp-math" ="false" "no-signed-zeros-fp-math" ="false" "no-trapping-math" ="false" "stack-protector-buffer-size" ="8" "sycl-module-id" ="FPGALoopMergeInst.cpp" "uniform-work-group-size" ="true" "unsafe-fp-math" ="false" "use-soft-float" ="false" }
441
482
attributes #1 = { argmemonly nounwind willreturn }
442
483
attributes #2 = { inlinehint nounwind "correctly-rounded-divide-sqrt-fp-math" ="false" "disable-tail-calls" ="false" "frame-pointer" ="all" "less-precise-fpmad" ="false" "min-legal-vector-width" ="0" "no-infs-fp-math" ="false" "no-jump-tables" ="false" "no-nans-fp-math" ="false" "no-signed-zeros-fp-math" ="false" "no-trapping-math" ="false" "stack-protector-buffer-size" ="8" "unsafe-fp-math" ="false" "use-soft-float" ="false" }
@@ -477,6 +518,8 @@ attributes #4 = { nounwind }
477
518
!26 = !{!"llvm.loop.max_interleaving.count" , i32 3 }
478
519
!27 = distinct !{!27 , !28 }
479
520
!28 = !{!"llvm.loop.intel.speculated.iterations.count" , i32 4 }
521
+ !29 = distinct !{!29 , !30 }
522
+ !30 = !{!"llvm.loop.fusion.disable" }
480
523
481
524
; CHECK-LLVM: br label %while.cond, !llvm.loop ![[MD_A:[0-9]+]]
482
525
; CHECK-LLVM: br label %while.cond{{[0-9]+}}, !llvm.loop ![[MD_B:[0-9]+]]
@@ -487,6 +530,7 @@ attributes #4 = { nounwind }
487
530
; CHECK-LLVM: br label %while.cond{{[0-9]+}}, !llvm.loop ![[MD_G:[0-9]+]]
488
531
; CHECK-LLVM: br label %for.cond{{[0-9]*}}, !llvm.loop ![[MD_H:[0-9]+]]
489
532
; CHECK-LLVM: br label %for.cond{{[0-9]*}}, !llvm.loop ![[MD_I:[0-9]+]]
533
+ ; CHECK-LLVM: br label %for.cond{{[0-9]*}}, !llvm.loop ![[MD_NF:[0-9]+]]
490
534
491
535
; CHECK-LLVM: ![[MD_A]] = distinct !{![[MD_A]], ![[MD_ivdep_enable:[0-9]+]]}
492
536
; CHECK-LLVM: ![[MD_ivdep_enable]] = !{!"llvm.loop.ivdep.enable"}
@@ -507,3 +551,5 @@ attributes #4 = { nounwind }
507
551
; CHECK-LLVM: ![[MD_max_interleaving]] = !{!"llvm.loop.max_interleaving.count", i32 3}
508
552
; CHECK-LLVM: ![[MD_I]] = distinct !{![[MD_I]], ![[MD_spec_iterations:[0-9]+]]}
509
553
; CHECK-LLVM: ![[MD_spec_iterations]] = !{!"llvm.loop.intel.speculated.iterations.count", i32 4}
554
+ ; CHECK-LLVM: ![[MD_NF]] = distinct !{![[MD_NF]], ![[MD_nofusion:[0-9]+]]}
555
+ ; CHECK-LLVM: ![[MD_nofusion]] = !{!"llvm.loop.fusion.disable"}
0 commit comments