blob: 54790912330145e5601eae0b8c8503b7df0f9590 [file] [log] [blame]
Yaxun Liu4d9a4d72017-11-16 02:54:49 +00001; RUN: llc -O0 -mtriple=amdgcn--amdhsa-amdgiz -mcpu=fiji -mattr=+amdgpu-debugger-insert-nops -verify-machineinstrs < %s | FileCheck %s --check-prefix=CHECK
2; RUN: llc -O0 -mtriple=amdgcn--amdhsa-amdgiz -mcpu=fiji -mattr=+amdgpu-debugger-insert-nops -verify-machineinstrs < %s | FileCheck %s --check-prefix=CHECKNOP
3target datalayout = "A5"
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +00004
Nirav Dave54e22f32017-03-14 00:34:14 +00005; This test expects that we have one instance for each line in some order with "s_nop 0" instances after each.
Konstantin Zhuravlyove34ead82016-05-09 18:05:42 +00006
Nirav Dave54e22f32017-03-14 00:34:14 +00007; Check that each line appears at least once
8; CHECK-DAG: test01.cl:2:3
9; CHECK-DAG: test01.cl:3:3
10; CHECK-DAG: test01.cl:4:3
Konstantin Zhuravlyove34ead82016-05-09 18:05:42 +000011
Nirav Dave54e22f32017-03-14 00:34:14 +000012
13; Check that each of each of the lines consists of the line output, followed by "s_nop 0"
14; CHECKNOP: test01.cl:{{[234]}}:3
15; CHECKNOP-NEXT: s_nop 0
16; CHECKNOP: test01.cl:{{[234]}}:3
17; CHECKNOP-NEXT: s_nop 0
18; CHECKNOP: test01.cl:{{[234]}}:3
19; CHECKNOP-NEXT: s_nop 0
Konstantin Zhuravlyove34ead82016-05-09 18:05:42 +000020
Konstantin Zhuravlyove3d322a2016-05-13 18:21:28 +000021; CHECK: test01.cl:5:{{[0-9]+}}
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +000022; CHECK-NEXT: s_nop 0
23; CHECK-NEXT: s_endpgm
24
25; Function Attrs: nounwind
Matt Arsenault3dbeefa2017-03-21 21:39:51 +000026define amdgpu_kernel void @test(i32 addrspace(1)* %A) #0 !dbg !12 {
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +000027entry:
Yaxun Liu4d9a4d72017-11-16 02:54:49 +000028 %A.addr = alloca i32 addrspace(1)*, align 4, addrspace(5)
29 store i32 addrspace(1)* %A, i32 addrspace(1)* addrspace(5)* %A.addr, align 4
30 call void @llvm.dbg.declare(metadata i32 addrspace(1)* addrspace(5)* %A.addr, metadata !17, metadata !18), !dbg !19
31 %0 = load i32 addrspace(1)*, i32 addrspace(1)* addrspace(5)* %A.addr, align 4, !dbg !20
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +000032 %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %0, i32 0, !dbg !20
Nirav Dave54e22f32017-03-14 00:34:14 +000033 store i32 1, i32 addrspace(1)* %arrayidx, align 4, !dbg !20
Yaxun Liu4d9a4d72017-11-16 02:54:49 +000034 %1 = load i32 addrspace(1)*, i32 addrspace(1)* addrspace(5)* %A.addr, align 4, !dbg !22
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +000035 %arrayidx1 = getelementptr inbounds i32, i32 addrspace(1)* %1, i32 1, !dbg !22
36 store i32 2, i32 addrspace(1)* %arrayidx1, align 4, !dbg !23
Yaxun Liu4d9a4d72017-11-16 02:54:49 +000037 %2 = load i32 addrspace(1)*, i32 addrspace(1)* addrspace(5)* %A.addr, align 4, !dbg !24
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +000038 %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %2, i32 2, !dbg !24
39 store i32 3, i32 addrspace(1)* %arrayidx2, align 4, !dbg !25
Konstantin Zhuravlyove34ead82016-05-09 18:05:42 +000040 ret void, !dbg !26
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +000041}
42
43; Function Attrs: nounwind readnone
44declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
45
Matt Arsenault45f82162016-07-11 23:35:48 +000046attributes #0 = { nounwind }
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +000047attributes #1 = { nounwind readnone }
48
49!llvm.dbg.cu = !{!0}
50!opencl.kernels = !{!3}
51!llvm.module.flags = !{!9, !10}
52!llvm.ident = !{!11}
53
Konstantin Zhuravlyove34ead82016-05-09 18:05:42 +000054!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 (trunk 268929)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
55!1 = !DIFile(filename: "test01.cl", directory: "/home/kzhuravl/Lightning/testing")
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +000056!2 = !{}
Konstantin Zhuravlyove34ead82016-05-09 18:05:42 +000057!3 = !{void (i32 addrspace(1)*)* @test, !4, !5, !6, !7, !8}
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +000058!4 = !{!"kernel_arg_addr_space", i32 1}
59!5 = !{!"kernel_arg_access_qual", !"none"}
Yaxun Liu4d9a4d72017-11-16 02:54:49 +000060!6 = !{!"kernel_arg_type", !"int addrspace(5)*"}
61!7 = !{!"kernel_arg_base_type", !"int addrspace(5)*"}
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +000062!8 = !{!"kernel_arg_type_qual", !""}
Konstantin Zhuravlyove34ead82016-05-09 18:05:42 +000063!9 = !{i32 2, !"Dwarf Version", i32 2}
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +000064!10 = !{i32 2, !"Debug Info Version", i32 3}
Konstantin Zhuravlyove34ead82016-05-09 18:05:42 +000065!11 = !{!"clang version 3.9.0 (trunk 268929)"}
66!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)
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +000067!13 = !DISubroutineType(types: !14)
68!14 = !{null, !15}
69!15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64, align: 32)
70!16 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
71!17 = !DILocalVariable(name: "A", arg: 1, scope: !12, file: !1, line: 1, type: !15)
72!18 = !DIExpression()
Konstantin Zhuravlyove34ead82016-05-09 18:05:42 +000073!19 = !DILocation(line: 1, column: 30, scope: !12)
Konstantin Zhuravlyov8c273ad2016-04-18 16:28:23 +000074!20 = !DILocation(line: 2, column: 3, scope: !12)
75!21 = !DILocation(line: 2, column: 8, scope: !12)
76!22 = !DILocation(line: 3, column: 3, scope: !12)
77!23 = !DILocation(line: 3, column: 8, scope: !12)
78!24 = !DILocation(line: 4, column: 3, scope: !12)
79!25 = !DILocation(line: 4, column: 8, scope: !12)
Konstantin Zhuravlyove34ead82016-05-09 18:05:42 +000080!26 = !DILocation(line: 5, column: 1, scope: !12)