1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn -mcpu=gfx900 -run-pass=amdgpu-regbankselect -verify-machineinstrs -regbankselect-fast -o - %s | FileCheck %s
3 # RUN: llc -mtriple=amdgcn -mcpu=gfx900 -run-pass=amdgpu-regbankselect -verify-machineinstrs -regbankselect-greedy -o - %s | FileCheck %s
11 liveins: $sgpr0, $sgpr1
13 ; CHECK-LABEL: name: umax_s32_ss
14 ; CHECK: liveins: $sgpr0, $sgpr1
16 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
17 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
18 ; CHECK-NEXT: [[UMAX:%[0-9]+]]:sgpr(s32) = G_UMAX [[COPY]], [[COPY1]]
19 ; CHECK-NEXT: $sgpr0 = COPY [[UMAX]](s32)
20 %0:_(s32) = COPY $sgpr0
21 %1:_(s32) = COPY $sgpr1
22 %2:_(s32) = G_UMAX %0, %1
32 liveins: $sgpr0, $vgpr0
34 ; CHECK-LABEL: name: umax_s32_sv
35 ; CHECK: liveins: $sgpr0, $vgpr0
37 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
38 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
39 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32)
40 ; CHECK-NEXT: [[UMAX:%[0-9]+]]:vgpr(s32) = G_UMAX [[COPY2]], [[COPY1]]
41 ; CHECK-NEXT: $vgpr0 = COPY [[UMAX]](s32)
42 %0:_(s32) = COPY $sgpr0
43 %1:_(s32) = COPY $vgpr0
44 %2:_(s32) = G_UMAX %0, %1
54 liveins: $sgpr0, $vgpr0
56 ; CHECK-LABEL: name: umax_s32_vs
57 ; CHECK: liveins: $sgpr0, $vgpr0
59 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
60 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
61 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[COPY1]](s32)
62 ; CHECK-NEXT: [[UMAX:%[0-9]+]]:vgpr(s32) = G_UMAX [[COPY]], [[COPY2]]
63 ; CHECK-NEXT: $vgpr0 = COPY [[UMAX]](s32)
64 %0:_(s32) = COPY $vgpr0
65 %1:_(s32) = COPY $sgpr0
66 %2:_(s32) = G_UMAX %0, %1
76 liveins: $vgpr0, $vgpr1
78 ; CHECK-LABEL: name: umax_s32_vv
79 ; CHECK: liveins: $vgpr0, $vgpr1
81 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
82 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
83 ; CHECK-NEXT: [[UMAX:%[0-9]+]]:vgpr(s32) = G_UMAX [[COPY]], [[COPY1]]
84 ; CHECK-NEXT: $vgpr0 = COPY [[UMAX]](s32)
85 %0:_(s32) = COPY $vgpr0
86 %1:_(s32) = COPY $vgpr1
87 %2:_(s32) = G_UMAX %0, %1
91 # FIXME: This should use VGPR instruction
93 name: umax_s32_ss_vgpr_use
98 liveins: $sgpr0, $sgpr1
100 ; CHECK-LABEL: name: umax_s32_ss_vgpr_use
101 ; CHECK: liveins: $sgpr0, $sgpr1
103 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
104 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
105 ; CHECK-NEXT: [[UMAX:%[0-9]+]]:sgpr(s32) = G_UMAX [[COPY]], [[COPY1]]
106 ; CHECK-NEXT: $vgpr0 = COPY [[UMAX]](s32)
107 %0:_(s32) = COPY $sgpr0
108 %1:_(s32) = COPY $sgpr1
109 %2:_(s32) = G_UMAX %0, %1
119 liveins: $sgpr0, $sgpr1
121 ; CHECK-LABEL: name: umax_s16_ss
122 ; CHECK: liveins: $sgpr0, $sgpr1
124 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
125 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
126 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
127 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
128 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s16)
129 ; CHECK-NEXT: [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s16)
130 ; CHECK-NEXT: [[UMAX:%[0-9]+]]:sgpr(s32) = G_UMAX [[ZEXT]], [[ZEXT1]]
131 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:sgpr(s16) = G_TRUNC [[UMAX]](s32)
132 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s16)
133 ; CHECK-NEXT: $sgpr0 = COPY [[ANYEXT]](s32)
134 %0:_(s32) = COPY $sgpr0
135 %1:_(s32) = COPY $sgpr1
136 %2:_(s16) = G_TRUNC %0
137 %3:_(s16) = G_TRUNC %1
138 %4:_(s16) = G_UMAX %2, %3
139 %5:_(s32) = G_ANYEXT %4
145 name: umax_s16_ss_vgpr_use
150 liveins: $sgpr0, $sgpr1
152 ; CHECK-LABEL: name: umax_s16_ss_vgpr_use
153 ; CHECK: liveins: $sgpr0, $sgpr1
155 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
156 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
157 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
158 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
159 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s16)
160 ; CHECK-NEXT: [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s16)
161 ; CHECK-NEXT: [[UMAX:%[0-9]+]]:sgpr(s32) = G_UMAX [[ZEXT]], [[ZEXT1]]
162 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:sgpr(s16) = G_TRUNC [[UMAX]](s32)
163 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s16)
164 ; CHECK-NEXT: $vgpr0 = COPY [[ANYEXT]](s32)
165 %0:_(s32) = COPY $sgpr0
166 %1:_(s32) = COPY $sgpr1
167 %2:_(s16) = G_TRUNC %0
168 %3:_(s16) = G_TRUNC %1
169 %4:_(s16) = G_UMAX %2, %3
170 %5:_(s32) = G_ANYEXT %4
181 liveins: $sgpr0, $sgpr1
183 ; CHECK-LABEL: name: umax_v2s16_ss
184 ; CHECK: liveins: $sgpr0, $sgpr1
186 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0
187 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr1
188 ; CHECK-NEXT: [[BITCAST:%[0-9]+]]:sgpr(s32) = G_BITCAST [[COPY]](<2 x s16>)
189 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 16
190 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:sgpr(s32) = G_LSHR [[BITCAST]], [[C]](s32)
191 ; CHECK-NEXT: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 65535
192 ; CHECK-NEXT: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[BITCAST]], [[C1]]
193 ; CHECK-NEXT: [[BITCAST1:%[0-9]+]]:sgpr(s32) = G_BITCAST [[COPY1]](<2 x s16>)
194 ; CHECK-NEXT: [[C2:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 16
195 ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:sgpr(s32) = G_LSHR [[BITCAST1]], [[C2]](s32)
196 ; CHECK-NEXT: [[C3:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 65535
197 ; CHECK-NEXT: [[AND1:%[0-9]+]]:sgpr(s32) = G_AND [[BITCAST1]], [[C3]]
198 ; CHECK-NEXT: [[UMAX:%[0-9]+]]:sgpr(s32) = G_UMAX [[AND]], [[AND1]]
199 ; CHECK-NEXT: [[UMAX1:%[0-9]+]]:sgpr(s32) = G_UMAX [[LSHR]], [[LSHR1]]
200 ; CHECK-NEXT: [[BUILD_VECTOR_TRUNC:%[0-9]+]]:sgpr(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[UMAX]](s32), [[UMAX1]](s32)
201 ; CHECK-NEXT: $sgpr0 = COPY [[BUILD_VECTOR_TRUNC]](<2 x s16>)
202 %0:_(<2 x s16>) = COPY $sgpr0
203 %1:_(<2 x s16>) = COPY $sgpr1
204 %2:_(<2 x s16>) = G_UMAX %0, %1
214 liveins: $sgpr0, $vgpr0
216 ; CHECK-LABEL: name: umax_v2s16_sv
217 ; CHECK: liveins: $sgpr0, $vgpr0
219 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0
220 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0
221 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(<2 x s16>) = COPY [[COPY]](<2 x s16>)
222 ; CHECK-NEXT: [[UMAX:%[0-9]+]]:vgpr(<2 x s16>) = G_UMAX [[COPY2]], [[COPY1]]
223 ; CHECK-NEXT: $vgpr0 = COPY [[UMAX]](<2 x s16>)
224 %0:_(<2 x s16>) = COPY $sgpr0
225 %1:_(<2 x s16>) = COPY $vgpr0
226 %2:_(<2 x s16>) = G_UMAX %0, %1
236 liveins: $sgpr0, $vgpr0
238 ; CHECK-LABEL: name: umax_v2s16_vs
239 ; CHECK: liveins: $sgpr0, $vgpr0
241 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0
242 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0
243 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(<2 x s16>) = COPY [[COPY1]](<2 x s16>)
244 ; CHECK-NEXT: [[UMAX:%[0-9]+]]:vgpr(<2 x s16>) = G_UMAX [[COPY]], [[COPY2]]
245 ; CHECK-NEXT: $vgpr0 = COPY [[UMAX]](<2 x s16>)
246 %0:_(<2 x s16>) = COPY $vgpr0
247 %1:_(<2 x s16>) = COPY $sgpr0
248 %2:_(<2 x s16>) = G_UMAX %0, %1
258 liveins: $vgpr0, $vgpr1
260 ; CHECK-LABEL: name: umax_v2s16_vv
261 ; CHECK: liveins: $vgpr0, $vgpr1
263 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0
264 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1
265 ; CHECK-NEXT: [[UMAX:%[0-9]+]]:vgpr(<2 x s16>) = G_UMAX [[COPY]], [[COPY1]]
266 ; CHECK-NEXT: $vgpr0 = COPY [[UMAX]](<2 x s16>)
267 %0:_(<2 x s16>) = COPY $vgpr0
268 %1:_(<2 x s16>) = COPY $vgpr1
269 %2:_(<2 x s16>) = G_UMAX %0, %1