1 ; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs -verify-machine-dom-info -o - %s | FileCheck %s --check-prefix=W64
2 ; RUN: llc -march=amdgcn -mcpu=gfx1010 -mattr=+wavefrontsize32,-wavefrontsize64 -verify-machineinstrs -verify-machine-dom-info -o - %s | FileCheck %s --check-prefix=W32
3 ; RUN: llc -march=amdgcn -mcpu=gfx1010 -mattr=-wavefrontsize32,+wavefrontsize64 -verify-machineinstrs -verify-machine-dom-info -o - %s | FileCheck %s --check-prefix=W64
4 ; RUN: llc -O0 -march=amdgcn -mcpu=gfx900 -verify-machineinstrs -verify-machine-dom-info -o - %s | FileCheck %s --check-prefix=W64-O0
6 ; Test that we correctly legalize VGPR Rsrc operands in MUBUF instructions.
8 ; W64-LABEL: mubuf_vgpr
9 ; W64: s_mov_b64 [[SAVEEXEC:s\[[0-9]+:[0-9]+\]]], exec
10 ; W64: [[LOOPBB:BB[0-9]+_[0-9]+]]:
11 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC0:[0-9]+]], v0
12 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC1:[0-9]+]], v1
13 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC2:[0-9]+]], v2
14 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC3:[0-9]+]], v3
15 ; W64: v_cmp_eq_u64_e32 vcc, s{{\[}}[[SRSRC0]]:[[SRSRC1]]{{\]}}, v[0:1]
16 ; W64: v_cmp_eq_u64_e64 [[CMP0:s\[[0-9]+:[0-9]+\]]], s{{\[}}[[SRSRC2]]:[[SRSRC3]]{{\]}}, v[2:3]
17 ; W64: s_and_b64 [[CMP:s\[[0-9]+:[0-9]+\]]], vcc, [[CMP0]]
18 ; W64: s_and_saveexec_b64 [[CMP]], [[CMP]]
19 ; W64: s_waitcnt vmcnt(0)
20 ; W64: buffer_load_format_x [[RES:v[0-9]+]], v4, s{{\[}}[[SRSRC0]]:[[SRSRC3]]{{\]}}, 0 idxen
21 ; W64: s_xor_b64 exec, exec, [[CMP]]
22 ; W64: s_cbranch_execnz [[LOOPBB]]
23 ; W64: s_mov_b64 exec, [[SAVEEXEC]]
24 ; W64: v_mov_b32_e32 v0, [[RES]]
26 ; W32-LABEL: mubuf_vgpr
27 ; W32: s_mov_b32 [[SAVEEXEC:s[0-9]+]], exec_lo
28 ; W32: [[LOOPBB:BB[0-9]+_[0-9]+]]:
29 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC0:[0-9]+]], v0
30 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC1:[0-9]+]], v1
31 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC2:[0-9]+]], v2
32 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC3:[0-9]+]], v3
33 ; W32: v_cmp_eq_u64_e32 vcc_lo, s{{\[}}[[SRSRC0]]:[[SRSRC1]]{{\]}}, v[0:1]
34 ; W32: v_cmp_eq_u64_e64 [[CMP0:s[0-9]+]], s{{\[}}[[SRSRC2]]:[[SRSRC3]]{{\]}}, v[2:3]
35 ; W32: s_and_b32 [[CMP:s[0-9]+]], vcc_lo, [[CMP0]]
36 ; W32: s_and_saveexec_b32 [[CMP]], [[CMP]]
37 ; W32: s_waitcnt vmcnt(0)
38 ; W32: buffer_load_format_x [[RES:v[0-9]+]], v4, s{{\[}}[[SRSRC0]]:[[SRSRC3]]{{\]}}, 0 idxen
39 ; W32: s_xor_b32 exec_lo, exec_lo, [[CMP]]
40 ; W32: s_cbranch_execnz [[LOOPBB]]
41 ; W32: s_mov_b32 exec_lo, [[SAVEEXEC]]
42 ; W32: v_mov_b32_e32 v0, [[RES]]
44 define float @mubuf_vgpr(<4 x i32> %i, i32 %c) #0 {
45 %call = call float @llvm.amdgcn.buffer.load.format.f32(<4 x i32> %i, i32 %c, i32 0, i1 zeroext false, i1 zeroext false) #1
50 ; W64-LABEL: mubuf_vgpr_adjacent_in_block
52 ; W64: s_mov_b64 [[SAVEEXEC:s\[[0-9]+:[0-9]+\]]], exec
53 ; W64: [[LOOPBB0:BB[0-9]+_[0-9]+]]:
54 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC0:[0-9]+]], v0
55 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC1:[0-9]+]], v1
56 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC2:[0-9]+]], v2
57 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC3:[0-9]+]], v3
58 ; W64: v_cmp_eq_u64_e32 vcc, s{{\[}}[[SRSRC0]]:[[SRSRC1]]{{\]}}, v[0:1]
59 ; W64: v_cmp_eq_u64_e64 [[CMP0:s\[[0-9]+:[0-9]+\]]], s{{\[}}[[SRSRC2]]:[[SRSRC3]]{{\]}}, v[2:3]
60 ; W64: s_and_b64 [[CMP:s\[[0-9]+:[0-9]+\]]], vcc, [[CMP0]]
61 ; W64: s_and_saveexec_b64 [[CMP]], [[CMP]]
62 ; W64: s_waitcnt vmcnt(0)
63 ; W64: buffer_load_format_x [[RES0:v[0-9]+]], v8, s{{\[}}[[SRSRC0]]:[[SRSRC3]]{{\]}}, 0 idxen
64 ; W64: s_xor_b64 exec, exec, [[CMP]]
65 ; W64: s_cbranch_execnz [[LOOPBB0]]
67 ; W64: s_mov_b64 exec, [[SAVEEXEC]]
68 ; FIXME: redundant s_mov
69 ; W64: s_mov_b64 [[SAVEEXEC:s\[[0-9]+:[0-9]+\]]], exec
71 ; W64: [[LOOPBB1:BB[0-9]+_[0-9]+]]:
72 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC0:[0-9]+]], v4
73 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC1:[0-9]+]], v5
74 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC2:[0-9]+]], v6
75 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC3:[0-9]+]], v7
76 ; W64: v_cmp_eq_u64_e32 vcc, s{{\[}}[[SRSRC0]]:[[SRSRC1]]{{\]}}, v[4:5]
77 ; W64: v_cmp_eq_u64_e64 [[CMP0:s\[[0-9]+:[0-9]+\]]], s{{\[}}[[SRSRC2]]:[[SRSRC3]]{{\]}}, v[6:7]
78 ; W64: s_and_b64 [[CMP:s\[[0-9]+:[0-9]+\]]], vcc, [[CMP0]]
79 ; W64: s_and_saveexec_b64 [[CMP]], [[CMP]]
80 ; W64: s_waitcnt vmcnt(0)
81 ; W64: buffer_load_format_x [[RES1:v[0-9]+]], v8, s{{\[}}[[SRSRC0]]:[[SRSRC3]]{{\]}}, 0 idxen
82 ; W64: s_xor_b64 exec, exec, [[CMP]]
83 ; W64: s_cbranch_execnz [[LOOPBB1]]
85 ; W64: s_mov_b64 exec, [[SAVEEXEC]]
86 ; W64-DAG: global_store_dword v[9:10], [[RES0]], off
87 ; W64-DAG: global_store_dword v[11:12], [[RES1]], off
90 ; W32-LABEL: mubuf_vgpr_adjacent_in_block
92 ; W32: s_mov_b32 [[SAVEEXEC:s[0-9]+]], exec_lo
93 ; W32: [[LOOPBB0:BB[0-9]+_[0-9]+]]:
94 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC0:[0-9]+]], v0
95 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC1:[0-9]+]], v1
96 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC2:[0-9]+]], v2
97 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC3:[0-9]+]], v3
98 ; W32: v_cmp_eq_u64_e32 vcc_lo, s{{\[}}[[SRSRC0]]:[[SRSRC1]]{{\]}}, v[0:1]
99 ; W32: v_cmp_eq_u64_e64 [[CMP0:s[0-9]+]], s{{\[}}[[SRSRC2]]:[[SRSRC3]]{{\]}}, v[2:3]
100 ; W32: s_and_b32 [[CMP:s[0-9]+]], vcc_lo, [[CMP0]]
101 ; W32: s_and_saveexec_b32 [[CMP]], [[CMP]]
102 ; W32: s_waitcnt vmcnt(0)
103 ; W32: buffer_load_format_x [[RES0:v[0-9]+]], v8, s{{\[}}[[SRSRC0]]:[[SRSRC3]]{{\]}}, 0 idxen
104 ; W32: s_xor_b32 exec_lo, exec_lo, [[CMP]]
105 ; W32: s_cbranch_execnz [[LOOPBB0]]
107 ; W32: s_mov_b32 exec_lo, [[SAVEEXEC]]
108 ; FIXME: redundant s_mov
109 ; W32: s_mov_b32 [[SAVEEXEC:s[0-9]+]], exec_lo
111 ; W32: [[LOOPBB1:BB[0-9]+_[0-9]+]]:
112 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC0:[0-9]+]], v4
113 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC1:[0-9]+]], v5
114 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC2:[0-9]+]], v6
115 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC3:[0-9]+]], v7
116 ; W32: v_cmp_eq_u64_e32 vcc_lo, s{{\[}}[[SRSRC0]]:[[SRSRC1]]{{\]}}, v[4:5]
117 ; W32: v_cmp_eq_u64_e64 [[CMP0:s[0-9]+]], s{{\[}}[[SRSRC2]]:[[SRSRC3]]{{\]}}, v[6:7]
118 ; W32: s_and_b32 [[CMP:s[0-9]+]], vcc_lo, [[CMP0]]
119 ; W32: s_and_saveexec_b32 [[CMP]], [[CMP]]
120 ; W32: s_waitcnt vmcnt(0)
121 ; W32: buffer_load_format_x [[RES1:v[0-9]+]], v8, s{{\[}}[[SRSRC0]]:[[SRSRC3]]{{\]}}, 0 idxen
122 ; W32: s_xor_b32 exec_lo, exec_lo, [[CMP]]
123 ; W32: s_cbranch_execnz [[LOOPBB1]]
125 ; W32: s_mov_b32 exec_lo, [[SAVEEXEC]]
126 ; W32-DAG: global_store_dword v[9:10], [[RES0]], off
127 ; W32-DAG: global_store_dword v[11:12], [[RES1]], off
129 define void @mubuf_vgpr_adjacent_in_block(<4 x i32> %i, <4 x i32> %j, i32 %c, float addrspace(1)* %out0, float addrspace(1)* %out1) #0 {
131 %val0 = call float @llvm.amdgcn.buffer.load.format.f32(<4 x i32> %i, i32 %c, i32 0, i1 zeroext false, i1 zeroext false) #1
132 %val1 = call float @llvm.amdgcn.buffer.load.format.f32(<4 x i32> %j, i32 %c, i32 0, i1 zeroext false, i1 zeroext false) #1
133 store volatile float %val0, float addrspace(1)* %out0
134 store volatile float %val1, float addrspace(1)* %out1
139 ; W64-LABEL: mubuf_vgpr_outside_entry
141 ; W64-DAG: v_mov_b32_e32 [[IDX:v[0-9]+]], s4
142 ; W64-DAG: s_mov_b64 [[SAVEEXEC:s\[[0-9]+:[0-9]+\]]], exec
144 ; W64: [[LOOPBB0:BB[0-9]+_[0-9]+]]:
145 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC0:[0-9]+]], v0
146 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC1:[0-9]+]], v1
147 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC2:[0-9]+]], v2
148 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC3:[0-9]+]], v3
149 ; W64: v_cmp_eq_u64_e32 vcc, s{{\[}}[[SRSRC0]]:[[SRSRC1]]{{\]}}, v[0:1]
150 ; W64: v_cmp_eq_u64_e64 [[CMP0:s\[[0-9]+:[0-9]+\]]], s{{\[}}[[SRSRC2]]:[[SRSRC3]]{{\]}}, v[2:3]
151 ; W64: s_and_b64 [[CMP:s\[[0-9]+:[0-9]+\]]], vcc, [[CMP0]]
152 ; W64: s_and_saveexec_b64 [[CMP]], [[CMP]]
153 ; W64: s_waitcnt vmcnt(0)
154 ; W64: buffer_load_format_x [[RES:v[0-9]+]], [[IDX]], s{{\[}}[[SRSRC0]]:[[SRSRC3]]{{\]}}, 0 idxen
155 ; W64: s_xor_b64 exec, exec, [[CMP]]
156 ; W64: s_cbranch_execnz [[LOOPBB0]]
158 ; W64: s_mov_b64 exec, [[SAVEEXEC]]
159 ; W64: s_cbranch_execz [[TERMBB:BB[0-9]+_[0-9]+]]
161 ; W64: BB{{[0-9]+_[0-9]+}}:
162 ; W64-DAG: v_mov_b32_e32 [[IDX:v[0-9]+]], s4
163 ; W64-DAG: s_mov_b64 [[SAVEEXEC:s\[[0-9]+:[0-9]+\]]], exec
165 ; W64: [[LOOPBB1:BB[0-9]+_[0-9]+]]:
166 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC0:[0-9]+]], v4
167 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC1:[0-9]+]], v5
168 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC2:[0-9]+]], v6
169 ; W64-DAG: v_readfirstlane_b32 s[[SRSRC3:[0-9]+]], v7
170 ; W64: v_cmp_eq_u64_e32 vcc, s{{\[}}[[SRSRC0]]:[[SRSRC1]]{{\]}}, v[4:5]
171 ; W64: v_cmp_eq_u64_e64 [[CMP0:s\[[0-9]+:[0-9]+\]]], s{{\[}}[[SRSRC2]]:[[SRSRC3]]{{\]}}, v[6:7]
172 ; W64: s_and_b64 [[CMP:s\[[0-9]+:[0-9]+\]]], vcc, [[CMP0]]
173 ; W64: s_and_saveexec_b64 [[CMP]], [[CMP]]
174 ; W64: s_waitcnt vmcnt(0)
175 ; W64: buffer_load_format_x [[RES]], [[IDX]], s{{\[}}[[SRSRC0]]:[[SRSRC3]]{{\]}}, 0 idxen
176 ; W64: s_xor_b64 exec, exec, [[CMP]]
177 ; W64: s_cbranch_execnz [[LOOPBB1]]
179 ; W64: s_mov_b64 exec, [[SAVEEXEC]]
182 ; W64: global_store_dword v[11:12], [[RES]], off
185 ; W32-LABEL: mubuf_vgpr_outside_entry
187 ; W32-DAG: v_mov_b32_e32 [[IDX:v[0-9]+]], s4
188 ; W32-DAG: s_mov_b32 [[SAVEEXEC:s[0-9]+]], exec_lo
190 ; W32: [[LOOPBB0:BB[0-9]+_[0-9]+]]:
191 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC0:[0-9]+]], v0
192 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC1:[0-9]+]], v1
193 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC2:[0-9]+]], v2
194 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC3:[0-9]+]], v3
195 ; W32: v_cmp_eq_u64_e32 vcc_lo, s{{\[}}[[SRSRC0]]:[[SRSRC1]]{{\]}}, v[0:1]
196 ; W32: v_cmp_eq_u64_e64 [[CMP0:s[0-9]+]], s{{\[}}[[SRSRC2]]:[[SRSRC3]]{{\]}}, v[2:3]
197 ; W32: s_and_b32 [[CMP:s[0-9]+]], vcc_lo, [[CMP0]]
198 ; W32: s_and_saveexec_b32 [[CMP]], [[CMP]]
199 ; W32: s_waitcnt vmcnt(0)
200 ; W32: buffer_load_format_x [[RES:v[0-9]+]], [[IDX]], s{{\[}}[[SRSRC0]]:[[SRSRC3]]{{\]}}, 0 idxen
201 ; W32: s_xor_b32 exec_lo, exec_lo, [[CMP]]
202 ; W32: s_cbranch_execnz [[LOOPBB0]]
204 ; W32: s_mov_b32 exec_lo, [[SAVEEXEC]]
205 ; W32: s_cbranch_execz [[TERMBB:BB[0-9]+_[0-9]+]]
207 ; W32: BB{{[0-9]+_[0-9]+}}:
208 ; W32-DAG: v_mov_b32_e32 [[IDX:v[0-9]+]], s4
209 ; W32-DAG: s_mov_b32 [[SAVEEXEC:s[0-9]+]], exec_lo
211 ; W32: [[LOOPBB1:BB[0-9]+_[0-9]+]]:
212 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC0:[0-9]+]], v4
213 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC1:[0-9]+]], v5
214 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC2:[0-9]+]], v6
215 ; W32-DAG: v_readfirstlane_b32 s[[SRSRC3:[0-9]+]], v7
216 ; W32: v_cmp_eq_u64_e32 vcc_lo, s{{\[}}[[SRSRC0]]:[[SRSRC1]]{{\]}}, v[4:5]
217 ; W32: v_cmp_eq_u64_e64 [[CMP0:s[0-9]+]], s{{\[}}[[SRSRC2]]:[[SRSRC3]]{{\]}}, v[6:7]
218 ; W32: s_and_b32 [[CMP:s[0-9]+]], vcc_lo, [[CMP0]]
219 ; W32: s_and_saveexec_b32 [[CMP]], [[CMP]]
220 ; W32: s_waitcnt vmcnt(0)
221 ; W32: buffer_load_format_x [[RES]], [[IDX]], s{{\[}}[[SRSRC0]]:[[SRSRC3]]{{\]}}, 0 idxen
222 ; W32: s_xor_b32 exec_lo, exec_lo, [[CMP]]
223 ; W32: s_cbranch_execnz [[LOOPBB1]]
225 ; W32: s_mov_b32 exec_lo, [[SAVEEXEC]]
228 ; W32: global_store_dword v[11:12], [[RES]], off
231 ; Confirm spills do not occur between the XOR and branch that terminate the
232 ; waterfall loop BBs.
234 ; W64-O0-LABEL: mubuf_vgpr_outside_entry
236 ; W64-O0-DAG: s_mov_b32 [[IDX_S:s[0-9]+]], s4
237 ; W64-O0-DAG: v_mov_b32_e32 [[IDX_V:v[0-9]+]], s4
238 ; W64-O0-DAG: s_mov_b64 [[SAVEEXEC:s\[[0-9]+:[0-9]+\]]], exec
239 ; W64-O0-DAG: buffer_store_dword [[IDX_V]], off, s[0:3], s32 offset:[[IDX_OFF:[0-9]+]] ; 4-byte Folded Spill
241 ; W64-O0: [[LOOPBB0:BB[0-9]+_[0-9]+]]:
242 ; W64-O0: buffer_load_dword v[[VRSRC0:[0-9]+]], {{.*}} ; 4-byte Folded Reload
243 ; W64-O0: s_waitcnt vmcnt(0)
244 ; W64-O0: buffer_load_dword v[[VRSRC1:[0-9]+]], {{.*}} ; 4-byte Folded Reload
245 ; W64-O0: s_waitcnt vmcnt(0)
246 ; W64-O0: buffer_load_dword v[[VRSRC2:[0-9]+]], {{.*}} ; 4-byte Folded Reload
247 ; W64-O0: s_waitcnt vmcnt(0)
248 ; W64-O0: buffer_load_dword v[[VRSRC3:[0-9]+]], {{.*}} ; 4-byte Folded Reload
249 ; W64-O0: s_waitcnt vmcnt(0)
250 ; W64-O0-DAG: v_readfirstlane_b32 s[[SRSRCTMP0:[0-9]+]], v[[VRSRC0]]
251 ; W64-O0-DAG: v_readfirstlane_b32 s[[SRSRCTMP1:[0-9]+]], v[[VRSRC1]]
252 ; W64-O0-DAG: v_readfirstlane_b32 s[[SRSRCTMP2:[0-9]+]], v[[VRSRC2]]
253 ; W64-O0-DAG: v_readfirstlane_b32 s[[SRSRCTMP3:[0-9]+]], v[[VRSRC3]]
254 ; W64-O0-DAG: s_mov_b32 s[[SRSRC0:[0-9]+]], s[[SRSRCTMP0]]
255 ; W64-O0-DAG: s_mov_b32 s[[SRSRC1:[0-9]+]], s[[SRSRCTMP1]]
256 ; W64-O0-DAG: s_mov_b32 s[[SRSRC2:[0-9]+]], s[[SRSRCTMP2]]
257 ; W64-O0-DAG: s_mov_b32 s[[SRSRC3:[0-9]+]], s[[SRSRCTMP3]]
258 ; W64-O0: v_cmp_eq_u64_e64 [[CMP0:s\[[0-9]+:[0-9]+\]]], s{{\[}}[[SRSRC0]]:[[SRSRC1]]{{\]}}, v{{\[}}[[VRSRC0]]:[[VRSRC1]]{{\]}}
259 ; W64-O0: v_cmp_eq_u64_e64 [[CMP1:s\[[0-9]+:[0-9]+\]]], s{{\[}}[[SRSRC2]]:[[SRSRC3]]{{\]}}, v{{\[}}[[VRSRC2]]:[[VRSRC3]]{{\]}}
260 ; W64-O0: s_and_b64 [[CMP:s\[[0-9]+:[0-9]+\]]], [[CMP0]], [[CMP1]]
261 ; W64-O0: s_and_saveexec_b64 [[CMP]], [[CMP]]
262 ; W64-O0: buffer_load_dword [[IDX:v[0-9]+]], off, s[0:3], s32 offset:[[IDX_OFF]] ; 4-byte Folded Reload
263 ; W64-O0: buffer_load_format_x [[RES:v[0-9]+]], [[IDX]], s{{\[}}[[SRSRC0]]:[[SRSRC3]]{{\]}}, {{.*}} idxen
264 ; W64-O0: s_waitcnt vmcnt(0)
265 ; W64-O0: buffer_store_dword [[RES]], off, s[0:3], s32 offset:[[RES_OFF_TMP:[0-9]+]] ; 4-byte Folded Spill
266 ; W64-O0: s_xor_b64 exec, exec, [[CMP]]
267 ; W64-O0-NEXT: s_cbranch_execnz [[LOOPBB0]]
268 ; CHECK-O0: s_mov_b64 exec, [[SAVEEXEC]]
269 ; W64-O0: buffer_load_dword [[RES:v[0-9]+]], off, s[0:3], s32 offset:[[RES_OFF_TMP]] ; 4-byte Folded Reload
270 ; W64-O0: buffer_store_dword [[RES]], off, s[0:3], s32 offset:[[RES_OFF:[0-9]+]] ; 4-byte Folded Spill
271 ; W64-O0: s_cbranch_execz [[TERMBB:BB[0-9]+_[0-9]+]]
273 ; W64-O0: BB{{[0-9]+_[0-9]+}}:
274 ; W64-O0-DAG: s_mov_b64 s{{\[}}[[SAVEEXEC0:[0-9]+]]:[[SAVEEXEC1:[0-9]+]]{{\]}}, exec
275 ; W64-O0-DAG: buffer_store_dword {{v[0-9]+}}, off, s[0:3], s32 offset:[[IDX_OFF:[0-9]+]] ; 4-byte Folded Spill
276 ; W64-O0: v_writelane_b32 [[VSAVEEXEC:v[0-9]+]], s[[SAVEEXEC0]], [[SAVEEXEC_IDX0:[0-9]+]]
277 ; W64-O0: v_writelane_b32 [[VSAVEEXEC:v[0-9]+]], s[[SAVEEXEC1]], [[SAVEEXEC_IDX1:[0-9]+]]
279 ; W64-O0: [[LOOPBB1:BB[0-9]+_[0-9]+]]:
280 ; W64-O0: buffer_load_dword v[[VRSRC0:[0-9]+]], {{.*}} ; 4-byte Folded Reload
281 ; W64-O0: s_waitcnt vmcnt(0)
282 ; W64-O0: buffer_load_dword v[[VRSRC1:[0-9]+]], {{.*}} ; 4-byte Folded Reload
283 ; W64-O0: s_waitcnt vmcnt(0)
284 ; W64-O0: buffer_load_dword v[[VRSRC2:[0-9]+]], {{.*}} ; 4-byte Folded Reload
285 ; W64-O0: s_waitcnt vmcnt(0)
286 ; W64-O0: buffer_load_dword v[[VRSRC3:[0-9]+]], {{.*}} ; 4-byte Folded Reload
287 ; W64-O0: s_waitcnt vmcnt(0)
288 ; W64-O0-DAG: v_readfirstlane_b32 s[[SRSRCTMP0:[0-9]+]], v[[VRSRC0]]
289 ; W64-O0-DAG: v_readfirstlane_b32 s[[SRSRCTMP1:[0-9]+]], v[[VRSRC1]]
290 ; W64-O0-DAG: v_readfirstlane_b32 s[[SRSRCTMP2:[0-9]+]], v[[VRSRC2]]
291 ; W64-O0-DAG: v_readfirstlane_b32 s[[SRSRCTMP3:[0-9]+]], v[[VRSRC3]]
292 ; W64-O0-DAG: s_mov_b32 s[[SRSRC0:[0-9]+]], s[[SRSRCTMP0]]
293 ; W64-O0-DAG: s_mov_b32 s[[SRSRC1:[0-9]+]], s[[SRSRCTMP1]]
294 ; W64-O0-DAG: s_mov_b32 s[[SRSRC2:[0-9]+]], s[[SRSRCTMP2]]
295 ; W64-O0-DAG: s_mov_b32 s[[SRSRC3:[0-9]+]], s[[SRSRCTMP3]]
296 ; W64-O0: v_cmp_eq_u64_e64 [[CMP0:s\[[0-9]+:[0-9]+\]]], s{{\[}}[[SRSRC0]]:[[SRSRC1]]{{\]}}, v{{\[}}[[VRSRC0]]:[[VRSRC1]]{{\]}}
297 ; W64-O0: v_cmp_eq_u64_e64 [[CMP1:s\[[0-9]+:[0-9]+\]]], s{{\[}}[[SRSRC2]]:[[SRSRC3]]{{\]}}, v{{\[}}[[VRSRC2]]:[[VRSRC3]]{{\]}}
298 ; W64-O0: s_and_b64 [[CMP:s\[[0-9]+:[0-9]+\]]], [[CMP0]], [[CMP1]]
299 ; W64-O0: s_and_saveexec_b64 [[CMP]], [[CMP]]
300 ; W64-O0: buffer_load_dword [[IDX:v[0-9]+]], off, s[0:3], s32 offset:[[IDX_OFF]] ; 4-byte Folded Reload
301 ; W64-O0: buffer_load_format_x [[RES:v[0-9]+]], [[IDX]], s{{\[}}[[SRSRC0]]:[[SRSRC3]]{{\]}}, {{.*}} idxen
302 ; W64-O0: s_waitcnt vmcnt(0)
303 ; W64-O0: buffer_store_dword [[RES]], off, s[0:3], s32 offset:[[RES_OFF_TMP:[0-9]+]] ; 4-byte Folded Spill
304 ; W64-O0: s_xor_b64 exec, exec, [[CMP]]
305 ; W64-O0-NEXT: s_cbranch_execnz [[LOOPBB1]]
307 ; W64-O0: v_readlane_b32 s[[SAVEEXEC0:[0-9]+]], [[VSAVEEXEC]], [[SAVEEXEC_IDX0]]
308 ; W64-O0: v_readlane_b32 s[[SAVEEXEC1:[0-9]+]], [[VSAVEEXEC]], [[SAVEEXEC_IDX1]]
309 ; W64-O0: s_mov_b64 exec, s{{\[}}[[SAVEEXEC0]]:[[SAVEEXEC1]]{{\]}}
310 ; W64-O0: buffer_load_dword [[RES:v[0-9]+]], off, s[0:3], s32 offset:[[RES_OFF_TMP]] ; 4-byte Folded Reload
311 ; W64-O0: buffer_store_dword [[RES]], off, s[0:3], s32 offset:[[RES_OFF]] ; 4-byte Folded Spill
313 ; W64-O0: [[TERMBB]]:
314 ; W64-O0: buffer_load_dword [[RES:v[0-9]+]], off, s[0:3], s32 offset:[[RES_OFF]] ; 4-byte Folded Reload
315 ; W64-O0: global_store_dword v[{{[0-9]+:[0-9]+}}], [[RES]], off
317 define void @mubuf_vgpr_outside_entry(<4 x i32> %i, <4 x i32> %j, i32 %c, float addrspace(1)* %in, float addrspace(1)* %out) #0 {
319 %live.out.reg = call i32 asm sideeffect "s_mov_b32 $0, 17", "={s4}" ()
320 %val0 = call float @llvm.amdgcn.buffer.load.format.f32(<4 x i32> %i, i32 %live.out.reg, i32 0, i1 zeroext false, i1 zeroext false) #1
321 %idx = call i32 @llvm.amdgcn.workitem.id.x() #1
322 %cmp = icmp eq i32 %idx, 0
323 br i1 %cmp, label %bb1, label %bb2
326 %val1 = call float @llvm.amdgcn.buffer.load.format.f32(<4 x i32> %j, i32 %live.out.reg, i32 0, i1 zeroext false, i1 zeroext false) #1
330 %val = phi float [ %val0, %entry ], [ %val1, %bb1 ]
331 store volatile float %val, float addrspace(1)* %out
335 declare i32 @llvm.amdgcn.workitem.id.x() #1
336 declare float @llvm.amdgcn.buffer.load.format.f32(<4 x i32>, i32, i32, i1, i1) #1
338 attributes #0 = { nounwind }
339 attributes #1 = { nounwind readnone }