1 ; RUN: llc -mtriple=nvptx64-nvidia-cuda < %s | FileCheck %s
2 ; RUN: %if ptxas %{ llc -mtriple=nvptx64-nvidia-cuda < %s | %ptxas-verify %}
4 @GLOBAL = addrspace(1) externally_initialized global i32 0, align 4, !dbg !0
5 @SHARED = addrspace(3) externally_initialized global i32 undef, align 4, !dbg !6
7 define void @test(float, ptr, ptr, i32) !dbg !17 {
8 %5 = alloca float, align 4
9 %6 = alloca ptr, align 8
10 %7 = alloca ptr, align 8
11 %8 = alloca i32, align 4
12 store float %0, ptr %5, align 4
13 call void @llvm.dbg.declare(metadata ptr %5, metadata !22, metadata !DIExpression()), !dbg !23
14 store ptr %1, ptr %6, align 8
15 call void @llvm.dbg.declare(metadata ptr %6, metadata !24, metadata !DIExpression()), !dbg !25
16 store ptr %2, ptr %7, align 8
17 call void @llvm.dbg.declare(metadata ptr %7, metadata !26, metadata !DIExpression()), !dbg !27
18 store i32 %3, ptr %8, align 4
19 call void @llvm.dbg.declare(metadata ptr %8, metadata !28, metadata !DIExpression()), !dbg !29
20 %9 = load float, ptr %5, align 4, !dbg !30
21 %10 = load ptr, ptr %6, align 8, !dbg !31
22 %11 = load i32, ptr %8, align 4, !dbg !32
23 %12 = sext i32 %11 to i64, !dbg !31
24 %13 = getelementptr inbounds float, ptr %10, i64 %12, !dbg !31
25 %14 = load float, ptr %13, align 4, !dbg !31
26 %15 = fmul contract float %9, %14, !dbg !33
27 %16 = load ptr, ptr %7, align 8, !dbg !34
28 %17 = load i32, ptr %8, align 4, !dbg !35
29 %18 = sext i32 %17 to i64, !dbg !34
30 %19 = getelementptr inbounds float, ptr %16, i64 %18, !dbg !34
31 store float %15, ptr %19, align 4, !dbg !36
32 store i32 0, ptr addrspacecast (ptr addrspace(1) @GLOBAL to ptr), align 4, !dbg !37
33 store i32 0, ptr addrspacecast (ptr addrspace(3) @SHARED to ptr), align 4, !dbg !38
37 ; Function Attrs: nounwind readnone speculatable
38 declare void @llvm.dbg.declare(metadata, metadata, metadata)
41 !nvvm.annotations = !{!10}
42 !llvm.module.flags = !{!11, !12, !13, !14, !15}
45 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
46 !1 = distinct !DIGlobalVariable(name: "GLOBAL", scope: !2, file: !8, line: 3, type: !9, isLocal: false, isDefinition: true)
47 !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 9.0.0 (trunk 351969) (llvm/trunk 351973)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
48 !3 = !DIFile(filename: "new.cc", directory: "/tmp")
51 !6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression(DW_OP_constu, 8, DW_OP_swap, DW_OP_xderef))
52 !7 = distinct !DIGlobalVariable(name: "SHARED", scope: !2, file: !8, line: 4, type: !9, isLocal: false, isDefinition: true)
53 !8 = !DIFile(filename: "test.cu", directory: "/tmp")
54 !9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
55 !10 = !{ptr @test, !"kernel", i32 1}
56 !11 = !{i32 2, !"Dwarf Version", i32 2}
57 !12 = !{i32 2, !"Debug Info Version", i32 3}
58 !13 = !{i32 1, !"wchar_size", i32 4}
59 !14 = !{i32 4, !"nvvm-reflect-ftz", i32 0}
60 !15 = !{i32 7, !"PIC Level", i32 2}
61 !16 = !{!"clang version 9.0.0 (trunk 351969) (llvm/trunk 351973)"}
62 !17 = distinct !DISubprogram(name: "test", linkageName: "test", scope: !8, file: !8, line: 6, type: !18, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !40)
63 !18 = !DISubroutineType(types: !19)
64 !19 = !{null, !20, !21, !21, !9}
65 !20 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
66 !21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64)
67 !22 = !DILocalVariable(name: "a", arg: 1, scope: !17, file: !8, line: 6, type: !20)
68 !23 = !DILocation(line: 6, column: 41, scope: !17)
69 !24 = !DILocalVariable(name: "x", arg: 2, scope: !17, file: !8, line: 6, type: !21)
70 !25 = !DILocation(line: 6, column: 51, scope: !17)
71 !26 = !DILocalVariable(name: "y", arg: 3, scope: !17, file: !8, line: 6, type: !21)
72 !27 = !DILocation(line: 6, column: 61, scope: !17)
73 !28 = !DILocalVariable(name: "i", arg: 4, scope: !17, file: !8, line: 6, type: !9)
74 !29 = !DILocation(line: 6, column: 68, scope: !17)
75 !30 = !DILocation(line: 7, column: 10, scope: !17)
76 !31 = !DILocation(line: 7, column: 14, scope: !17)
77 !32 = !DILocation(line: 7, column: 16, scope: !17)
78 !33 = !DILocation(line: 7, column: 12, scope: !17)
79 !34 = !DILocation(line: 7, column: 3, scope: !17)
80 !35 = !DILocation(line: 7, column: 5, scope: !17)
81 !36 = !DILocation(line: 7, column: 8, scope: !17)
82 !37 = !DILocation(line: 8, column: 10, scope: !17)
83 !38 = !DILocation(line: 9, column: 10, scope: !17)
84 !39 = !DILocation(line: 10, column: 1, scope: !17)
85 !40 = !{!22, !24, !26, !28}
87 ; CHECK: .section .debug_abbrev
89 ; CHECK-NEXT: .b8 1 // Abbreviation Code
90 ; CHECK-NEXT: .b8 17 // DW_TAG_compile_unit
91 ; CHECK-NEXT: .b8 1 // DW_CHILDREN_yes
92 ; CHECK-NEXT: .b8 37 // DW_AT_producer
93 ; CHECK-NEXT: .b8 8 // DW_FORM_string
94 ; CHECK-NEXT: .b8 19 // DW_AT_language
95 ; CHECK-NEXT: .b8 5 // DW_FORM_data2
96 ; CHECK-NEXT: .b8 3 // DW_AT_name
97 ; CHECK-NEXT: .b8 8 // DW_FORM_string
98 ; CHECK-NEXT: .b8 16 // DW_AT_stmt_list
99 ; CHECK-NEXT: .b8 6 // DW_FORM_data4
100 ; CHECK-NEXT: .b8 27 // DW_AT_comp_dir
101 ; CHECK-NEXT: .b8 8 // DW_FORM_string
102 ; CHECK-NEXT: .b8 0 // EOM(1)
103 ; CHECK-NEXT: .b8 0 // EOM(2)
104 ; CHECK-NEXT: .b8 2 // Abbreviation Code
105 ; CHECK-NEXT: .b8 52 // DW_TAG_variable
106 ; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
107 ; CHECK-NEXT: .b8 3 // DW_AT_name
108 ; CHECK-NEXT: .b8 8 // DW_FORM_string
109 ; CHECK-NEXT: .b8 73 // DW_AT_type
110 ; CHECK-NEXT: .b8 19 // DW_FORM_ref4
111 ; CHECK-NEXT: .b8 63 // DW_AT_external
112 ; CHECK-NEXT: .b8 12 // DW_FORM_flag
113 ; CHECK-NEXT: .b8 58 // DW_AT_decl_file
114 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
115 ; CHECK-NEXT: .b8 59 // DW_AT_decl_line
116 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
117 ; CHECK-NEXT: .b8 51 // DW_AT_address_class
118 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
119 ; CHECK-NEXT: .b8 2 // DW_AT_location
120 ; CHECK-NEXT: .b8 10 // DW_FORM_block1
121 ; CHECK-NEXT: .b8 0 // EOM(1)
122 ; CHECK-NEXT: .b8 0 // EOM(2)
123 ; CHECK-NEXT: .b8 3 // Abbreviation Code
124 ; CHECK-NEXT: .b8 36 // DW_TAG_base_type
125 ; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
126 ; CHECK-NEXT: .b8 3 // DW_AT_name
127 ; CHECK-NEXT: .b8 8 // DW_FORM_string
128 ; CHECK-NEXT: .b8 62 // DW_AT_encoding
129 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
130 ; CHECK-NEXT: .b8 11 // DW_AT_byte_size
131 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
132 ; CHECK-NEXT: .b8 0 // EOM(1)
133 ; CHECK-NEXT: .b8 0 // EOM(2)
134 ; CHECK-NEXT: .b8 4 // Abbreviation Code
135 ; CHECK-NEXT: .b8 46 // DW_TAG_subprogram
136 ; CHECK-NEXT: .b8 1 // DW_CHILDREN_yes
137 ; CHECK-NEXT: .b8 17 // DW_AT_low_pc
138 ; CHECK-NEXT: .b8 1 // DW_FORM_addr
139 ; CHECK-NEXT: .b8 18 // DW_AT_high_pc
140 ; CHECK-NEXT: .b8 1 // DW_FORM_addr
141 ; CHECK-NEXT: .b8 64 // DW_AT_frame_base
142 ; CHECK-NEXT: .b8 10 // DW_FORM_block1
143 ; CHECK-NEXT: .b8 135 // DW_AT_MIPS_linkage_name
145 ; CHECK-NEXT: .b8 8 // DW_FORM_string
146 ; CHECK-NEXT: .b8 3 // DW_AT_name
147 ; CHECK-NEXT: .b8 8 // DW_FORM_string
148 ; CHECK-NEXT: .b8 58 // DW_AT_decl_file
149 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
150 ; CHECK-NEXT: .b8 59 // DW_AT_decl_line
151 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
152 ; CHECK-NEXT: .b8 63 // DW_AT_external
153 ; CHECK-NEXT: .b8 12 // DW_FORM_flag
154 ; CHECK-NEXT: .b8 0 // EOM(1)
155 ; CHECK-NEXT: .b8 0 // EOM(2)
156 ; CHECK-NEXT: .b8 5 // Abbreviation Code
157 ; CHECK-NEXT: .b8 5 // DW_TAG_formal_parameter
158 ; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
159 ; CHECK-NEXT: .b8 51 // DW_AT_address_class
160 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
161 ; CHECK-NEXT: .b8 2 // DW_AT_location
162 ; CHECK-NEXT: .b8 10 // DW_FORM_block1
163 ; CHECK-NEXT: .b8 3 // DW_AT_name
164 ; CHECK-NEXT: .b8 8 // DW_FORM_string
165 ; CHECK-NEXT: .b8 58 // DW_AT_decl_file
166 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
167 ; CHECK-NEXT: .b8 59 // DW_AT_decl_line
168 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
169 ; CHECK-NEXT: .b8 73 // DW_AT_type
170 ; CHECK-NEXT: .b8 19 // DW_FORM_ref4
171 ; CHECK-NEXT: .b8 0 // EOM(1)
172 ; CHECK-NEXT: .b8 0 // EOM(2)
173 ; CHECK-NEXT: .b8 6 // Abbreviation Code
174 ; CHECK-NEXT: .b8 5 // DW_TAG_formal_parameter
175 ; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
176 ; CHECK-NEXT: .b8 3 // DW_AT_name
177 ; CHECK-NEXT: .b8 8 // DW_FORM_string
178 ; CHECK-NEXT: .b8 58 // DW_AT_decl_file
179 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
180 ; CHECK-NEXT: .b8 59 // DW_AT_decl_line
181 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
182 ; CHECK-NEXT: .b8 73 // DW_AT_type
183 ; CHECK-NEXT: .b8 19 // DW_FORM_ref4
184 ; CHECK-NEXT: .b8 0 // EOM(1)
185 ; CHECK-NEXT: .b8 0 // EOM(2)
186 ; CHECK-NEXT: .b8 7 // Abbreviation Code
187 ; CHECK-NEXT: .b8 15 // DW_TAG_pointer_type
188 ; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
189 ; CHECK-NEXT: .b8 73 // DW_AT_type
190 ; CHECK-NEXT: .b8 19 // DW_FORM_ref4
191 ; CHECK-NEXT: .b8 0 // EOM(1)
192 ; CHECK-NEXT: .b8 0 // EOM(2)
193 ; CHECK-NEXT: .b8 0 // EOM(3)
195 ; CHECK-NEXT: .section .debug_info
197 ; CHECK-NEXT: .b32 238 // Length of Unit
198 ; CHECK-NEXT: .b8 2 // DWARF version number
200 ; CHECK-NEXT: .b32 .debug_abbrev // Offset Into Abbrev. Section
201 ; CHECK-NEXT: .b8 8 // Address Size (in bytes)
202 ; CHECK-NEXT: .b8 1 // Abbrev [1] 0xb:0xe7 DW_TAG_compile_unit
203 ; CHECK-NEXT: .b8 99 // DW_AT_producer
204 ; CHECK-NEXT: .b8 108
206 ; CHECK-NEXT: .b8 110
207 ; CHECK-NEXT: .b8 103
209 ; CHECK-NEXT: .b8 118
210 ; CHECK-NEXT: .b8 101
211 ; CHECK-NEXT: .b8 114
212 ; CHECK-NEXT: .b8 115
213 ; CHECK-NEXT: .b8 105
214 ; CHECK-NEXT: .b8 111
215 ; CHECK-NEXT: .b8 110
224 ; CHECK-NEXT: .b8 116
225 ; CHECK-NEXT: .b8 114
226 ; CHECK-NEXT: .b8 117
227 ; CHECK-NEXT: .b8 110
228 ; CHECK-NEXT: .b8 107
239 ; CHECK-NEXT: .b8 108
240 ; CHECK-NEXT: .b8 108
241 ; CHECK-NEXT: .b8 118
242 ; CHECK-NEXT: .b8 109
244 ; CHECK-NEXT: .b8 116
245 ; CHECK-NEXT: .b8 114
246 ; CHECK-NEXT: .b8 117
247 ; CHECK-NEXT: .b8 110
248 ; CHECK-NEXT: .b8 107
258 ; CHECK-NEXT: .b8 4 // DW_AT_language
260 ; CHECK-NEXT: .b8 110 // DW_AT_name
261 ; CHECK-NEXT: .b8 101
262 ; CHECK-NEXT: .b8 119
267 ; CHECK-NEXT: .b32 .debug_line // DW_AT_stmt_list
268 ; CHECK-NEXT: .b8 47 // DW_AT_comp_dir
269 ; CHECK-NEXT: .b8 116
270 ; CHECK-NEXT: .b8 109
271 ; CHECK-NEXT: .b8 112
273 ; CHECK-NEXT: .b8 2 // Abbrev [2] 0x55:0x1a DW_TAG_variable
274 ; CHECK-NEXT: .b8 71 // DW_AT_name
281 ; CHECK-NEXT: .b32 111 // DW_AT_type
282 ; CHECK-NEXT: .b8 1 // DW_AT_external
283 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
284 ; CHECK-NEXT: .b8 3 // DW_AT_decl_line
285 ; CHECK-NEXT: .b8 5 // DW_AT_address_class
286 ; CHECK-NEXT: .b8 9 // DW_AT_location
288 ; CHECK-NEXT: .b64 GLOBAL
289 ; CHECK-NEXT: .b8 3 // Abbrev [3] 0x6f:0x7 DW_TAG_base_type
290 ; CHECK-NEXT: .b8 105 // DW_AT_name
291 ; CHECK-NEXT: .b8 110
292 ; CHECK-NEXT: .b8 116
294 ; CHECK-NEXT: .b8 5 // DW_AT_encoding
295 ; CHECK-NEXT: .b8 4 // DW_AT_byte_size
296 ; CHECK-NEXT: .b8 2 // Abbrev [2] 0x76:0x1a DW_TAG_variable
297 ; CHECK-NEXT: .b8 83 // DW_AT_name
304 ; CHECK-NEXT: .b32 111 // DW_AT_type
305 ; CHECK-NEXT: .b8 1 // DW_AT_external
306 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
307 ; CHECK-NEXT: .b8 4 // DW_AT_decl_line
308 ; CHECK-NEXT: .b8 8 // DW_AT_address_class
309 ; CHECK-NEXT: .b8 9 // DW_AT_location
311 ; CHECK-NEXT: .b64 SHARED
312 ; CHECK-NEXT: .b8 4 // Abbrev [4] 0x90:0x53 DW_TAG_subprogram
313 ; CHECK-NEXT: .b64 $L__func_begin0 // DW_AT_low_pc
314 ; CHECK-NEXT: .b64 $L__func_end0 // DW_AT_high_pc
315 ; CHECK-NEXT: .b8 1 // DW_AT_frame_base
316 ; CHECK-NEXT: .b8 156
317 ; CHECK-NEXT: .b8 116 // DW_AT_MIPS_linkage_name
318 ; CHECK-NEXT: .b8 101
319 ; CHECK-NEXT: .b8 115
320 ; CHECK-NEXT: .b8 116
322 ; CHECK-NEXT: .b8 116 // DW_AT_name
323 ; CHECK-NEXT: .b8 101
324 ; CHECK-NEXT: .b8 115
325 ; CHECK-NEXT: .b8 116
327 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
328 ; CHECK-NEXT: .b8 6 // DW_AT_decl_line
329 ; CHECK-NEXT: .b8 1 // DW_AT_external
330 ; CHECK-NEXT: .b8 5 // Abbrev [5] 0xb0:0x10 DW_TAG_formal_parameter
331 ; CHECK-NEXT: .b8 2 // DW_AT_address_class
332 ; CHECK-NEXT: .b8 5 // DW_AT_location
333 ; CHECK-NEXT: .b8 144
334 ; CHECK-NEXT: .b8 177
335 ; CHECK-NEXT: .b8 204
336 ; CHECK-NEXT: .b8 149
338 ; CHECK-NEXT: .b8 97 // DW_AT_name
340 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
341 ; CHECK-NEXT: .b8 6 // DW_AT_decl_line
342 ; CHECK-NEXT: .b32 227 // DW_AT_type
343 ; CHECK-NEXT: .b8 6 // Abbrev [6] 0xc0:0x9 DW_TAG_formal_parameter
344 ; CHECK-NEXT: .b8 120 // DW_AT_name
346 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
347 ; CHECK-NEXT: .b8 6 // DW_AT_decl_line
348 ; CHECK-NEXT: .b32 236 // DW_AT_type
349 ; CHECK-NEXT: .b8 6 // Abbrev [6] 0xc9:0x9 DW_TAG_formal_parameter
350 ; CHECK-NEXT: .b8 121 // DW_AT_name
352 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
353 ; CHECK-NEXT: .b8 6 // DW_AT_decl_line
354 ; CHECK-NEXT: .b32 236 // DW_AT_type
355 ; CHECK-NEXT: .b8 5 // Abbrev [5] 0xd2:0x10 DW_TAG_formal_parameter
356 ; CHECK-NEXT: .b8 2 // DW_AT_address_class
357 ; CHECK-NEXT: .b8 5 // DW_AT_location
358 ; CHECK-NEXT: .b8 144
359 ; CHECK-NEXT: .b8 177
360 ; CHECK-NEXT: .b8 228
361 ; CHECK-NEXT: .b8 149
363 ; CHECK-NEXT: .b8 105 // DW_AT_name
365 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
366 ; CHECK-NEXT: .b8 6 // DW_AT_decl_line
367 ; CHECK-NEXT: .b32 111 // DW_AT_type
368 ; CHECK-NEXT: .b8 0 // End Of Children Mark
369 ; CHECK-NEXT: .b8 3 // Abbrev [3] 0xe3:0x9 DW_TAG_base_type
370 ; CHECK-NEXT: .b8 102 // DW_AT_name
371 ; CHECK-NEXT: .b8 108
372 ; CHECK-NEXT: .b8 111
374 ; CHECK-NEXT: .b8 116
376 ; CHECK-NEXT: .b8 4 // DW_AT_encoding
377 ; CHECK-NEXT: .b8 4 // DW_AT_byte_size
378 ; CHECK-NEXT: .b8 7 // Abbrev [7] 0xec:0x5 DW_TAG_pointer_type
379 ; CHECK-NEXT: .b32 227 // DW_AT_type
380 ; CHECK-NEXT: .b8 0 // End Of Children Mark
382 ; CHECK-NEXT: .section .debug_macinfo { }