OSDN Git Service

[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
[android-x86/external-llvm.git] / test / CodeGen / AMDGPU / debugger-emit-prologue.ll
1 ; RUN: llc -O0 -mtriple=amdgcn--amdhsa-amdgiz -mcpu=fiji -mattr=+amdgpu-debugger-emit-prologue -verify-machineinstrs < %s | FileCheck %s
2 ; RUN: llc -O0 -mtriple=amdgcn--amdhsa-amdgiz -mcpu=fiji -verify-machineinstrs < %s | FileCheck %s --check-prefix=NOATTR
3 target datalayout = "A5"
4
5 ; CHECK: debug_wavefront_private_segment_offset_sgpr = [[SOFF:[0-9]+]]
6 ; CHECK: debug_private_segment_buffer_sgpr = [[SREG:[0-9]+]]
7
8 ; CHECK: v_mov_b32_e32 [[WGIDX:v[0-9]+]], s{{[0-9]+}}
9 ; CHECK: buffer_store_dword [[WGIDX]], off, s[{{[0-9]+:[0-9]+}}], s[[SOFF]]
10 ; CHECK: buffer_store_dword v0, off, s[{{[0-9]+:[0-9]+}}], s[[SOFF]] offset:16
11
12 ; CHECK: v_mov_b32_e32 [[WGIDY:v[0-9]+]], s{{[0-9]+}}
13 ; CHECK: buffer_store_dword [[WGIDY]], off, s[{{[0-9]+:[0-9]+}}], s[[SOFF]] offset:4
14 ; CHECK: buffer_store_dword v1, off, s[{{[0-9]+:[0-9]+}}], s[[SOFF]] offset:20
15
16 ; CHECK: v_mov_b32_e32 [[WGIDZ:v[0-9]+]], s{{[0-9]+}}
17 ; CHECK: buffer_store_dword [[WGIDZ]], off, s[{{[0-9]+:[0-9]+}}], s[[SOFF]] offset:8
18 ; CHECK: buffer_store_dword v2, off, s[{{[0-9]+:[0-9]+}}], s[[SOFF]] offset:24
19
20 ; CHECK: DebuggerWavefrontPrivateSegmentOffsetSGPR: s[[SOFF]]
21 ; CHECK: DebuggerPrivateSegmentBufferSGPR: s[[SREG]]
22
23 ; NOATTR-NOT: DebuggerWavefrontPrivateSegmentOffsetSGPR
24 ; NOATTR-NOT: DebuggerPrivateSegmentBufferSGPR
25
26 ; Function Attrs: nounwind
27 define amdgpu_kernel void @test(i32 addrspace(1)* %A) #0 !dbg !12 {
28 entry:
29   %A.addr = alloca i32 addrspace(1)*, align 4, addrspace(5)
30   store i32 addrspace(1)* %A, i32 addrspace(1)* addrspace(5)* %A.addr, align 4
31   call void @llvm.dbg.declare(metadata i32 addrspace(1)* addrspace(5)* %A.addr, metadata !17, metadata !18), !dbg !19
32   %0 = load i32 addrspace(1)*, i32 addrspace(1)* addrspace(5)* %A.addr, align 4, !dbg !20
33   %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %0, i32 0, !dbg !20
34   store i32 1, i32 addrspace(1)* %arrayidx, align 4, !dbg !21
35   %1 = load i32 addrspace(1)*, i32 addrspace(1)* addrspace(5)* %A.addr, align 4, !dbg !22
36   %arrayidx1 = getelementptr inbounds i32, i32 addrspace(1)* %1, i32 1, !dbg !22
37   store i32 2, i32 addrspace(1)* %arrayidx1, align 4, !dbg !23
38   %2 = load i32 addrspace(1)*, i32 addrspace(1)* addrspace(5)* %A.addr, align 4, !dbg !24
39   %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %2, i32 2, !dbg !24
40   store i32 3, i32 addrspace(1)* %arrayidx2, align 4, !dbg !25
41   ret void, !dbg !26
42 }
43
44 ; Function Attrs: nounwind readnone
45 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
46
47 attributes #0 = { nounwind "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" "stack-protector-buffer-size"="8" "target-cpu"="fiji" "unsafe-fp-math"="false" "use-soft-float"="false" }
48 attributes #1 = { nounwind readnone }
49
50 !llvm.dbg.cu = !{!0}
51 !opencl.kernels = !{!3}
52 !llvm.module.flags = !{!9, !10}
53 !llvm.ident = !{!11}
54
55 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 (trunk 269772)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
56 !1 = !DIFile(filename: "test01.cl", directory: "/home/kzhuravl/Lightning/testing")
57 !2 = !{}
58 !3 = !{void (i32 addrspace(1)*)* @test, !4, !5, !6, !7, !8}
59 !4 = !{!"kernel_arg_addr_space", i32 1}
60 !5 = !{!"kernel_arg_access_qual", !"none"}
61 !6 = !{!"kernel_arg_type", !"int addrspace(5)*"}
62 !7 = !{!"kernel_arg_base_type", !"int addrspace(5)*"}
63 !8 = !{!"kernel_arg_type_qual", !""}
64 !9 = !{i32 2, !"Dwarf Version", i32 2}
65 !10 = !{i32 2, !"Debug Info Version", i32 3}
66 !11 = !{!"clang version 3.9.0 (trunk 269772)"}
67 !12 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 1, type: !13, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
68 !13 = !DISubroutineType(types: !14)
69 !14 = !{null, !15}
70 !15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64, align: 32)
71 !16 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
72 !17 = !DILocalVariable(name: "A", arg: 1, scope: !12, file: !1, line: 1, type: !15)
73 !18 = !DIExpression()
74 !19 = !DILocation(line: 1, column: 30, scope: !12)
75 !20 = !DILocation(line: 2, column: 3, scope: !12)
76 !21 = !DILocation(line: 2, column: 8, scope: !12)
77 !22 = !DILocation(line: 3, column: 3, scope: !12)
78 !23 = !DILocation(line: 3, column: 8, scope: !12)
79 !24 = !DILocation(line: 4, column: 3, scope: !12)
80 !25 = !DILocation(line: 4, column: 8, scope: !12)
81 !26 = !DILocation(line: 5, column: 1, scope: !12)