blob: 30c134233b5389073da37f9e35245f949bb9100c [file] [log] [blame]
Yaxun Liuc41e2f62017-12-15 03:56:57 +00001; RUN: llc -mtriple=amdgcn-amd-amdhsa-amdgizcl -verify-machineinstrs < %s | FileCheck %s
2
3%struct.wombat = type { [4 x i32], [4 x i32], [4 x i32] }
4
5define amdgpu_kernel void @wobble(i8 addrspace(1)* nocapture readonly %arg) #0 !dbg !4 {
6bb:
7 %tmp = load i32, i32 addrspace(1)* undef, align 4
8 %tmp1 = load <4 x float>, <4 x float> addrspace(1)* undef, align 16
9 %tmp2 = sext i32 %tmp to i64
10 %tmp3 = shufflevector <4 x float> undef, <4 x float> %tmp1, <2 x i32> <i32 3, i32 7>
11 %tmp4 = call float @barney() #2
12 %tmp5 = getelementptr inbounds i8, i8 addrspace(1)* %arg, i64 0
13 %tmp6 = bitcast i8 addrspace(1)* %tmp5 to <2 x float> addrspace(1)*
14 %tmp7 = getelementptr inbounds i8, i8 addrspace(1)* %arg, i64 0
15 %tmp8 = bitcast i8 addrspace(1)* %tmp7 to %struct.wombat addrspace(1)*
16 %tmp9 = getelementptr inbounds %struct.wombat, %struct.wombat addrspace(1)* %tmp8, i64 %tmp2, i32 2, i64 0
17 %tmp10 = load i32, i32 addrspace(1)* %tmp9, align 4
18 %tmp11 = sext i32 %tmp10 to i64
19 %tmp12 = getelementptr inbounds <2 x float>, <2 x float> addrspace(1)* %tmp6, i64 %tmp11
20 %tmp13 = bitcast <2 x float> addrspace(1)* %tmp12 to i64 addrspace(1)*
21 %tmp14 = getelementptr inbounds i8, i8 addrspace(1)* %arg, i64 undef
22 %tmp15 = bitcast i8 addrspace(1)* %tmp14 to <4 x float> addrspace(1)*
23 %tmp16 = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %tmp15, i64 undef
24 %tmp17 = load <4 x float>, <4 x float> addrspace(1)* %tmp16, align 16
25 %tmp18 = fsub <4 x float> undef, %tmp17
26 %tmp19 = fadd float undef, 0.000000e+00
27 %tmp20 = fcmp oeq float %tmp19, 0.000000e+00
28 br i1 %tmp20, label %bb21, label %bb25
29
30bb21: ; preds = %bb
31 %tmp22 = fmul <4 x float> %tmp18, undef
32 %tmp23 = fadd <4 x float> undef, %tmp22
33 %tmp24 = fmul <4 x float> undef, undef
34 br label %bb28
35
36bb25: ; preds = %bb
37 %tmp26 = insertelement <4 x float> undef, float 0.000000e+00, i32 1
38 %tmp27 = insertelement <4 x float> %tmp26, float undef, i32 2
39 br label %bb28
40
41bb28: ; preds = %bb25, %bb21
42 %tmp29 = phi <4 x float> [ %tmp27, %bb25 ], [ %tmp24, %bb21 ]
43 store <4 x float> %tmp29, <4 x float> addrspace(5)* undef, align 16
44 %tmp30 = getelementptr inbounds %struct.wombat, %struct.wombat addrspace(1)* %tmp8, i64 %tmp2, i32 2, i64 2
45 %tmp31 = load i32, i32 addrspace(1)* %tmp30, align 4
46 %tmp32 = sext i32 %tmp31 to i64
47 %tmp33 = getelementptr inbounds <2 x float>, <2 x float> addrspace(1)* %tmp6, i64 %tmp32
48 %tmp34 = bitcast <2 x float> addrspace(1)* %tmp33 to i64 addrspace(1)*
49 %tmp35 = load i64, i64 addrspace(1)* %tmp34, align 8
50 %tmp36 = load i32, i32 addrspace(1)* undef, align 4
51 %tmp37 = sext i32 %tmp36 to i64
52 %tmp38 = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* null, i64 %tmp37
53 %tmp39 = load <4 x float>, <4 x float> addrspace(1)* %tmp38, align 16
54 %tmp40 = load <4 x float>, <4 x float> addrspace(1)* undef, align 16
55 %tmp41 = fsub <4 x float> zeroinitializer, %tmp40
56 %tmp42 = fsub <4 x float> %tmp39, %tmp40
57 %tmp43 = extractelement <4 x float> %tmp40, i32 1
58 %tmp44 = fsub float %tmp43, undef
59 %tmp45 = fadd float undef, undef
60 %tmp46 = fdiv float %tmp44, %tmp45
61 %tmp47 = insertelement <4 x float> undef, float %tmp46, i32 0
62 %tmp48 = shufflevector <4 x float> %tmp47, <4 x float> undef, <4 x i32> zeroinitializer
63 %tmp49 = fsub <4 x float> %tmp48, %tmp40
64 %tmp50 = extractelement <4 x float> %tmp41, i32 1
65 %tmp51 = extractelement <4 x float> %tmp42, i32 2
66 %tmp52 = fmul float undef, undef
67 %tmp53 = fadd float %tmp52, undef
68 %tmp54 = fadd float %tmp51, %tmp53
69 %tmp55 = extractelement <4 x float> %tmp49, i32 1
70 %tmp56 = fmul float %tmp55, %tmp50
71 %tmp57 = fmul float %tmp54, %tmp56
72 %tmp58 = fdiv float %tmp57, 0.000000e+00
73 ; CHECK: ;DEBUG_VALUE: foo:var <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef]
74 call void @llvm.dbg.value(metadata <4 x float> %tmp29, metadata !3, metadata !DIExpression(DW_OP_constu, 1, DW_OP_swap, DW_OP_xderef)) #2, !dbg !5
75 %tmp59 = bitcast i64 %tmp35 to <2 x float>
76 %tmp60 = insertelement <2 x float> undef, float %tmp58, i32 0
77 %tmp61 = shufflevector <2 x float> %tmp60, <2 x float> undef, <2 x i32> zeroinitializer
78 %tmp62 = fmul <2 x float> %tmp61, undef
79 %tmp63 = fsub <2 x float> %tmp62, %tmp59
80 %tmp64 = extractelement <2 x float> %tmp63, i64 0
81 call void @eggs(float %tmp64) #2
82 store <2 x float> %tmp3, <2 x float> addrspace(1)* undef, align 8
83 store float 0.000000e+00, float addrspace(1)* undef, align 4
84 ret void
85}
86
87declare float @barney() #2
88declare void @eggs(float) #2
89declare void @llvm.dbg.value(metadata, metadata, metadata) #1
90
91attributes #0 = { convergent nounwind "target-cpu"="gfx900" "target-features"="+fp32-denormals" }
92attributes #1 = { nounwind readnone speculatable }
93attributes #2 = { nounwind }
94
95!llvm.dbg.cu = !{!0}
96!llvm.module.flags = !{!2}
97
98!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
99!1 = !DIFile(filename: "foo.cl", directory: "/tmp")
100!2 = !{i32 2, !"Debug Info Version", i32 3}
101!3 = !DILocalVariable(name: "var", arg: 8, scope: !4)
102!4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, type: !12, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0)
103!5 = !DILocation(line: 69, scope: !4)
104!12 = !DISubroutineType(types: !13)
105!13 = !{null, !14}
106!14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)