1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=amdgpu-regbankselect -verify-machineinstrs -regbankselect-fast -o - %s | FileCheck %s
3 # RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=amdgpu-regbankselect -verify-machineinstrs -regbankselect-greedy -o - %s | FileCheck %s
11 liveins: $sgpr0, $sgpr1
13 ; CHECK-LABEL: name: smin_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: [[SMIN:%[0-9]+]]:sgpr(s32) = G_SMIN [[COPY]], [[COPY1]]
19 ; CHECK-NEXT: $sgpr0 = COPY [[SMIN]](s32)
20 %0:_(s32) = COPY $sgpr0
21 %1:_(s32) = COPY $sgpr1
22 %2:_(s32) = G_SMIN %0, %1
32 liveins: $sgpr0, $vgpr0
34 ; CHECK-LABEL: name: smin_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: [[SMIN:%[0-9]+]]:vgpr(s32) = G_SMIN [[COPY2]], [[COPY1]]
41 ; CHECK-NEXT: $vgpr0 = COPY [[SMIN]](s32)
42 %0:_(s32) = COPY $sgpr0
43 %1:_(s32) = COPY $vgpr0
44 %2:_(s32) = G_SMIN %0, %1
54 liveins: $sgpr0, $vgpr0
56 ; CHECK-LABEL: name: smin_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: [[SMIN:%[0-9]+]]:vgpr(s32) = G_SMIN [[COPY]], [[COPY2]]
63 ; CHECK-NEXT: $vgpr0 = COPY [[SMIN]](s32)
64 %0:_(s32) = COPY $vgpr0
65 %1:_(s32) = COPY $sgpr0
66 %2:_(s32) = G_SMIN %0, %1
76 liveins: $vgpr0, $vgpr1
78 ; CHECK-LABEL: name: smin_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: [[SMIN:%[0-9]+]]:vgpr(s32) = G_SMIN [[COPY]], [[COPY1]]
84 ; CHECK-NEXT: $vgpr0 = COPY [[SMIN]](s32)
85 %0:_(s32) = COPY $vgpr0
86 %1:_(s32) = COPY $vgpr1
87 %2:_(s32) = G_SMIN %0, %1
91 # FIXME: This should use VGPR instruction
93 name: smin_s32_ss_vgpr_use
98 liveins: $sgpr0, $sgpr1
100 ; CHECK-LABEL: name: smin_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: [[SMIN:%[0-9]+]]:sgpr(s32) = G_SMIN [[COPY]], [[COPY1]]
106 ; CHECK-NEXT: $vgpr0 = COPY [[SMIN]](s32)
107 %0:_(s32) = COPY $sgpr0
108 %1:_(s32) = COPY $sgpr1
109 %2:_(s32) = G_SMIN %0, %1
119 liveins: $sgpr0, $sgpr1
121 ; CHECK-LABEL: name: smin_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: [[SEXT:%[0-9]+]]:sgpr(s32) = G_SEXT [[TRUNC]](s16)
129 ; CHECK-NEXT: [[SEXT1:%[0-9]+]]:sgpr(s32) = G_SEXT [[TRUNC1]](s16)
130 ; CHECK-NEXT: [[SMIN:%[0-9]+]]:sgpr(s32) = G_SMIN [[SEXT]], [[SEXT1]]
131 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:sgpr(s16) = G_TRUNC [[SMIN]](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_SMIN %2, %3
139 %5:_(s32) = G_ANYEXT %4
145 name: smin_s16_ss_vgpr_use
150 liveins: $sgpr0, $sgpr1
152 ; CHECK-LABEL: name: smin_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: [[SEXT:%[0-9]+]]:sgpr(s32) = G_SEXT [[TRUNC]](s16)
160 ; CHECK-NEXT: [[SEXT1:%[0-9]+]]:sgpr(s32) = G_SEXT [[TRUNC1]](s16)
161 ; CHECK-NEXT: [[SMIN:%[0-9]+]]:sgpr(s32) = G_SMIN [[SEXT]], [[SEXT1]]
162 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:sgpr(s16) = G_TRUNC [[SMIN]](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_SMIN %2, %3
170 %5:_(s32) = G_ANYEXT %4
181 liveins: $sgpr0, $sgpr1
183 ; CHECK-LABEL: name: smin_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: [[SEXT_INREG:%[0-9]+]]:sgpr(s32) = G_SEXT_INREG [[BITCAST]], 16
190 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 16
191 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:sgpr(s32) = G_ASHR [[BITCAST]], [[C]](s32)
192 ; CHECK-NEXT: [[BITCAST1:%[0-9]+]]:sgpr(s32) = G_BITCAST [[COPY1]](<2 x s16>)
193 ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:sgpr(s32) = G_SEXT_INREG [[BITCAST1]], 16
194 ; CHECK-NEXT: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 16
195 ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:sgpr(s32) = G_ASHR [[BITCAST1]], [[C1]](s32)
196 ; CHECK-NEXT: [[SMIN:%[0-9]+]]:sgpr(s32) = G_SMIN [[SEXT_INREG]], [[SEXT_INREG1]]
197 ; CHECK-NEXT: [[SMIN1:%[0-9]+]]:sgpr(s32) = G_SMIN [[ASHR]], [[ASHR1]]
198 ; CHECK-NEXT: [[BUILD_VECTOR_TRUNC:%[0-9]+]]:sgpr(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[SMIN]](s32), [[SMIN1]](s32)
199 ; CHECK-NEXT: $sgpr0 = COPY [[BUILD_VECTOR_TRUNC]](<2 x s16>)
200 %0:_(<2 x s16>) = COPY $sgpr0
201 %1:_(<2 x s16>) = COPY $sgpr1
202 %2:_(<2 x s16>) = G_SMIN %0, %1
212 liveins: $sgpr0, $vgpr0
214 ; CHECK-LABEL: name: smin_v2s16_sv
215 ; CHECK: liveins: $sgpr0, $vgpr0
217 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0
218 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0
219 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(<2 x s16>) = COPY [[COPY]](<2 x s16>)
220 ; CHECK-NEXT: [[SMIN:%[0-9]+]]:vgpr(<2 x s16>) = G_SMIN [[COPY2]], [[COPY1]]
221 ; CHECK-NEXT: $vgpr0 = COPY [[SMIN]](<2 x s16>)
222 %0:_(<2 x s16>) = COPY $sgpr0
223 %1:_(<2 x s16>) = COPY $vgpr0
224 %2:_(<2 x s16>) = G_SMIN %0, %1
234 liveins: $sgpr0, $vgpr0
236 ; CHECK-LABEL: name: smin_v2s16_vs
237 ; CHECK: liveins: $sgpr0, $vgpr0
239 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0
240 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0
241 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(<2 x s16>) = COPY [[COPY1]](<2 x s16>)
242 ; CHECK-NEXT: [[SMIN:%[0-9]+]]:vgpr(<2 x s16>) = G_SMIN [[COPY]], [[COPY2]]
243 ; CHECK-NEXT: $vgpr0 = COPY [[SMIN]](<2 x s16>)
244 %0:_(<2 x s16>) = COPY $vgpr0
245 %1:_(<2 x s16>) = COPY $sgpr0
246 %2:_(<2 x s16>) = G_SMIN %0, %1
256 liveins: $vgpr0, $vgpr1
258 ; CHECK-LABEL: name: smin_v2s16_vv
259 ; CHECK: liveins: $vgpr0, $vgpr1
261 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0
262 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1
263 ; CHECK-NEXT: [[SMIN:%[0-9]+]]:vgpr(<2 x s16>) = G_SMIN [[COPY]], [[COPY1]]
264 ; CHECK-NEXT: $vgpr0 = COPY [[SMIN]](<2 x s16>)
265 %0:_(<2 x s16>) = COPY $vgpr0
266 %1:_(<2 x s16>) = COPY $vgpr1
267 %2:_(<2 x s16>) = G_SMIN %0, %1