1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 < %s | FileCheck %s
6 ; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
7 declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
9 declare ptr @__kmpc_alloc_shared()
11 define weak_odr void @test(i32 %0) !dbg !34 {
13 ; CHECK: .Lfunc_begin0:
14 ; CHECK-NEXT: .loc 1 288 0 ; dummy:288:0
15 ; CHECK-NEXT: .cfi_sections .debug_frame
16 ; CHECK-NEXT: .cfi_startproc
17 ; CHECK-NEXT: ; %bb.0:
18 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
19 ; CHECK-NEXT: s_mov_b32 s16, s33
20 ; CHECK-NEXT: s_mov_b32 s33, s32
21 ; CHECK-NEXT: s_or_saveexec_b64 s[18:19], -1
22 ; CHECK-NEXT: buffer_store_dword v41, off, s[0:3], s33 offset:4 ; 4-byte Folded Spill
23 ; CHECK-NEXT: s_mov_b64 exec, s[18:19]
24 ; CHECK-NEXT: v_writelane_b32 v41, s16, 16
25 ; CHECK-NEXT: v_writelane_b32 v41, s30, 0
26 ; CHECK-NEXT: v_writelane_b32 v41, s31, 1
27 ; CHECK-NEXT: v_writelane_b32 v41, s34, 2
28 ; CHECK-NEXT: v_writelane_b32 v41, s35, 3
29 ; CHECK-NEXT: v_writelane_b32 v41, s36, 4
30 ; CHECK-NEXT: v_writelane_b32 v41, s37, 5
31 ; CHECK-NEXT: v_writelane_b32 v41, s38, 6
32 ; CHECK-NEXT: v_writelane_b32 v41, s39, 7
33 ; CHECK-NEXT: v_writelane_b32 v41, s40, 8
34 ; CHECK-NEXT: v_writelane_b32 v41, s41, 9
35 ; CHECK-NEXT: v_writelane_b32 v41, s42, 10
36 ; CHECK-NEXT: v_writelane_b32 v41, s43, 11
37 ; CHECK-NEXT: v_writelane_b32 v41, s44, 12
38 ; CHECK-NEXT: s_addk_i32 s32, 0x400
39 ; CHECK-NEXT: v_writelane_b32 v41, s45, 13
40 ; CHECK-NEXT: v_writelane_b32 v41, s46, 14
41 ; CHECK-NEXT: s_mov_b64 s[40:41], s[4:5]
42 ; CHECK-NEXT: ;DEBUG_VALUE: dummy:dummy <- undef
44 ; CHECK-NEXT: .loc 1 49 9 prologue_end ; dummy:49:9
45 ; CHECK-NEXT: s_getpc_b64 s[4:5]
46 ; CHECK-NEXT: s_add_u32 s4, s4, __kmpc_alloc_shared@gotpcrel32@lo+4
47 ; CHECK-NEXT: s_addc_u32 s5, s5, __kmpc_alloc_shared@gotpcrel32@hi+12
48 ; CHECK-NEXT: v_writelane_b32 v41, s47, 15
49 ; CHECK-NEXT: s_load_dwordx2 s[46:47], s[4:5], 0x0
50 ; CHECK-NEXT: s_mov_b64 s[4:5], s[40:41]
51 ; CHECK-NEXT: buffer_store_dword v40, off, s[0:3], s33 ; 4-byte Folded Spill
52 ; CHECK-NEXT: v_mov_b32_e32 v40, v31
53 ; CHECK-NEXT: s_mov_b64 s[34:35], s[6:7]
54 ; CHECK-NEXT: s_mov_b32 s42, s15
55 ; CHECK-NEXT: s_mov_b32 s43, s14
56 ; CHECK-NEXT: s_mov_b32 s44, s13
57 ; CHECK-NEXT: s_mov_b32 s45, s12
58 ; CHECK-NEXT: s_mov_b64 s[36:37], s[10:11]
59 ; CHECK-NEXT: s_mov_b64 s[38:39], s[8:9]
60 ; CHECK-NEXT: s_waitcnt lgkmcnt(0)
61 ; CHECK-NEXT: s_swappc_b64 s[30:31], s[46:47]
62 ; CHECK-NEXT: s_mov_b64 s[4:5], s[40:41]
63 ; CHECK-NEXT: s_mov_b64 s[6:7], s[34:35]
64 ; CHECK-NEXT: s_mov_b64 s[8:9], s[38:39]
65 ; CHECK-NEXT: s_mov_b64 s[10:11], s[36:37]
66 ; CHECK-NEXT: s_mov_b32 s12, s45
67 ; CHECK-NEXT: s_mov_b32 s13, s44
68 ; CHECK-NEXT: s_mov_b32 s14, s43
69 ; CHECK-NEXT: s_mov_b32 s15, s42
70 ; CHECK-NEXT: v_mov_b32_e32 v31, v40
71 ; CHECK-NEXT: s_swappc_b64 s[30:31], s[46:47]
73 ; CHECK-NEXT: ;DEBUG_VALUE: dummy:dummy <- [$vgpr0_vgpr1+0]
74 ; CHECK-NEXT: .loc 1 0 9 is_stmt 0 ; dummy:0:9
75 ; CHECK-NEXT: buffer_load_dword v40, off, s[0:3], s33 ; 4-byte Folded Reload
76 ; CHECK-NEXT: v_mov_b32_e32 v2, 0
77 ; CHECK-NEXT: flat_store_dword v[0:1], v2
78 ; CHECK-NEXT: v_readlane_b32 s47, v41, 15
79 ; CHECK-NEXT: v_readlane_b32 s46, v41, 14
80 ; CHECK-NEXT: v_readlane_b32 s45, v41, 13
81 ; CHECK-NEXT: v_readlane_b32 s44, v41, 12
82 ; CHECK-NEXT: v_readlane_b32 s43, v41, 11
83 ; CHECK-NEXT: v_readlane_b32 s42, v41, 10
84 ; CHECK-NEXT: v_readlane_b32 s41, v41, 9
85 ; CHECK-NEXT: v_readlane_b32 s40, v41, 8
86 ; CHECK-NEXT: v_readlane_b32 s39, v41, 7
87 ; CHECK-NEXT: v_readlane_b32 s38, v41, 6
88 ; CHECK-NEXT: v_readlane_b32 s37, v41, 5
89 ; CHECK-NEXT: v_readlane_b32 s36, v41, 4
90 ; CHECK-NEXT: v_readlane_b32 s35, v41, 3
91 ; CHECK-NEXT: v_readlane_b32 s34, v41, 2
92 ; CHECK-NEXT: v_readlane_b32 s31, v41, 1
93 ; CHECK-NEXT: v_readlane_b32 s30, v41, 0
94 ; CHECK-NEXT: v_readlane_b32 s4, v41, 16
95 ; CHECK-NEXT: s_or_saveexec_b64 s[6:7], -1
96 ; CHECK-NEXT: buffer_load_dword v41, off, s[0:3], s33 offset:4 ; 4-byte Folded Reload
97 ; CHECK-NEXT: s_mov_b64 exec, s[6:7]
98 ; CHECK-NEXT: s_addk_i32 s32, 0xfc00
99 ; CHECK-NEXT: s_mov_b32 s33, s4
100 ; CHECK-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
101 ; CHECK-NEXT: s_setpc_b64 s[30:31]
102 ; CHECK-NEXT: .Ltmp2:
103 %2 = call ptr @__kmpc_alloc_shared(), !dbg !43
104 %3 = call ptr @__kmpc_alloc_shared()
105 store i32 0, ptr %3, align 4
106 call void @llvm.dbg.declare(metadata ptr %3, metadata !40, metadata !DIExpression()), !dbg !43
110 attributes #0 = { nocallback nofree nosync nounwind readnone speculatable willreturn }
112 !llvm.dbg.cu = !{!0, !25, !26}
113 !llvm.module.flags = !{!27, !28, !29, !30, !31, !32, !44}
115 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 15.0.0 (https://github.com/llvm/llvm-project.git 05256c8d95e0b15bcc502d595c15d902ff520f97)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !8, imports: !20, splitDebugInlining: false, nameTableKind: None)
116 !1 = !DIFile(filename: "dummy", directory: "dummy", checksumkind: CSK_MD5, checksum: "b67bec84bdce3730b4a6f2ed8d50b85c")
118 !3 = distinct !DICompositeType(tag: DW_TAG_enumeration_type, name: "dummy", scope: !4, file: !1, line: 49, baseType: !5, size: 32, elements: !6, identifier: "dummy")
119 !4 = !DINamespace(name: "dummy", scope: null)
120 !5 = !DIBasicType(name: "dummy", size: 32, encoding: DW_ATE_unsigned)
122 !7 = !DIEnumerator(name: "dummy", value: 0, isUnsigned: true)
123 !8 = !{!5, !9, !11, !12, !13, !14}
124 !9 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "dummy", scope: !10, file: !1, line: 49, size: 32, flags: DIFlagEnumClass, elements: !6, identifier: "dummy")
125 !10 = !DINamespace(name: "dummy", scope: !4)
126 !11 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "dummy", scope: !4, file: !1, line: 49, size: 32, flags: DIFlagEnumClass, elements: !6, identifier: "dummy")
127 !12 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "dummy", scope: !4, file: !1, line: 49, size: 32, flags: DIFlagEnumClass, elements: !6, identifier: "dummy")
128 !13 = distinct !DICompositeType(tag: DW_TAG_union_type, name: "dummy", scope: !10, file: !1, line: 49, size: 32, flags: DIFlagEnumClass, elements: !6, identifier: "dummy")
129 !14 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "dummy", scope: !10, file: !1, line: 49, size: 32, flags: DIFlagEnumClass, elements: !6, templateParams: !15, identifier: "dummy")
130 !15 = !{!16, !17, !19}
131 !16 = !DITemplateTypeParameter(name: "dummy", type: !11)
132 !17 = !DITemplateTypeParameter(name: "dummy", type: !18)
133 !18 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "dummy", scope: !10, file: !1, line: 49, size: 32, flags: DIFlagEnumClass, identifier: "dummy")
134 !19 = !DITemplateValueParameter(type: !5, value: i1 true)
136 !21 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !4, entity: !22, file: !1, line: 49)
137 !22 = !DISubprogram(name: "dummy", scope: !4, file: !1, line: 49, type: !23, flags: DIFlagEnumClass, spFlags: DISPFlagOptimized)
138 !23 = !DISubroutineType(types: !24)
140 !25 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 15.0.0 (https://github.com/llvm/llvm-project.git 05256c8d95e0b15bcc502d595c15d902ff520f97)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, imports: !20, splitDebugInlining: false, nameTableKind: None)
141 !26 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 15.0.0 (https://github.com/llvm/llvm-project.git 05256c8d95e0b15bcc502d595c15d902ff520f97)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !24, imports: !20, splitDebugInlining: false, nameTableKind: None)
142 !27 = !{i32 7, !"Dwarf Version", i32 5}
143 !28 = !{i32 2, !"Debug Info Version", i32 3}
144 !29 = !{i32 1, !"wchar_size", i32 4}
145 !30 = !{i32 7, !"openmp", i32 50}
146 !31 = !{i32 7, !"openmp-device", i32 50}
147 !32 = !{i32 7, !"PIC Level", i32 2}
148 !34 = distinct !DISubprogram(name: "dummy", linkageName: "dummy", scope: !35, file: !1, line: 49, type: !23, scopeLine: 288, flags: DIFlagEnumClass, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, declaration: !36, retainedNodes: !37)
149 !35 = distinct !DICompositeType(tag: DW_TAG_class_type, file: !1, line: 49, size: 32, flags: DIFlagEnumClass, elements: !6, identifier: "dummy")
150 !36 = !DISubprogram(name: "dummy", scope: !35, file: !1, line: 49, type: !23, scopeLine: 288, flags: DIFlagEnumClass, spFlags: DISPFlagOptimized)
151 !37 = !{!38, !40, !41, !42}
152 !38 = !DILocalVariable(name: "dummy", arg: 1, scope: !34, type: !39, flags: DIFlagEnumClass)
153 !39 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !5, size: 32)
154 !40 = !DILocalVariable(name: "dummy", arg: 2, scope: !34, file: !1, line: 49, type: !5)
155 !41 = !DILocalVariable(name: "dummy", arg: 3, scope: !34, file: !1, line: 49, type: !5)
156 !42 = !DILocalVariable(name: "dummy", arg: 4, scope: !34, file: !1, line: 49, type: !5)
157 !43 = !DILocation(line: 49, column: 9, scope: !34)
158 !44 = !{i32 1, !"amdhsa_code_object_version", i32 500}