1 ; RUN: sed -e "s,SRC_COMPDIR,%/p/Inputs,g" %s > %t.ll 2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa-amdgiz -mcpu=gfx802 -filetype=obj -O0 -o %t.o %t.ll 3 ; RUN: llvm-objdump -triple=amdgcn-amd-amdhsa-amdgiz -mcpu=gfx802 -disassemble -line-numbers %t.o | FileCheck --check-prefix=LINE %t.ll 4 ; RUN: llvm-objdump -triple=amdgcn-amd-amdhsa-amdgiz -mcpu=gfx802 -disassemble -source %t.o | FileCheck --check-prefix=SOURCE %t.ll 5 6 ; Prologue. 7 ; LINE: source_lines_test: 8 ; LINE-NEXT: ; {{.*}}source-lines.cl:1 9 ; Kernel. 10 ; LINE: v_mov_b32_e32 v{{[0-9]+}}, 0x777 11 ; LINE: ; {{.*}}source-lines.cl:2 12 ; LINE: v_mov_b32_e32 v{{[0-9]+}}, 0x888 13 ; LINE: ; {{.*}}source-lines.cl:3 14 ; LINE: ; {{.*}}source-lines.cl:4 15 ; LINE: v_add_u32_e32 16 ; LINE: ; {{.*}}source-lines.cl:5 17 ; LINE: flat_store_dword 18 ; Epilogue. 19 ; LINE: ; {{.*}}source-lines.cl:6 20 ; LINE-NEXT: s_endpgm 21 22 ; Prologue. 23 ; SOURCE: source_lines_test: 24 ; SOURCE-NEXT: ; kernel void source_lines_test(global int *Out) { 25 ; Kernel. 26 ; SOURCE: v_mov_b32_e32 v{{[0-9]+}}, 0x777 27 ; SOURCE: ; int var0 = 0x777; 28 ; SOURCE: v_mov_b32_e32 v{{[0-9]+}}, 0x888 29 ; SOURCE: ; int var1 = 0x888; 30 ; SOURCE: ; int var2 = var0 + var1; 31 ; SOURCE: v_add_u32_e32 32 ; SOURCE: ; *Out = var2; 33 ; SOURCE: flat_store_dword 34 ; Epilogue. 35 ; SOURCE: ; } 36 ; SOURCE-NEXT: s_endpgm 37 38 ; ModuleID = 'source-lines.cl' 39 source_filename = "source-lines.cl" 40 target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-A5" 41 target triple = "amdgcn-amd-amdhsa-amdgiz" 42 43 ; Function Attrs: noinline nounwind 44 define amdgpu_kernel void @source_lines_test(i32 addrspace(1)* %Out) #0 !dbg !7 !kernel_arg_addr_space !12 !kernel_arg_access_qual !13 !kernel_arg_type !14 !kernel_arg_base_type !14 !kernel_arg_type_qual !15 { 45 entry: 46 %Out.addr = alloca i32 addrspace(1)*, align 4, addrspace(5) 47 %var0 = alloca i32, align 4, addrspace(5) 48 %var1 = alloca i32, align 4, addrspace(5) 49 %var2 = alloca i32, align 4, addrspace(5) 50 store i32 addrspace(1)* %Out, i32 addrspace(1)* addrspace(5)* %Out.addr, align 4 51 call void @llvm.dbg.declare(metadata i32 addrspace(1)* addrspace(5)* %Out.addr, metadata !16, metadata !17), !dbg !18 52 call void @llvm.dbg.declare(metadata i32 addrspace(5)* %var0, metadata !19, metadata !17), !dbg !20 53 store i32 1911, i32 addrspace(5)* %var0, align 4, !dbg !20 54 call void @llvm.dbg.declare(metadata i32 addrspace(5)* %var1, metadata !21, metadata !17), !dbg !22 55 store i32 2184, i32 addrspace(5)* %var1, align 4, !dbg !22 56 call void @llvm.dbg.declare(metadata i32 addrspace(5)* %var2, metadata !23, metadata !17), !dbg !24 57 %0 = load i32, i32 addrspace(5)* %var0, align 4, !dbg !25 58 %1 = load i32, i32 addrspace(5)* %var1, align 4, !dbg !26 59 %add = add nsw i32 %0, %1, !dbg !27 60 store i32 %add, i32 addrspace(5)* %var2, align 4, !dbg !24 61 %2 = load i32, i32 addrspace(5)* %var2, align 4, !dbg !28 62 %3 = load i32 addrspace(1)*, i32 addrspace(1)* addrspace(5)* %Out.addr, align 4, !dbg !29 63 store i32 %2, i32 addrspace(1)* %3, align 4, !dbg !30 64 ret void, !dbg !31 65 } 66 67 ; Function Attrs: nounwind readnone 68 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 69 70 attributes #0 = { noinline nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="gfx700" "target-features"="+fp64-fp16-denormals,-fp32-denormals" "unsafe-fp-math"="false" "use-soft-float"="false" } 71 attributes #1 = { nounwind readnone } 72 73 !llvm.dbg.cu = !{!0} 74 !opencl.ocl.version = !{!3} 75 !llvm.module.flags = !{!4, !5} 76 !llvm.ident = !{!6} 77 78 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 5.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 79 !1 = !DIFile(filename: "source-lines.cl", directory: "SRC_COMPDIR") 80 !2 = !{} 81 !3 = !{i32 1, i32 0} 82 !4 = !{i32 2, !"Dwarf Version", i32 2} 83 !5 = !{i32 2, !"Debug Info Version", i32 3} 84 !6 = !{!"clang version 5.0.0"} 85 !7 = distinct !DISubprogram(name: "source_lines_test", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 86 !8 = !DISubroutineType(types: !9) 87 !9 = !{null, !10} 88 !10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64) 89 !11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 90 !12 = !{i32 1} 91 !13 = !{!"none"} 92 !14 = !{!"int*"} 93 !15 = !{!""} 94 !16 = !DILocalVariable(name: "Out", arg: 1, scope: !7, file: !1, line: 1, type: !10) 95 !17 = !DIExpression() 96 !18 = !DILocation(line: 1, column: 43, scope: !7) 97 !19 = !DILocalVariable(name: "var0", scope: !7, file: !1, line: 2, type: !11) 98 !20 = !DILocation(line: 2, column: 7, scope: !7) 99 !21 = !DILocalVariable(name: "var1", scope: !7, file: !1, line: 3, type: !11) 100 !22 = !DILocation(line: 3, column: 7, scope: !7) 101 !23 = !DILocalVariable(name: "var2", scope: !7, file: !1, line: 4, type: !11) 102 !24 = !DILocation(line: 4, column: 7, scope: !7) 103 !25 = !DILocation(line: 4, column: 14, scope: !7) 104 !26 = !DILocation(line: 4, column: 21, scope: !7) 105 !27 = !DILocation(line: 4, column: 19, scope: !7) 106 !28 = !DILocation(line: 5, column: 10, scope: !7) 107 !29 = !DILocation(line: 5, column: 4, scope: !7) 108 !30 = !DILocation(line: 5, column: 8, scope: !7) 109 !31 = !DILocation(line: 6, column: 1, scope: !7) 110