Mercurial > hg > CbC > CbC_llvm
comparison llvm/test/Transforms/LoopDistribute/basic.ll @ 252:1f2b6ac9f198 llvm-original
LLVM16-1
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Aug 2023 09:04:13 +0900 |
parents | c4bab56944e8 |
children |
comparison
equal
deleted
inserted
replaced
237:c80f45b162ad | 252:1f2b6ac9f198 |
---|---|
17 | 17 |
18 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" | 18 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |
19 target triple = "x86_64-apple-macosx10.10.0" | 19 target triple = "x86_64-apple-macosx10.10.0" |
20 | 20 |
21 ; CHECK-LABEL: @f( | 21 ; CHECK-LABEL: @f( |
22 define void @f(i32* noalias %a, | 22 define void @f(ptr noalias %a, |
23 i32* noalias %b, | 23 ptr noalias %b, |
24 i32* noalias %c, | 24 ptr noalias %c, |
25 i32* noalias %d, | 25 ptr noalias %d, |
26 i32* noalias %e) { | 26 ptr noalias %e) { |
27 entry: | 27 entry: |
28 br label %for.body | 28 br label %for.body |
29 | 29 |
30 ; Verify the two distributed loops. | 30 ; Verify the two distributed loops. |
31 | 31 |
51 ; VECTORIZE: mul <4 x i32> | 51 ; VECTORIZE: mul <4 x i32> |
52 | 52 |
53 for.body: ; preds = %for.body, %entry | 53 for.body: ; preds = %for.body, %entry |
54 %ind = phi i64 [ 0, %entry ], [ %add, %for.body ] | 54 %ind = phi i64 [ 0, %entry ], [ %add, %for.body ] |
55 | 55 |
56 %arrayidxA = getelementptr inbounds i32, i32* %a, i64 %ind | 56 %arrayidxA = getelementptr inbounds i32, ptr %a, i64 %ind |
57 %loadA = load i32, i32* %arrayidxA, align 4 | 57 %loadA = load i32, ptr %arrayidxA, align 4 |
58 | 58 |
59 %arrayidxB = getelementptr inbounds i32, i32* %b, i64 %ind | 59 %arrayidxB = getelementptr inbounds i32, ptr %b, i64 %ind |
60 %loadB = load i32, i32* %arrayidxB, align 4 | 60 %loadB = load i32, ptr %arrayidxB, align 4 |
61 | 61 |
62 %mulA = mul i32 %loadB, %loadA | 62 %mulA = mul i32 %loadB, %loadA |
63 | 63 |
64 %add = add nuw nsw i64 %ind, 1 | 64 %add = add nuw nsw i64 %ind, 1 |
65 %arrayidxA_plus_4 = getelementptr inbounds i32, i32* %a, i64 %add | 65 %arrayidxA_plus_4 = getelementptr inbounds i32, ptr %a, i64 %add |
66 store i32 %mulA, i32* %arrayidxA_plus_4, align 4 | 66 store i32 %mulA, ptr %arrayidxA_plus_4, align 4 |
67 | 67 |
68 %arrayidxD = getelementptr inbounds i32, i32* %d, i64 %ind | 68 %arrayidxD = getelementptr inbounds i32, ptr %d, i64 %ind |
69 %loadD = load i32, i32* %arrayidxD, align 4 | 69 %loadD = load i32, ptr %arrayidxD, align 4 |
70 | 70 |
71 %arrayidxE = getelementptr inbounds i32, i32* %e, i64 %ind | 71 %arrayidxE = getelementptr inbounds i32, ptr %e, i64 %ind |
72 %loadE = load i32, i32* %arrayidxE, align 4 | 72 %loadE = load i32, ptr %arrayidxE, align 4 |
73 | 73 |
74 %mulC = mul i32 %loadD, %loadE | 74 %mulC = mul i32 %loadD, %loadE |
75 | 75 |
76 %arrayidxC = getelementptr inbounds i32, i32* %c, i64 %ind | 76 %arrayidxC = getelementptr inbounds i32, ptr %c, i64 %ind |
77 store i32 %mulC, i32* %arrayidxC, align 4 | 77 store i32 %mulC, ptr %arrayidxC, align 4 |
78 | 78 |
79 %exitcond = icmp eq i64 %add, 20 | 79 %exitcond = icmp eq i64 %add, 20 |
80 br i1 %exitcond, label %for.end, label %for.body | 80 br i1 %exitcond, label %for.end, label %for.body |
81 | 81 |
82 for.end: ; preds = %for.body | 82 for.end: ; preds = %for.body |
86 declare i32 @llvm.convergent(i32) #0 | 86 declare i32 @llvm.convergent(i32) #0 |
87 | 87 |
88 ; It is OK to distribute with a convergent operation, since in each | 88 ; It is OK to distribute with a convergent operation, since in each |
89 ; new loop the convergent operation has the ssame control dependency. | 89 ; new loop the convergent operation has the ssame control dependency. |
90 ; CHECK-LABEL: @f_with_convergent( | 90 ; CHECK-LABEL: @f_with_convergent( |
91 define void @f_with_convergent(i32* noalias %a, | 91 define void @f_with_convergent(ptr noalias %a, |
92 i32* noalias %b, | 92 ptr noalias %b, |
93 i32* noalias %c, | 93 ptr noalias %c, |
94 i32* noalias %d, | 94 ptr noalias %d, |
95 i32* noalias %e) { | 95 ptr noalias %e) { |
96 entry: | 96 entry: |
97 br label %for.body | 97 br label %for.body |
98 | 98 |
99 ; Verify the two distributed loops. | 99 ; Verify the two distributed loops. |
100 | 100 |
123 ; VECTORIZE: mul i32 | 123 ; VECTORIZE: mul i32 |
124 | 124 |
125 for.body: ; preds = %for.body, %entry | 125 for.body: ; preds = %for.body, %entry |
126 %ind = phi i64 [ 0, %entry ], [ %add, %for.body ] | 126 %ind = phi i64 [ 0, %entry ], [ %add, %for.body ] |
127 | 127 |
128 %arrayidxA = getelementptr inbounds i32, i32* %a, i64 %ind | 128 %arrayidxA = getelementptr inbounds i32, ptr %a, i64 %ind |
129 %loadA = load i32, i32* %arrayidxA, align 4 | 129 %loadA = load i32, ptr %arrayidxA, align 4 |
130 | 130 |
131 %arrayidxB = getelementptr inbounds i32, i32* %b, i64 %ind | 131 %arrayidxB = getelementptr inbounds i32, ptr %b, i64 %ind |
132 %loadB = load i32, i32* %arrayidxB, align 4 | 132 %loadB = load i32, ptr %arrayidxB, align 4 |
133 | 133 |
134 %mulA = mul i32 %loadB, %loadA | 134 %mulA = mul i32 %loadB, %loadA |
135 | 135 |
136 %add = add nuw nsw i64 %ind, 1 | 136 %add = add nuw nsw i64 %ind, 1 |
137 %arrayidxA_plus_4 = getelementptr inbounds i32, i32* %a, i64 %add | 137 %arrayidxA_plus_4 = getelementptr inbounds i32, ptr %a, i64 %add |
138 store i32 %mulA, i32* %arrayidxA_plus_4, align 4 | 138 store i32 %mulA, ptr %arrayidxA_plus_4, align 4 |
139 | 139 |
140 %arrayidxD = getelementptr inbounds i32, i32* %d, i64 %ind | 140 %arrayidxD = getelementptr inbounds i32, ptr %d, i64 %ind |
141 %loadD = load i32, i32* %arrayidxD, align 4 | 141 %loadD = load i32, ptr %arrayidxD, align 4 |
142 | 142 |
143 %arrayidxE = getelementptr inbounds i32, i32* %e, i64 %ind | 143 %arrayidxE = getelementptr inbounds i32, ptr %e, i64 %ind |
144 %loadE = load i32, i32* %arrayidxE, align 4 | 144 %loadE = load i32, ptr %arrayidxE, align 4 |
145 | 145 |
146 %convergentD = call i32 @llvm.convergent(i32 %loadD) | 146 %convergentD = call i32 @llvm.convergent(i32 %loadD) |
147 %mulC = mul i32 %convergentD, %loadE | 147 %mulC = mul i32 %convergentD, %loadE |
148 | 148 |
149 %arrayidxC = getelementptr inbounds i32, i32* %c, i64 %ind | 149 %arrayidxC = getelementptr inbounds i32, ptr %c, i64 %ind |
150 store i32 %mulC, i32* %arrayidxC, align 4 | 150 store i32 %mulC, ptr %arrayidxC, align 4 |
151 | 151 |
152 %exitcond = icmp eq i64 %add, 20 | 152 %exitcond = icmp eq i64 %add, 20 |
153 br i1 %exitcond, label %for.end, label %for.body | 153 br i1 %exitcond, label %for.end, label %for.body |
154 | 154 |
155 for.end: ; preds = %for.body | 155 for.end: ; preds = %for.body |