1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 ; RUN: llc -march=amdgcn -mcpu=fiji -O0 -stop-after=irtranslator -global-isel -verify-machineinstrs -o - %s | FileCheck %s
4 ; TODO: Could potentially insert it here
5 define void @arg_align_8(ptr addrspace(1) align 8 %arg0) {
6 ; CHECK-LABEL: name: arg_align_8
7 ; CHECK: bb.1 (%ir-block.0):
8 ; CHECK-NEXT: liveins: $vgpr0, $vgpr1
10 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
11 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
12 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(p1) = G_MERGE_VALUES [[COPY]](s32), [[COPY1]](s32)
13 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 0
14 ; CHECK-NEXT: G_STORE [[C]](s8), [[MV]](p1) :: (store (s8) into %ir.arg0, align 8, addrspace 1)
15 ; CHECK-NEXT: SI_RETURN
16 store i8 0, ptr addrspace(1) %arg0, align 8
20 declare ptr addrspace(1) @returns_ptr()
21 declare align 8 ptr addrspace(1) @returns_ptr_align8()
23 define void @call_result_align_1() {
24 ; CHECK-LABEL: name: call_result_align_1
25 ; CHECK: bb.1 (%ir-block.0):
26 ; CHECK-NEXT: liveins: $sgpr12, $sgpr13, $sgpr14, $sgpr15, $vgpr31, $sgpr4_sgpr5, $sgpr6_sgpr7, $sgpr8_sgpr9, $sgpr10_sgpr11
28 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr_32(s32) = COPY $vgpr31
29 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr15
30 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:sgpr_32 = COPY $sgpr14
31 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:sgpr_32 = COPY $sgpr13
32 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:sgpr_32 = COPY $sgpr12
33 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:sgpr_64 = COPY $sgpr10_sgpr11
34 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:sgpr_64 = COPY $sgpr8_sgpr9
35 ; CHECK-NEXT: [[COPY7:%[0-9]+]]:sgpr_64 = COPY $sgpr6_sgpr7
36 ; CHECK-NEXT: [[COPY8:%[0-9]+]]:sgpr_64 = COPY $sgpr4_sgpr5
37 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 0
38 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $scc
39 ; CHECK-NEXT: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @returns_ptr
40 ; CHECK-NEXT: [[COPY9:%[0-9]+]]:_(p4) = COPY [[COPY8]]
41 ; CHECK-NEXT: [[COPY10:%[0-9]+]]:_(p4) = COPY [[COPY7]]
42 ; CHECK-NEXT: [[COPY11:%[0-9]+]]:_(p4) = COPY [[COPY6]]
43 ; CHECK-NEXT: [[COPY12:%[0-9]+]]:_(s64) = COPY [[COPY5]]
44 ; CHECK-NEXT: [[COPY13:%[0-9]+]]:_(s32) = COPY [[COPY4]]
45 ; CHECK-NEXT: [[COPY14:%[0-9]+]]:_(s32) = COPY [[COPY3]]
46 ; CHECK-NEXT: [[COPY15:%[0-9]+]]:_(s32) = COPY [[COPY2]]
47 ; CHECK-NEXT: [[COPY16:%[0-9]+]]:_(s32) = COPY [[COPY1]]
48 ; CHECK-NEXT: [[COPY17:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
49 ; CHECK-NEXT: [[COPY18:%[0-9]+]]:_(<4 x s32>) = COPY $sgpr0_sgpr1_sgpr2_sgpr3
50 ; CHECK-NEXT: $sgpr0_sgpr1_sgpr2_sgpr3 = COPY [[COPY18]](<4 x s32>)
51 ; CHECK-NEXT: $sgpr4_sgpr5 = COPY [[COPY9]](p4)
52 ; CHECK-NEXT: $sgpr6_sgpr7 = COPY [[COPY10]](p4)
53 ; CHECK-NEXT: $sgpr8_sgpr9 = COPY [[COPY11]](p4)
54 ; CHECK-NEXT: $sgpr10_sgpr11 = COPY [[COPY12]](s64)
55 ; CHECK-NEXT: $sgpr12 = COPY [[COPY13]](s32)
56 ; CHECK-NEXT: $sgpr13 = COPY [[COPY14]](s32)
57 ; CHECK-NEXT: $sgpr14 = COPY [[COPY15]](s32)
58 ; CHECK-NEXT: $sgpr15 = COPY [[COPY16]](s32)
59 ; CHECK-NEXT: $vgpr31 = COPY [[COPY17]](s32)
60 ; CHECK-NEXT: $sgpr30_sgpr31 = noconvergent G_SI_CALL [[GV]](p0), @returns_ptr, csr_amdgpu, implicit $sgpr0_sgpr1_sgpr2_sgpr3, implicit $sgpr4_sgpr5, implicit $sgpr6_sgpr7, implicit $sgpr8_sgpr9, implicit $sgpr10_sgpr11, implicit $sgpr12, implicit $sgpr13, implicit $sgpr14, implicit $sgpr15, implicit $vgpr31, implicit-def $vgpr0, implicit-def $vgpr1
61 ; CHECK-NEXT: [[COPY19:%[0-9]+]]:_(s32) = COPY $vgpr0
62 ; CHECK-NEXT: [[COPY20:%[0-9]+]]:_(s32) = COPY $vgpr1
63 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(p1) = G_MERGE_VALUES [[COPY19]](s32), [[COPY20]](s32)
64 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $scc
65 ; CHECK-NEXT: G_STORE [[C]](s8), [[MV]](p1) :: (store (s8) into %ir.ptr, addrspace 1)
66 ; CHECK-NEXT: SI_RETURN
67 %ptr = call align 1 ptr addrspace(1) @returns_ptr()
68 store i8 0, ptr addrspace(1) %ptr, align 1
72 define void @call_result_align_8() {
73 ; CHECK-LABEL: name: call_result_align_8
74 ; CHECK: bb.1 (%ir-block.0):
75 ; CHECK-NEXT: liveins: $sgpr12, $sgpr13, $sgpr14, $sgpr15, $vgpr31, $sgpr4_sgpr5, $sgpr6_sgpr7, $sgpr8_sgpr9, $sgpr10_sgpr11
77 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr_32(s32) = COPY $vgpr31
78 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr15
79 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:sgpr_32 = COPY $sgpr14
80 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:sgpr_32 = COPY $sgpr13
81 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:sgpr_32 = COPY $sgpr12
82 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:sgpr_64 = COPY $sgpr10_sgpr11
83 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:sgpr_64 = COPY $sgpr8_sgpr9
84 ; CHECK-NEXT: [[COPY7:%[0-9]+]]:sgpr_64 = COPY $sgpr6_sgpr7
85 ; CHECK-NEXT: [[COPY8:%[0-9]+]]:sgpr_64 = COPY $sgpr4_sgpr5
86 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 0
87 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $scc
88 ; CHECK-NEXT: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @returns_ptr
89 ; CHECK-NEXT: [[COPY9:%[0-9]+]]:_(p4) = COPY [[COPY8]]
90 ; CHECK-NEXT: [[COPY10:%[0-9]+]]:_(p4) = COPY [[COPY7]]
91 ; CHECK-NEXT: [[COPY11:%[0-9]+]]:_(p4) = COPY [[COPY6]]
92 ; CHECK-NEXT: [[COPY12:%[0-9]+]]:_(s64) = COPY [[COPY5]]
93 ; CHECK-NEXT: [[COPY13:%[0-9]+]]:_(s32) = COPY [[COPY4]]
94 ; CHECK-NEXT: [[COPY14:%[0-9]+]]:_(s32) = COPY [[COPY3]]
95 ; CHECK-NEXT: [[COPY15:%[0-9]+]]:_(s32) = COPY [[COPY2]]
96 ; CHECK-NEXT: [[COPY16:%[0-9]+]]:_(s32) = COPY [[COPY1]]
97 ; CHECK-NEXT: [[COPY17:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
98 ; CHECK-NEXT: [[COPY18:%[0-9]+]]:_(<4 x s32>) = COPY $sgpr0_sgpr1_sgpr2_sgpr3
99 ; CHECK-NEXT: $sgpr0_sgpr1_sgpr2_sgpr3 = COPY [[COPY18]](<4 x s32>)
100 ; CHECK-NEXT: $sgpr4_sgpr5 = COPY [[COPY9]](p4)
101 ; CHECK-NEXT: $sgpr6_sgpr7 = COPY [[COPY10]](p4)
102 ; CHECK-NEXT: $sgpr8_sgpr9 = COPY [[COPY11]](p4)
103 ; CHECK-NEXT: $sgpr10_sgpr11 = COPY [[COPY12]](s64)
104 ; CHECK-NEXT: $sgpr12 = COPY [[COPY13]](s32)
105 ; CHECK-NEXT: $sgpr13 = COPY [[COPY14]](s32)
106 ; CHECK-NEXT: $sgpr14 = COPY [[COPY15]](s32)
107 ; CHECK-NEXT: $sgpr15 = COPY [[COPY16]](s32)
108 ; CHECK-NEXT: $vgpr31 = COPY [[COPY17]](s32)
109 ; CHECK-NEXT: $sgpr30_sgpr31 = noconvergent G_SI_CALL [[GV]](p0), @returns_ptr, csr_amdgpu, implicit $sgpr0_sgpr1_sgpr2_sgpr3, implicit $sgpr4_sgpr5, implicit $sgpr6_sgpr7, implicit $sgpr8_sgpr9, implicit $sgpr10_sgpr11, implicit $sgpr12, implicit $sgpr13, implicit $sgpr14, implicit $sgpr15, implicit $vgpr31, implicit-def $vgpr0, implicit-def $vgpr1
110 ; CHECK-NEXT: [[COPY19:%[0-9]+]]:_(s32) = COPY $vgpr0
111 ; CHECK-NEXT: [[COPY20:%[0-9]+]]:_(s32) = COPY $vgpr1
112 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(p1) = G_MERGE_VALUES [[COPY19]](s32), [[COPY20]](s32)
113 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $scc
114 ; CHECK-NEXT: [[ASSERT_ALIGN:%[0-9]+]]:_(p1) = G_ASSERT_ALIGN [[MV]], 8
115 ; CHECK-NEXT: G_STORE [[C]](s8), [[ASSERT_ALIGN]](p1) :: (store (s8) into %ir.ptr, align 8, addrspace 1)
116 ; CHECK-NEXT: SI_RETURN
117 %ptr = call align 8 ptr addrspace(1) @returns_ptr()
118 store i8 0, ptr addrspace(1) %ptr, align 8
122 define void @declaration_result_align_8() {
123 ; CHECK-LABEL: name: declaration_result_align_8
124 ; CHECK: bb.1 (%ir-block.0):
125 ; CHECK-NEXT: liveins: $sgpr12, $sgpr13, $sgpr14, $sgpr15, $vgpr31, $sgpr4_sgpr5, $sgpr6_sgpr7, $sgpr8_sgpr9, $sgpr10_sgpr11
127 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr_32(s32) = COPY $vgpr31
128 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr15
129 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:sgpr_32 = COPY $sgpr14
130 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:sgpr_32 = COPY $sgpr13
131 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:sgpr_32 = COPY $sgpr12
132 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:sgpr_64 = COPY $sgpr10_sgpr11
133 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:sgpr_64 = COPY $sgpr8_sgpr9
134 ; CHECK-NEXT: [[COPY7:%[0-9]+]]:sgpr_64 = COPY $sgpr6_sgpr7
135 ; CHECK-NEXT: [[COPY8:%[0-9]+]]:sgpr_64 = COPY $sgpr4_sgpr5
136 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 0
137 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $scc
138 ; CHECK-NEXT: [[GV:%[0-9]+]]:_(p0) = G_GLOBAL_VALUE @returns_ptr_align8
139 ; CHECK-NEXT: [[COPY9:%[0-9]+]]:_(p4) = COPY [[COPY8]]
140 ; CHECK-NEXT: [[COPY10:%[0-9]+]]:_(p4) = COPY [[COPY7]]
141 ; CHECK-NEXT: [[COPY11:%[0-9]+]]:_(p4) = COPY [[COPY6]]
142 ; CHECK-NEXT: [[COPY12:%[0-9]+]]:_(s64) = COPY [[COPY5]]
143 ; CHECK-NEXT: [[COPY13:%[0-9]+]]:_(s32) = COPY [[COPY4]]
144 ; CHECK-NEXT: [[COPY14:%[0-9]+]]:_(s32) = COPY [[COPY3]]
145 ; CHECK-NEXT: [[COPY15:%[0-9]+]]:_(s32) = COPY [[COPY2]]
146 ; CHECK-NEXT: [[COPY16:%[0-9]+]]:_(s32) = COPY [[COPY1]]
147 ; CHECK-NEXT: [[COPY17:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
148 ; CHECK-NEXT: [[COPY18:%[0-9]+]]:_(<4 x s32>) = COPY $sgpr0_sgpr1_sgpr2_sgpr3
149 ; CHECK-NEXT: $sgpr0_sgpr1_sgpr2_sgpr3 = COPY [[COPY18]](<4 x s32>)
150 ; CHECK-NEXT: $sgpr4_sgpr5 = COPY [[COPY9]](p4)
151 ; CHECK-NEXT: $sgpr6_sgpr7 = COPY [[COPY10]](p4)
152 ; CHECK-NEXT: $sgpr8_sgpr9 = COPY [[COPY11]](p4)
153 ; CHECK-NEXT: $sgpr10_sgpr11 = COPY [[COPY12]](s64)
154 ; CHECK-NEXT: $sgpr12 = COPY [[COPY13]](s32)
155 ; CHECK-NEXT: $sgpr13 = COPY [[COPY14]](s32)
156 ; CHECK-NEXT: $sgpr14 = COPY [[COPY15]](s32)
157 ; CHECK-NEXT: $sgpr15 = COPY [[COPY16]](s32)
158 ; CHECK-NEXT: $vgpr31 = COPY [[COPY17]](s32)
159 ; CHECK-NEXT: $sgpr30_sgpr31 = noconvergent G_SI_CALL [[GV]](p0), @returns_ptr_align8, csr_amdgpu, implicit $sgpr0_sgpr1_sgpr2_sgpr3, implicit $sgpr4_sgpr5, implicit $sgpr6_sgpr7, implicit $sgpr8_sgpr9, implicit $sgpr10_sgpr11, implicit $sgpr12, implicit $sgpr13, implicit $sgpr14, implicit $sgpr15, implicit $vgpr31, implicit-def $vgpr0, implicit-def $vgpr1
160 ; CHECK-NEXT: [[COPY19:%[0-9]+]]:_(s32) = COPY $vgpr0
161 ; CHECK-NEXT: [[COPY20:%[0-9]+]]:_(s32) = COPY $vgpr1
162 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(p1) = G_MERGE_VALUES [[COPY19]](s32), [[COPY20]](s32)
163 ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $scc
164 ; CHECK-NEXT: [[ASSERT_ALIGN:%[0-9]+]]:_(p1) = G_ASSERT_ALIGN [[MV]], 8
165 ; CHECK-NEXT: G_STORE [[C]](s8), [[ASSERT_ALIGN]](p1) :: (store (s8) into %ir.ptr, align 8, addrspace 1)
166 ; CHECK-NEXT: SI_RETURN
167 %ptr = call ptr addrspace(1) @returns_ptr_align8()
168 store i8 0, ptr addrspace(1) %ptr, align 8
172 define ptr addrspace(1) @tail_call_assert_align() {
173 ; CHECK-LABEL: name: tail_call_assert_align
175 ; CHECK-NEXT: liveins: $sgpr12, $sgpr13, $sgpr14, $sgpr15, $vgpr31, $sgpr4_sgpr5, $sgpr6_sgpr7, $sgpr8_sgpr9, $sgpr10_sgpr11
177 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr_32(s32) = COPY $vgpr31
178 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr_32 = COPY $sgpr15
179 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:sgpr_32 = COPY $sgpr14
180 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:sgpr_32 = COPY $sgpr13
181 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:sgpr_32 = COPY $sgpr12
182 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:sgpr_64 = COPY $sgpr10_sgpr11
183 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:sgpr_64 = COPY $sgpr8_sgpr9
184 ; CHECK-NEXT: [[COPY7:%[0-9]+]]:sgpr_64 = COPY $sgpr6_sgpr7
185 ; CHECK-NEXT: [[COPY8:%[0-9]+]]:sgpr_64 = COPY $sgpr4_sgpr5
186 ; CHECK-NEXT: [[GV:%[0-9]+]]:ccr_sgpr_64(p0) = G_GLOBAL_VALUE @returns_ptr_align8
187 ; CHECK-NEXT: [[COPY9:%[0-9]+]]:_(p4) = COPY [[COPY8]]
188 ; CHECK-NEXT: [[COPY10:%[0-9]+]]:_(p4) = COPY [[COPY7]]
189 ; CHECK-NEXT: [[COPY11:%[0-9]+]]:_(p4) = COPY [[COPY6]]
190 ; CHECK-NEXT: [[COPY12:%[0-9]+]]:_(s64) = COPY [[COPY5]]
191 ; CHECK-NEXT: [[COPY13:%[0-9]+]]:_(s32) = COPY [[COPY4]]
192 ; CHECK-NEXT: [[COPY14:%[0-9]+]]:_(s32) = COPY [[COPY3]]
193 ; CHECK-NEXT: [[COPY15:%[0-9]+]]:_(s32) = COPY [[COPY2]]
194 ; CHECK-NEXT: [[COPY16:%[0-9]+]]:_(s32) = COPY [[COPY1]]
195 ; CHECK-NEXT: [[COPY17:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
196 ; CHECK-NEXT: [[COPY18:%[0-9]+]]:_(<4 x s32>) = COPY $sgpr0_sgpr1_sgpr2_sgpr3
197 ; CHECK-NEXT: $sgpr0_sgpr1_sgpr2_sgpr3 = COPY [[COPY18]](<4 x s32>)
198 ; CHECK-NEXT: $sgpr4_sgpr5 = COPY [[COPY9]](p4)
199 ; CHECK-NEXT: $sgpr6_sgpr7 = COPY [[COPY10]](p4)
200 ; CHECK-NEXT: $sgpr8_sgpr9 = COPY [[COPY11]](p4)
201 ; CHECK-NEXT: $sgpr10_sgpr11 = COPY [[COPY12]](s64)
202 ; CHECK-NEXT: $sgpr12 = COPY [[COPY13]](s32)
203 ; CHECK-NEXT: $sgpr13 = COPY [[COPY14]](s32)
204 ; CHECK-NEXT: $sgpr14 = COPY [[COPY15]](s32)
205 ; CHECK-NEXT: $sgpr15 = COPY [[COPY16]](s32)
206 ; CHECK-NEXT: $vgpr31 = COPY [[COPY17]](s32)
207 ; CHECK-NEXT: SI_TCRETURN [[GV]](p0), @returns_ptr_align8, 0, csr_amdgpu, implicit $sgpr0_sgpr1_sgpr2_sgpr3, implicit $sgpr4_sgpr5, implicit $sgpr6_sgpr7, implicit $sgpr8_sgpr9, implicit $sgpr10_sgpr11, implicit $sgpr12, implicit $sgpr13, implicit $sgpr14, implicit $sgpr15, implicit $vgpr31
209 %call = tail call ptr addrspace(1) @returns_ptr_align8()
210 ret ptr addrspace(1) %call