1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck -check-prefix=GCN %s
3 ; Make sure dbg_value reports something for argument registers when they are split into multiple registers
5 define hidden <4 x float> @split_v4f32_arg(<4 x float> returned %arg) local_unnamed_addr #0 !dbg !7 {
6 ; GCN-LABEL: split_v4f32_arg:
9 ; GCN-NEXT: .loc 0 3 0 ; /tmp/dbg.cl:3:0
11 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13 ; GCN-NEXT: ;DEBUG_VALUE: split_v4f32_arg:arg <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 96 32] $vgpr3
14 ; GCN-NEXT: ;DEBUG_VALUE: split_v4f32_arg:arg <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 64 32] $vgpr2
15 ; GCN-NEXT: ;DEBUG_VALUE: split_v4f32_arg:arg <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 32 32] $vgpr1
16 ; GCN-NEXT: ;DEBUG_VALUE: split_v4f32_arg:arg <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 0 32] $vgpr0
17 ; GCN-NEXT: .loc 0 4 5 prologue_end ; /tmp/dbg.cl:4:5
18 ; GCN-NEXT: s_setpc_b64 s[30:31]
20 call void @llvm.dbg.value(metadata <4 x float> %arg, metadata !18, metadata !DIExpression(DW_OP_constu, 1, DW_OP_swap, DW_OP_xderef)), !dbg !19
21 ret <4 x float> %arg, !dbg !20
24 define hidden <4 x float> @split_v4f32_multi_arg(<4 x float> %arg0, <2 x float> %arg1) local_unnamed_addr #0 !dbg !21 {
25 ; GCN-LABEL: split_v4f32_multi_arg:
27 ; GCN-NEXT: .loc 0 7 0 ; /tmp/dbg.cl:7:0
29 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
31 ; GCN-NEXT: ;DEBUG_VALUE: split_v4f32_multi_arg:arg1 <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 32 32] $vgpr5
32 ; GCN-NEXT: ;DEBUG_VALUE: split_v4f32_multi_arg:arg1 <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 0 32] $vgpr4
33 ; GCN-NEXT: ;DEBUG_VALUE: split_v4f32_multi_arg:arg0 <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 96 32] $vgpr3
34 ; GCN-NEXT: ;DEBUG_VALUE: split_v4f32_multi_arg:arg0 <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 64 32] $vgpr2
35 ; GCN-NEXT: ;DEBUG_VALUE: split_v4f32_multi_arg:arg0 <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 32 32] $vgpr1
36 ; GCN-NEXT: ;DEBUG_VALUE: split_v4f32_multi_arg:arg0 <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 0 32] $vgpr0
37 ; GCN-NEXT: .loc 0 8 17 prologue_end ; /tmp/dbg.cl:8:17
38 ; GCN-NEXT: v_add_f32_e32 v0, v4, v0
40 ; GCN-NEXT: v_add_f32_e32 v1, v5, v1
42 ; GCN-NEXT: v_add_f32_e32 v2, v4, v2
44 ; GCN-NEXT: v_add_f32_e32 v3, v5, v3
46 ; GCN-NEXT: .loc 0 8 5 is_stmt 0 ; /tmp/dbg.cl:8:5
47 ; GCN-NEXT: s_setpc_b64 s[30:31]
49 call void @llvm.dbg.value(metadata <4 x float> %arg0, metadata !29, metadata !DIExpression(DW_OP_constu, 1, DW_OP_swap, DW_OP_xderef)), !dbg !31
50 call void @llvm.dbg.value(metadata <2 x float> %arg1, metadata !30, metadata !DIExpression(DW_OP_constu, 1, DW_OP_swap, DW_OP_xderef)), !dbg !31
51 %tmp = shufflevector <2 x float> %arg1, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>, !dbg !32
52 %add = fadd <4 x float> %tmp, %arg0, !dbg !33
53 ret <4 x float> %add, !dbg !34
56 define hidden <4 x half> @split_v4f16_arg(<4 x half> returned %arg) local_unnamed_addr #0 !dbg !35 {
57 ; GCN-LABEL: split_v4f16_arg:
59 ; GCN-NEXT: .loc 0 11 0 is_stmt 1 ; /tmp/dbg.cl:11:0
61 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
63 ; GCN-NEXT: ;DEBUG_VALUE: split_v4f16_arg:arg <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 32 32] $vgpr1
64 ; GCN-NEXT: ;DEBUG_VALUE: split_v4f16_arg:arg <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 0 32] $vgpr0
65 ; GCN-NEXT: .loc 0 12 5 prologue_end ; /tmp/dbg.cl:12:5
66 ; GCN-NEXT: s_setpc_b64 s[30:31]
68 call void @llvm.dbg.value(metadata <4 x half> %arg, metadata !42, metadata !DIExpression(DW_OP_constu, 1, DW_OP_swap, DW_OP_xderef)), !dbg !43
69 ret <4 x half> %arg, !dbg !44
72 define hidden double @split_f64_arg(double returned %arg) local_unnamed_addr #0 !dbg !45 {
73 ; GCN-LABEL: split_f64_arg:
75 ; GCN-NEXT: .loc 0 15 0 ; /tmp/dbg.cl:15:0
77 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
79 ; GCN-NEXT: ;DEBUG_VALUE: split_f64_arg:arg <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 32 32] $vgpr1
80 ; GCN-NEXT: ;DEBUG_VALUE: split_f64_arg:arg <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 0 32] $vgpr0
81 ; GCN-NEXT: .loc 0 16 5 prologue_end ; /tmp/dbg.cl:16:5
82 ; GCN-NEXT: s_setpc_b64 s[30:31]
84 call void @llvm.dbg.value(metadata double %arg, metadata !50, metadata !DIExpression(DW_OP_constu, 1, DW_OP_swap, DW_OP_xderef)), !dbg !51
85 ret double %arg, !dbg !52
88 define hidden <2 x double> @split_v2f64_arg(<2 x double> returned %arg) local_unnamed_addr #0 !dbg !53 {
89 ; GCN-LABEL: split_v2f64_arg:
91 ; GCN-NEXT: .loc 0 19 0 ; /tmp/dbg.cl:19:0
93 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
95 ; GCN-NEXT: ;DEBUG_VALUE: split_v2f64_arg:arg <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 96 32] $vgpr3
96 ; GCN-NEXT: ;DEBUG_VALUE: split_v2f64_arg:arg <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 64 32] $vgpr2
97 ; GCN-NEXT: ;DEBUG_VALUE: split_v2f64_arg:arg <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 32 32] $vgpr1
98 ; GCN-NEXT: ;DEBUG_VALUE: split_v2f64_arg:arg <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 0 32] $vgpr0
99 ; GCN-NEXT: .loc 0 20 5 prologue_end ; /tmp/dbg.cl:20:5
100 ; GCN-NEXT: s_setpc_b64 s[30:31]
102 call void @llvm.dbg.value(metadata <2 x double> %arg, metadata !59, metadata !DIExpression(DW_OP_constu, 1, DW_OP_swap, DW_OP_xderef)), !dbg !60
103 ret <2 x double> %arg, !dbg !61
106 define hidden i64 @split_i64_arg(i64 returned %arg) local_unnamed_addr #0 !dbg !62 {
107 ; GCN-LABEL: split_i64_arg:
108 ; GCN: .Lfunc_begin5:
109 ; GCN-NEXT: .loc 0 23 0 ; /tmp/dbg.cl:23:0
111 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
113 ; GCN-NEXT: ;DEBUG_VALUE: split_i64_arg:arg <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 32 32] $vgpr1
114 ; GCN-NEXT: ;DEBUG_VALUE: split_i64_arg:arg <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 0 32] $vgpr0
115 ; GCN-NEXT: .loc 0 24 5 prologue_end ; /tmp/dbg.cl:24:5
116 ; GCN-NEXT: s_setpc_b64 s[30:31]
118 call void @llvm.dbg.value(metadata i64 %arg, metadata !67, metadata !DIExpression(DW_OP_constu, 1, DW_OP_swap, DW_OP_xderef)), !dbg !68
119 ret i64 %arg, !dbg !69
122 define hidden i8 addrspace(1)* @split_ptr_arg(i8 addrspace(1)* readnone returned %arg) local_unnamed_addr #0 !dbg !70 {
123 ; GCN-LABEL: split_ptr_arg:
124 ; GCN: .Lfunc_begin6:
125 ; GCN-NEXT: .loc 0 27 0 ; /tmp/dbg.cl:27:0
127 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
129 ; GCN-NEXT: ;DEBUG_VALUE: split_ptr_arg:arg <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 32 32] $vgpr1
130 ; GCN-NEXT: ;DEBUG_VALUE: split_ptr_arg:arg <- [DW_OP_constu 1, DW_OP_swap, DW_OP_xderef, DW_OP_LLVM_fragment 0 32] $vgpr0
131 ; GCN-NEXT: .loc 0 28 5 prologue_end ; /tmp/dbg.cl:28:5
132 ; GCN-NEXT: s_setpc_b64 s[30:31]
134 call void @llvm.dbg.value(metadata i8 addrspace(1)* %arg, metadata !76, metadata !DIExpression(DW_OP_constu, 1, DW_OP_swap, DW_OP_xderef)), !dbg !77
135 ret i8 addrspace(1)* %arg, !dbg !78
138 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
140 attributes #0 = { norecurse nounwind readnone }
141 attributes #1 = { nounwind readnone speculatable }
144 !llvm.module.flags = !{!3, !4, !5, !6}
146 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 9.0.0 (trunk 365209) (llvm/trunk 365206)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
147 !1 = !DIFile(filename: "/tmp/dbg.cl", directory: "/Users/matt/src/llvm", checksumkind: CSK_MD5, checksum: "0f834f91e91489a5ff6308040ddbd175")
149 !3 = !{i32 2, !"Dwarf Version", i32 5}
150 !4 = !{i32 2, !"Debug Info Version", i32 3}
151 !5 = !{i32 1, !"wchar_size", i32 4}
152 !6 = !{i32 7, !"PIC Level", i32 1}
153 !7 = distinct !DISubprogram(name: "split_v4f32_arg", scope: !8, file: !8, line: 3, type: !9, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !17)
154 !8 = !DIFile(filename: "/tmp/dbg.cl", directory: "", checksumkind: CSK_MD5, checksum: "0f834f91e91489a5ff6308040ddbd175")
155 !9 = !DISubroutineType(types: !10)
157 !11 = !DIDerivedType(tag: DW_TAG_typedef, name: "float4", file: !12, line: 107, baseType: !13)
158 !12 = !DIFile(filename: "build_debug/lib/clang/9.0.0/include/opencl-c-base.h", directory: "/Users/matt/src/llvm", checksumkind: CSK_MD5, checksum: "9526a66ac52220225f05e11186d7e461")
159 !13 = !DICompositeType(tag: DW_TAG_array_type, baseType: !14, size: 128, flags: DIFlagVector, elements: !15)
160 !14 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
162 !16 = !DISubrange(count: 4)
164 !18 = !DILocalVariable(name: "arg", arg: 1, scope: !7, file: !8, line: 3, type: !11)
165 !19 = !DILocation(line: 0, scope: !7)
166 !20 = !DILocation(line: 4, column: 5, scope: !7)
167 !21 = distinct !DISubprogram(name: "split_v4f32_multi_arg", scope: !8, file: !8, line: 7, type: !22, scopeLine: 7, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !28)
168 !22 = !DISubroutineType(types: !23)
169 !23 = !{!11, !11, !24}
170 !24 = !DIDerivedType(tag: DW_TAG_typedef, name: "float2", file: !12, line: 105, baseType: !25)
171 !25 = !DICompositeType(tag: DW_TAG_array_type, baseType: !14, size: 64, flags: DIFlagVector, elements: !26)
173 !27 = !DISubrange(count: 2)
175 !29 = !DILocalVariable(name: "arg0", arg: 1, scope: !21, file: !8, line: 7, type: !11)
176 !30 = !DILocalVariable(name: "arg1", arg: 2, scope: !21, file: !8, line: 7, type: !24)
177 !31 = !DILocation(line: 0, scope: !21)
178 !32 = !DILocation(line: 8, column: 19, scope: !21)
179 !33 = !DILocation(line: 8, column: 17, scope: !21)
180 !34 = !DILocation(line: 8, column: 5, scope: !21)
181 !35 = distinct !DISubprogram(name: "split_v4f16_arg", scope: !8, file: !8, line: 11, type: !36, scopeLine: 11, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !41)
182 !36 = !DISubroutineType(types: !37)
184 !38 = !DIDerivedType(tag: DW_TAG_typedef, name: "half4", file: !12, line: 114, baseType: !39)
185 !39 = !DICompositeType(tag: DW_TAG_array_type, baseType: !40, size: 64, flags: DIFlagVector, elements: !15)
186 !40 = !DIBasicType(name: "half", size: 16, encoding: DW_ATE_float)
188 !42 = !DILocalVariable(name: "arg", arg: 1, scope: !35, file: !8, line: 11, type: !38)
189 !43 = !DILocation(line: 0, scope: !35)
190 !44 = !DILocation(line: 12, column: 5, scope: !35)
191 !45 = distinct !DISubprogram(name: "split_f64_arg", scope: !8, file: !8, line: 15, type: !46, scopeLine: 15, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !49)
192 !46 = !DISubroutineType(types: !47)
194 !48 = !DIBasicType(name: "double", size: 64, encoding: DW_ATE_float)
196 !50 = !DILocalVariable(name: "arg", arg: 1, scope: !45, file: !8, line: 15, type: !48)
197 !51 = !DILocation(line: 0, scope: !45)
198 !52 = !DILocation(line: 16, column: 5, scope: !45)
199 !53 = distinct !DISubprogram(name: "split_v2f64_arg", scope: !8, file: !8, line: 19, type: !54, scopeLine: 19, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !58)
200 !54 = !DISubroutineType(types: !55)
202 !56 = !DIDerivedType(tag: DW_TAG_typedef, name: "double2", file: !12, line: 122, baseType: !57)
203 !57 = !DICompositeType(tag: DW_TAG_array_type, baseType: !48, size: 128, flags: DIFlagVector, elements: !26)
205 !59 = !DILocalVariable(name: "arg", arg: 1, scope: !53, file: !8, line: 19, type: !56)
206 !60 = !DILocation(line: 0, scope: !53)
207 !61 = !DILocation(line: 20, column: 5, scope: !53)
208 !62 = distinct !DISubprogram(name: "split_i64_arg", scope: !8, file: !8, line: 23, type: !63, scopeLine: 23, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !66)
209 !63 = !DISubroutineType(types: !64)
211 !65 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)
213 !67 = !DILocalVariable(name: "arg", arg: 1, scope: !62, file: !8, line: 23, type: !65)
214 !68 = !DILocation(line: 0, scope: !62)
215 !69 = !DILocation(line: 24, column: 5, scope: !62)
216 !70 = distinct !DISubprogram(name: "split_ptr_arg", scope: !8, file: !8, line: 27, type: !71, scopeLine: 27, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !75)
217 !71 = !DISubroutineType(types: !72)
219 !73 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !74, size: 64)
220 !74 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
222 !76 = !DILocalVariable(name: "arg", arg: 1, scope: !70, file: !8, line: 27, type: !73)
223 !77 = !DILocation(line: 0, scope: !70)
224 !78 = !DILocation(line: 28, column: 5, scope: !70)