Skip to content

Commit 9ee44f0

Browse files
committed
add test for ConstantDataVector lowering
1 parent 905c1e9 commit 9ee44f0

File tree

1 file changed

+52
-0
lines changed
  • llvm/test/Transforms/LowerMatrixIntrinsics

1 file changed

+52
-0
lines changed

llvm/test/Transforms/LowerMatrixIntrinsics/phi.ll

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,58 @@ exit:
215215
ret void
216216
}
217217

218+
define void @matrix_phi_loop_cdv(ptr %in1, ptr %in2, i32 %count, ptr %out) {
219+
; CHECK-LABEL: @matrix_phi_loop_cdv(
220+
; CHECK-NEXT: entry:
221+
; CHECK-NEXT: br label [[LOOP:%.*]]
222+
; CHECK: loop:
223+
; CHECK-NEXT: [[PHI4:%.*]] = phi <3 x double> [ <double 0.000000e+00, double 1.000000e+00, double 2.000000e+00>, [[ENTRY:%.*]] ], [ [[TMP0:%.*]], [[LOOP]] ]
224+
; CHECK-NEXT: [[PHI5:%.*]] = phi <3 x double> [ <double 3.000000e+00, double 4.000000e+00, double 5.000000e+00>, [[ENTRY]] ], [ [[TMP1:%.*]], [[LOOP]] ]
225+
; CHECK-NEXT: [[PHI6:%.*]] = phi <3 x double> [ <double 6.000000e+00, double 7.000000e+00, double 8.000000e+00>, [[ENTRY]] ], [ [[TMP2:%.*]], [[LOOP]] ]
226+
; CHECK-NEXT: [[CTR:%.*]] = phi i32 [ [[COUNT:%.*]], [[ENTRY]] ], [ [[DEC:%.*]], [[LOOP]] ]
227+
; CHECK-NEXT: [[COL_LOAD:%.*]] = load <3 x double>, ptr [[IN2:%.*]], align 128
228+
; CHECK-NEXT: [[VEC_GEP:%.*]] = getelementptr double, ptr [[IN2]], i64 3
229+
; CHECK-NEXT: [[COL_LOAD1:%.*]] = load <3 x double>, ptr [[VEC_GEP]], align 8
230+
; CHECK-NEXT: [[VEC_GEP2:%.*]] = getelementptr double, ptr [[IN2]], i64 6
231+
; CHECK-NEXT: [[COL_LOAD3:%.*]] = load <3 x double>, ptr [[VEC_GEP2]], align 16
232+
; CHECK-NEXT: [[TMP0]] = fadd <3 x double> [[PHI4]], [[COL_LOAD]]
233+
; CHECK-NEXT: [[TMP1]] = fadd <3 x double> [[PHI5]], [[COL_LOAD1]]
234+
; CHECK-NEXT: [[TMP2]] = fadd <3 x double> [[PHI6]], [[COL_LOAD3]]
235+
; CHECK-NEXT: [[DEC]] = sub i32 [[CTR]], 1
236+
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[DEC]], 0
237+
; CHECK-NEXT: br i1 [[CMP]], label [[EXIT:%.*]], label [[LOOP]]
238+
; CHECK: exit:
239+
; CHECK-NEXT: store <3 x double> [[TMP0]], ptr [[OUT:%.*]], align 128
240+
; CHECK-NEXT: [[VEC_GEP7:%.*]] = getelementptr double, ptr [[OUT]], i64 3
241+
; CHECK-NEXT: store <3 x double> [[TMP1]], ptr [[VEC_GEP7]], align 8
242+
; CHECK-NEXT: [[VEC_GEP8:%.*]] = getelementptr double, ptr [[OUT]], i64 6
243+
; CHECK-NEXT: store <3 x double> [[TMP2]], ptr [[VEC_GEP8]], align 16
244+
; CHECK-NEXT: ret void
245+
;
246+
entry:
247+
br label %loop
248+
249+
loop:
250+
%phi = phi <9 x double> [<double 0., double 1., double 2., double 3., double 4., double 5., double 6., double 7., double 8.>, %entry], [%sum, %loop]
251+
%ctr = phi i32 [%count, %entry], [%dec, %loop]
252+
253+
%in2v = load <9 x double>, ptr %in2
254+
255+
; Give in2 the shape: 3 x 3
256+
%in2t = call <9 x double> @llvm.matrix.transpose(<9 x double> %in2v, i32 3, i32 3)
257+
%in2tt = call <9 x double> @llvm.matrix.transpose(<9 x double> %in2t, i32 3, i32 3)
258+
259+
%sum = fadd <9 x double> %phi, %in2tt
260+
261+
%dec = sub i32 %ctr, 1
262+
%cmp = icmp eq i32 %dec, 0
263+
br i1 %cmp, label %exit, label %loop
264+
265+
exit:
266+
store <9 x double> %sum, ptr %out
267+
ret void
268+
}
269+
218270
define <9 x double> @matrix_phi_ifthenelse(i1 %cond, <9 x double> %A, <9 x double> %B, <9 x double> %C) {
219271
; CHECK-LABEL: @matrix_phi_ifthenelse(
220272
; CHECK-NEXT: entry:

0 commit comments

Comments
 (0)