xref: /aosp_15_r20/external/llvm/test/CodeGen/AMDGPU/debugger-emit-prologue.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -O0 -mtriple=amdgcn--amdhsa -mcpu=fiji -mattr=+amdgpu-debugger-emit-prologue -verify-machineinstrs < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -O0 -mtriple=amdgcn--amdhsa -mcpu=fiji -verify-machineinstrs < %s | FileCheck %s --check-prefix=NOATTR
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; CHECK: debug_wavefront_private_segment_offset_sgpr = [[SOFF:[0-9]+]]
5*9880d681SAndroid Build Coastguard Worker; CHECK: debug_private_segment_buffer_sgpr = [[SREG:[0-9]+]]
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker; CHECK: v_mov_b32_e32 [[WGIDX:v[0-9]+]], s{{[0-9]+}}
8*9880d681SAndroid Build Coastguard Worker; CHECK: buffer_store_dword [[WGIDX]], off, s[{{[0-9]+:[0-9]+}}], s[[SOFF]]
9*9880d681SAndroid Build Coastguard Worker; CHECK: buffer_store_dword v0, off, s[{{[0-9]+:[0-9]+}}], s[[SOFF]] offset:16
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker; CHECK: v_mov_b32_e32 [[WGIDY:v[0-9]+]], s{{[0-9]+}}
12*9880d681SAndroid Build Coastguard Worker; CHECK: buffer_store_dword [[WGIDY]], off, s[{{[0-9]+:[0-9]+}}], s[[SOFF]] offset:4
13*9880d681SAndroid Build Coastguard Worker; CHECK: buffer_store_dword v1, off, s[{{[0-9]+:[0-9]+}}], s[[SOFF]] offset:20
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Worker; CHECK: v_mov_b32_e32 [[WGIDZ:v[0-9]+]], s{{[0-9]+}}
16*9880d681SAndroid Build Coastguard Worker; CHECK: buffer_store_dword [[WGIDZ]], off, s[{{[0-9]+:[0-9]+}}], s[[SOFF]] offset:8
17*9880d681SAndroid Build Coastguard Worker; CHECK: buffer_store_dword v2, off, s[{{[0-9]+:[0-9]+}}], s[[SOFF]] offset:24
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker; CHECK: DebuggerWavefrontPrivateSegmentOffsetSGPR: s[[SOFF]]
20*9880d681SAndroid Build Coastguard Worker; CHECK: DebuggerPrivateSegmentBufferSGPR: s[[SREG]]
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; NOATTR-NOT: DebuggerWavefrontPrivateSegmentOffsetSGPR
23*9880d681SAndroid Build Coastguard Worker; NOATTR-NOT: DebuggerPrivateSegmentBufferSGPR
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind
26*9880d681SAndroid Build Coastguard Workerdefine void @test(i32 addrspace(1)* %A) #0 !dbg !12 {
27*9880d681SAndroid Build Coastguard Workerentry:
28*9880d681SAndroid Build Coastguard Worker  %A.addr = alloca i32 addrspace(1)*, align 4
29*9880d681SAndroid Build Coastguard Worker  store i32 addrspace(1)* %A, i32 addrspace(1)** %A.addr, align 4
30*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.declare(metadata i32 addrspace(1)** %A.addr, metadata !17, metadata !18), !dbg !19
31*9880d681SAndroid Build Coastguard Worker  %0 = load i32 addrspace(1)*, i32 addrspace(1)** %A.addr, align 4, !dbg !20
32*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %0, i32 0, !dbg !20
33*9880d681SAndroid Build Coastguard Worker  store i32 1, i32 addrspace(1)* %arrayidx, align 4, !dbg !21
34*9880d681SAndroid Build Coastguard Worker  %1 = load i32 addrspace(1)*, i32 addrspace(1)** %A.addr, align 4, !dbg !22
35*9880d681SAndroid Build Coastguard Worker  %arrayidx1 = getelementptr inbounds i32, i32 addrspace(1)* %1, i32 1, !dbg !22
36*9880d681SAndroid Build Coastguard Worker  store i32 2, i32 addrspace(1)* %arrayidx1, align 4, !dbg !23
37*9880d681SAndroid Build Coastguard Worker  %2 = load i32 addrspace(1)*, i32 addrspace(1)** %A.addr, align 4, !dbg !24
38*9880d681SAndroid Build Coastguard Worker  %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %2, i32 2, !dbg !24
39*9880d681SAndroid Build Coastguard Worker  store i32 3, i32 addrspace(1)* %arrayidx2, align 4, !dbg !25
40*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !26
41*9880d681SAndroid Build Coastguard Worker}
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
44*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #1
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Workerattributes #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" }
47*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone }
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0}
50*9880d681SAndroid Build Coastguard Worker!opencl.kernels = !{!3}
51*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!9, !10}
52*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!11}
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Worker!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)
55*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "test01.cl", directory: "/home/kzhuravl/Lightning/testing")
56*9880d681SAndroid Build Coastguard Worker!2 = !{}
57*9880d681SAndroid Build Coastguard Worker!3 = !{void (i32 addrspace(1)*)* @test, !4, !5, !6, !7, !8}
58*9880d681SAndroid Build Coastguard Worker!4 = !{!"kernel_arg_addr_space", i32 1}
59*9880d681SAndroid Build Coastguard Worker!5 = !{!"kernel_arg_access_qual", !"none"}
60*9880d681SAndroid Build Coastguard Worker!6 = !{!"kernel_arg_type", !"int*"}
61*9880d681SAndroid Build Coastguard Worker!7 = !{!"kernel_arg_base_type", !"int*"}
62*9880d681SAndroid Build Coastguard Worker!8 = !{!"kernel_arg_type_qual", !""}
63*9880d681SAndroid Build Coastguard Worker!9 = !{i32 2, !"Dwarf Version", i32 2}
64*9880d681SAndroid Build Coastguard Worker!10 = !{i32 2, !"Debug Info Version", i32 3}
65*9880d681SAndroid Build Coastguard Worker!11 = !{!"clang version 3.9.0 (trunk 269772)"}
66*9880d681SAndroid Build Coastguard Worker!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, variables: !2)
67*9880d681SAndroid Build Coastguard Worker!13 = !DISubroutineType(types: !14)
68*9880d681SAndroid Build Coastguard Worker!14 = !{null, !15}
69*9880d681SAndroid Build Coastguard Worker!15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64, align: 32)
70*9880d681SAndroid Build Coastguard Worker!16 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
71*9880d681SAndroid Build Coastguard Worker!17 = !DILocalVariable(name: "A", arg: 1, scope: !12, file: !1, line: 1, type: !15)
72*9880d681SAndroid Build Coastguard Worker!18 = !DIExpression()
73*9880d681SAndroid Build Coastguard Worker!19 = !DILocation(line: 1, column: 30, scope: !12)
74*9880d681SAndroid Build Coastguard Worker!20 = !DILocation(line: 2, column: 3, scope: !12)
75*9880d681SAndroid Build Coastguard Worker!21 = !DILocation(line: 2, column: 8, scope: !12)
76*9880d681SAndroid Build Coastguard Worker!22 = !DILocation(line: 3, column: 3, scope: !12)
77*9880d681SAndroid Build Coastguard Worker!23 = !DILocation(line: 3, column: 8, scope: !12)
78*9880d681SAndroid Build Coastguard Worker!24 = !DILocation(line: 4, column: 3, scope: !12)
79*9880d681SAndroid Build Coastguard Worker!25 = !DILocation(line: 4, column: 8, scope: !12)
80*9880d681SAndroid Build Coastguard Worker!26 = !DILocation(line: 5, column: 1, scope: !12)
81