1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -mattr=+xnack -amdgpu-max-memory-clause=0 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GCN %s
4 ; Test the behavior of the post-RA soft clause bundler in the presence
5 ; of debug info. The debug info should not interfere with the
6 ; bundling, which could result in an observable codegen change.
8 define amdgpu_kernel void @dbg_clause(ptr addrspace(1) %out, ptr addrspace(1) %aptr) !dbg !4 {
9 ; GCN-LABEL: dbg_clause:
11 ; GCN-NEXT: s_load_dwordx4 s[4:7], s[2:3], 0x24
12 ; GCN-NEXT: v_lshlrev_b32_e32 v0, 2, v0
13 ; GCN-NEXT: s_waitcnt lgkmcnt(0)
14 ; GCN-NEXT: global_load_dword v1, v0, s[6:7]
15 ; GCN-NEXT: ;DEBUG_VALUE: foo:a <- $vgpr1
16 ; GCN-NEXT: global_load_dword v2, v0, s[6:7] offset:32
17 ; GCN-NEXT: ;DEBUG_VALUE: foo:b <- $vgpr2
18 ; GCN-NEXT: s_waitcnt vmcnt(0)
19 ; GCN-NEXT: v_add_f32_e32 v1, v1, v2
20 ; GCN-NEXT: global_store_dword v0, v1, s[4:5]
22 %tid = call i32 @llvm.amdgcn.workitem.id.x()
23 %out.gep = getelementptr float, ptr addrspace(1) %out, i32 %tid
24 %gep0 = getelementptr float, ptr addrspace(1) %aptr, i32 %tid
25 %gep1 = getelementptr float, ptr addrspace(1) %gep0, i32 8
26 %a = load float, ptr addrspace(1) %gep0, align 4
27 call void @llvm.dbg.value(metadata float %a, metadata !8, metadata !DIExpression()), !dbg !9
28 %b = load float, ptr addrspace(1) %gep1, align 4
29 call void @llvm.dbg.value(metadata float %b, metadata !10, metadata !DIExpression()), !dbg !11
30 %fadd = fadd float %a, %b
31 store float %fadd, ptr addrspace(1) %out.gep, align 4
35 declare i32 @llvm.amdgcn.workitem.id.x() #0
36 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
38 attributes #0 = { nounwind readnone speculatable willreturn }
39 attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }
42 !llvm.module.flags = !{!2, !3}
44 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug)
45 !1 = !DIFile(filename: "/tmp/foo.cl", directory: "/dev/null")
46 !2 = !{i32 2, !"Dwarf Version", i32 4}
47 !3 = !{i32 2, !"Debug Info Version", i32 3}
48 !4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
49 !5 = !DISubroutineType(types: !6)
51 !7 = !DIBasicType(name: "float", size: 32, align: 32)
52 !8 = !DILocalVariable(name: "a", arg: 1, scope: !4, file: !1, line: 1)
53 !9 = !DILocation(line: 1, column: 42, scope: !4)
54 !10 = !DILocalVariable(name: "b", arg: 2, scope: !4, file: !1, line: 2)
55 !11 = !DILocation(line: 2, column: 42, scope: !4)