blob: 19c58155ec0c4288ed131514309ab0a8fc94dd5b [file] [log] [blame]
Nicolai Haehnle02c32912016-01-13 16:10:10 +00001; RUN: llc -march=amdgcn -mcpu=SI --misched=si < %s | FileCheck %s
2
3; The test checks the "si" machine scheduler pass works correctly.
4
5; CHECK-LABEL: {{^}}main:
6; CHECK: s_wqm
7; CHECK: s_load_dwordx4
8; CHECK: s_load_dwordx8
9; CHECK: s_waitcnt lgkmcnt(0)
10; CHECK: image_sample
11; CHECK: s_waitcnt vmcnt(0)
12; CHECK: exp
13; CHECK: s_endpgm
Matt Arsenault325cca32016-01-23 05:42:43 +000014define void @main([6 x <16 x i8>] addrspace(2)* byval %arg, [17 x <16 x i8>] addrspace(2)* byval %arg1, [17 x <4 x i32>] addrspace(2)* byval %arg2, [34 x <8 x i32>] addrspace(2)* byval %arg3, float inreg %arg4, i32 inreg %arg5, <2 x i32> %arg6, <2 x i32> %arg7, <2 x i32> %arg8, <3 x i32> %arg9, <2 x i32> %arg10, <2 x i32> %arg11, <2 x i32> %arg12, float %arg13, float %arg14, float %arg15, float %arg16, float %arg17, float %arg18, i32 %arg19, float %arg20, float %arg21) #0 {
Nicolai Haehnle02c32912016-01-13 16:10:10 +000015main_body:
Matt Arsenault325cca32016-01-23 05:42:43 +000016 %tmp = bitcast [34 x <8 x i32>] addrspace(2)* %arg3 to <32 x i8> addrspace(2)*
17 %tmp22 = load <32 x i8>, <32 x i8> addrspace(2)* %tmp, align 32, !tbaa !0
18 %tmp23 = bitcast [17 x <4 x i32>] addrspace(2)* %arg2 to <16 x i8> addrspace(2)*
19 %tmp24 = load <16 x i8>, <16 x i8> addrspace(2)* %tmp23, align 16, !tbaa !0
20 %tmp25 = call float @llvm.SI.fs.interp(i32 0, i32 0, i32 %arg5, <2 x i32> %arg11)
21 %tmp26 = call float @llvm.SI.fs.interp(i32 1, i32 0, i32 %arg5, <2 x i32> %arg11)
22 %tmp27 = bitcast float %tmp25 to i32
23 %tmp28 = bitcast float %tmp26 to i32
24 %tmp29 = insertelement <2 x i32> undef, i32 %tmp27, i32 0
25 %tmp30 = insertelement <2 x i32> %tmp29, i32 %tmp28, i32 1
Matt Arsenault018179f2016-01-26 04:38:08 +000026 %tmp22.bc = bitcast <32 x i8> %tmp22 to <8 x i32>
27 %tmp24.bc = bitcast <16 x i8> %tmp24 to <4 x i32>
28 %tmp31 = call <4 x float> @llvm.SI.image.sample.v2i32(<2 x i32> %tmp30, <8 x i32> %tmp22.bc, <4 x i32> %tmp24.bc, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
Matt Arsenault325cca32016-01-23 05:42:43 +000029 %tmp32 = extractelement <4 x float> %tmp31, i32 0
30 %tmp33 = extractelement <4 x float> %tmp31, i32 1
31 %tmp34 = extractelement <4 x float> %tmp31, i32 2
32 %tmp35 = extractelement <4 x float> %tmp31, i32 3
33 %tmp36 = call i32 @llvm.SI.packf16(float %tmp32, float %tmp33)
34 %tmp37 = bitcast i32 %tmp36 to float
35 %tmp38 = call i32 @llvm.SI.packf16(float %tmp34, float %tmp35)
36 %tmp39 = bitcast i32 %tmp38 to float
37 call void @llvm.SI.export(i32 15, i32 1, i32 1, i32 0, i32 1, float %tmp37, float %tmp39, float %tmp37, float %tmp39)
Nicolai Haehnle02c32912016-01-13 16:10:10 +000038 ret void
39}
40
41; Function Attrs: nounwind readnone
42declare float @llvm.SI.fs.interp(i32, i32, i32, <2 x i32>) #1
43
Matt Arsenault018179f2016-01-26 04:38:08 +000044declare <4 x float> @llvm.SI.image.sample.v2i32(<2 x i32>, <8 x i32>, <4 x i32>, i32, i32, i32, i32, i32, i32, i32, i32) #1
45
Nicolai Haehnle02c32912016-01-13 16:10:10 +000046
47; Function Attrs: nounwind readnone
48declare i32 @llvm.SI.packf16(float, float) #1
49
50declare void @llvm.SI.export(i32, i32, i32, i32, i32, float, float, float, float)
51
52attributes #0 = { "ShaderType"="0" "enable-no-nans-fp-math"="true" }
53attributes #1 = { nounwind readnone }
54
Matt Arsenault325cca32016-01-23 05:42:43 +000055!0 = !{!1, !1, i64 0, i32 1}
56!1 = !{!"const", null}