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: smax_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: [[SMAX:%[0-9]+]]:sgpr(s32) = G_SMAX [[COPY]], [[COPY1]]
19 %0:_(s32) = COPY $sgpr0
20 %1:_(s32) = COPY $sgpr1
21 %2:_(s32) = G_SMAX %0, %1
30 liveins: $sgpr0, $vgpr0
32 ; CHECK-LABEL: name: smax_s32_sv
33 ; CHECK: liveins: $sgpr0, $vgpr0
35 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
36 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
37 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32)
38 ; CHECK-NEXT: [[SMAX:%[0-9]+]]:vgpr(s32) = G_SMAX [[COPY2]], [[COPY1]]
39 %0:_(s32) = COPY $sgpr0
40 %1:_(s32) = COPY $vgpr0
41 %2:_(s32) = G_SMAX %0, %1
50 liveins: $sgpr0, $vgpr0
52 ; CHECK-LABEL: name: smax_s32_vs
53 ; CHECK: liveins: $sgpr0, $vgpr0
55 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
56 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
57 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[COPY1]](s32)
58 ; CHECK-NEXT: [[SMAX:%[0-9]+]]:vgpr(s32) = G_SMAX [[COPY]], [[COPY2]]
59 ; CHECK-NEXT: $vgpr0 = COPY [[SMAX]](s32)
60 %0:_(s32) = COPY $vgpr0
61 %1:_(s32) = COPY $sgpr0
62 %2:_(s32) = G_SMAX %0, %1
73 liveins: $vgpr0, $vgpr1
75 ; CHECK-LABEL: name: smax_s32_vv
76 ; CHECK: liveins: $vgpr0, $vgpr1
78 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
79 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
80 ; CHECK-NEXT: [[SMAX:%[0-9]+]]:vgpr(s32) = G_SMAX [[COPY]], [[COPY1]]
81 ; CHECK-NEXT: $vgpr0 = COPY [[SMAX]](s32)
82 %0:_(s32) = COPY $vgpr0
83 %1:_(s32) = COPY $vgpr1
84 %2:_(s32) = G_SMAX %0, %1
88 # FIXME: This should use VGPR instruction
90 name: smax_s32_ss_vgpr_use
95 liveins: $sgpr0, $sgpr1
97 ; CHECK-LABEL: name: smax_s32_ss_vgpr_use
98 ; CHECK: liveins: $sgpr0, $sgpr1
100 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
101 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
102 ; CHECK-NEXT: [[SMAX:%[0-9]+]]:sgpr(s32) = G_SMAX [[COPY]], [[COPY1]]
103 ; CHECK-NEXT: $vgpr0 = COPY [[SMAX]](s32)
104 %0:_(s32) = COPY $sgpr0
105 %1:_(s32) = COPY $sgpr1
106 %2:_(s32) = G_SMAX %0, %1
116 liveins: $sgpr0, $sgpr1
118 ; CHECK-LABEL: name: smax_s16_ss
119 ; CHECK: liveins: $sgpr0, $sgpr1
121 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
122 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
123 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
124 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
125 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:sgpr(s32) = G_SEXT [[TRUNC]](s16)
126 ; CHECK-NEXT: [[SEXT1:%[0-9]+]]:sgpr(s32) = G_SEXT [[TRUNC1]](s16)
127 ; CHECK-NEXT: [[SMAX:%[0-9]+]]:sgpr(s32) = G_SMAX [[SEXT]], [[SEXT1]]
128 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:sgpr(s16) = G_TRUNC [[SMAX]](s32)
129 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s16)
130 ; CHECK-NEXT: $sgpr0 = COPY [[ANYEXT]](s32)
131 %0:_(s32) = COPY $sgpr0
132 %1:_(s32) = COPY $sgpr1
133 %2:_(s16) = G_TRUNC %0
134 %3:_(s16) = G_TRUNC %1
135 %4:_(s16) = G_SMAX %2, %3
136 %5:_(s32) = G_ANYEXT %4
142 name: smax_s16_ss_vgpr_use
147 liveins: $sgpr0, $sgpr1
149 ; CHECK-LABEL: name: smax_s16_ss_vgpr_use
150 ; CHECK: liveins: $sgpr0, $sgpr1
152 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
153 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
154 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
155 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
156 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:sgpr(s32) = G_SEXT [[TRUNC]](s16)
157 ; CHECK-NEXT: [[SEXT1:%[0-9]+]]:sgpr(s32) = G_SEXT [[TRUNC1]](s16)
158 ; CHECK-NEXT: [[SMAX:%[0-9]+]]:sgpr(s32) = G_SMAX [[SEXT]], [[SEXT1]]
159 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:sgpr(s16) = G_TRUNC [[SMAX]](s32)
160 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s16)
161 ; CHECK-NEXT: $vgpr0 = COPY [[ANYEXT]](s32)
162 %0:_(s32) = COPY $sgpr0
163 %1:_(s32) = COPY $sgpr1
164 %2:_(s16) = G_TRUNC %0
165 %3:_(s16) = G_TRUNC %1
166 %4:_(s16) = G_SMAX %2, %3
167 %5:_(s32) = G_ANYEXT %4
178 liveins: $sgpr0, $sgpr1
180 ; CHECK-LABEL: name: smax_v2s16_ss
181 ; CHECK: liveins: $sgpr0, $sgpr1
183 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0
184 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr1
185 ; CHECK-NEXT: [[BITCAST:%[0-9]+]]:sgpr(s32) = G_BITCAST [[COPY]](<2 x s16>)
186 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:sgpr(s32) = G_SEXT_INREG [[BITCAST]], 16
187 ; CHECK-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 16
188 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:sgpr(s32) = G_ASHR [[BITCAST]], [[C]](s32)
189 ; CHECK-NEXT: [[BITCAST1:%[0-9]+]]:sgpr(s32) = G_BITCAST [[COPY1]](<2 x s16>)
190 ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:sgpr(s32) = G_SEXT_INREG [[BITCAST1]], 16
191 ; CHECK-NEXT: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 16
192 ; CHECK-NEXT: [[ASHR1:%[0-9]+]]:sgpr(s32) = G_ASHR [[BITCAST1]], [[C1]](s32)
193 ; CHECK-NEXT: [[SMAX:%[0-9]+]]:sgpr(s32) = G_SMAX [[SEXT_INREG]], [[SEXT_INREG1]]
194 ; CHECK-NEXT: [[SMAX1:%[0-9]+]]:sgpr(s32) = G_SMAX [[ASHR]], [[ASHR1]]
195 ; CHECK-NEXT: [[BUILD_VECTOR_TRUNC:%[0-9]+]]:sgpr(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[SMAX]](s32), [[SMAX1]](s32)
196 ; CHECK-NEXT: $sgpr0 = COPY [[BUILD_VECTOR_TRUNC]](<2 x s16>)
197 %0:_(<2 x s16>) = COPY $sgpr0
198 %1:_(<2 x s16>) = COPY $sgpr1
199 %2:_(<2 x s16>) = G_SMAX %0, %1
209 liveins: $sgpr0, $vgpr0
211 ; CHECK-LABEL: name: smax_v2s16_sv
212 ; CHECK: liveins: $sgpr0, $vgpr0
214 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0
215 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0
216 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(<2 x s16>) = COPY [[COPY]](<2 x s16>)
217 ; CHECK-NEXT: [[SMAX:%[0-9]+]]:vgpr(<2 x s16>) = G_SMAX [[COPY2]], [[COPY1]]
218 ; CHECK-NEXT: $vgpr0 = COPY [[SMAX]](<2 x s16>)
219 %0:_(<2 x s16>) = COPY $sgpr0
220 %1:_(<2 x s16>) = COPY $vgpr0
221 %2:_(<2 x s16>) = G_SMAX %0, %1
231 liveins: $sgpr0, $vgpr0
233 ; CHECK-LABEL: name: smax_v2s16_vs
234 ; CHECK: liveins: $sgpr0, $vgpr0
236 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0
237 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0
238 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr(<2 x s16>) = COPY [[COPY1]](<2 x s16>)
239 ; CHECK-NEXT: [[SMAX:%[0-9]+]]:vgpr(<2 x s16>) = G_SMAX [[COPY]], [[COPY2]]
240 ; CHECK-NEXT: $vgpr0 = COPY [[SMAX]](<2 x s16>)
241 %0:_(<2 x s16>) = COPY $vgpr0
242 %1:_(<2 x s16>) = COPY $sgpr0
243 %2:_(<2 x s16>) = G_SMAX %0, %1
253 liveins: $vgpr0, $vgpr1
255 ; CHECK-LABEL: name: smax_v2s16_vv
256 ; CHECK: liveins: $vgpr0, $vgpr1
258 ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0
259 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1
260 ; CHECK-NEXT: [[SMAX:%[0-9]+]]:vgpr(<2 x s16>) = G_SMAX [[COPY]], [[COPY1]]
261 ; CHECK-NEXT: $vgpr0 = COPY [[SMAX]](<2 x s16>)
262 %0:_(<2 x s16>) = COPY $vgpr0
263 %1:_(<2 x s16>) = COPY $vgpr1
264 %2:_(<2 x s16>) = G_SMAX %0, %1