1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs -run-pass=regbankselect -regbankselect-fast -o - %s | FileCheck %s
3# RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs -run-pass=regbankselect -regbankselect-greedy -o - %s | FileCheck %s
4
5---
6name: lshr_s32_ss
7legalized: true
8
9body: |
10  bb.0:
11    liveins: $sgpr0, $sgpr1
12    ; CHECK-LABEL: name: lshr_s32_ss
13    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
14    ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
15    ; CHECK: [[LSHR:%[0-9]+]]:sgpr(s32) = G_LSHR [[COPY]], [[COPY1]](s32)
16    ; CHECK: S_ENDPGM 0, implicit [[LSHR]](s32)
17    %0:_(s32) = COPY $sgpr0
18    %1:_(s32) = COPY $sgpr1
19    %2:_(s32) = G_LSHR %0, %1
20    S_ENDPGM 0, implicit %2
21...
22
23---
24name: lshr_s32_sv
25legalized: true
26
27body: |
28  bb.0:
29    liveins: $sgpr0, $vgpr0
30    ; CHECK-LABEL: name: lshr_s32_sv
31    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
32    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
33    ; CHECK: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32)
34    ; CHECK: [[LSHR:%[0-9]+]]:vgpr(s32) = G_LSHR [[COPY2]], [[COPY1]](s32)
35    ; CHECK: S_ENDPGM 0, implicit [[LSHR]](s32)
36    %0:_(s32) = COPY $sgpr0
37    %1:_(s32) = COPY $vgpr0
38    %2:_(s32) = G_LSHR %0, %1
39    S_ENDPGM 0, implicit %2
40...
41
42---
43name: lshr_s32_vs
44legalized: true
45
46body: |
47  bb.0:
48    liveins: $sgpr0, $vgpr0
49    ; CHECK-LABEL: name: lshr_s32_vs
50    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
51    ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
52    ; CHECK: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[COPY1]](s32)
53    ; CHECK: [[LSHR:%[0-9]+]]:vgpr(s32) = G_LSHR [[COPY]], [[COPY2]](s32)
54    ; CHECK: S_ENDPGM 0, implicit [[LSHR]](s32)
55    %0:_(s32) = COPY $vgpr0
56    %1:_(s32) = COPY $sgpr0
57    %2:_(s32) = G_LSHR %0, %1
58    S_ENDPGM 0, implicit %2
59...
60
61---
62name: lshr_s32_vv
63legalized: true
64
65body: |
66  bb.0:
67    liveins: $vgpr0, $vgpr1
68    ; CHECK-LABEL: name: lshr_s32_vv
69    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
70    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
71    ; CHECK: [[LSHR:%[0-9]+]]:vgpr(s32) = G_LSHR [[COPY]], [[COPY1]](s32)
72    ; CHECK: S_ENDPGM 0, implicit [[LSHR]](s32)
73    %0:_(s32) = COPY $vgpr0
74    %1:_(s32) = COPY $vgpr1
75    %2:_(s32) = G_LSHR %0, %1
76    S_ENDPGM 0, implicit %2
77...
78
79---
80name: lshr_s16_ss
81legalized: true
82
83body: |
84  bb.0:
85    liveins: $sgpr0, $sgpr1
86    ; CHECK-LABEL: name: lshr_s16_ss
87    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
88    ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1
89    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
90    ; CHECK: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
91    ; CHECK: [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s16)
92    ; CHECK: [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s16)
93    ; CHECK: [[LSHR:%[0-9]+]]:sgpr(s32) = G_LSHR [[ZEXT]], [[ZEXT1]](s32)
94    ; CHECK: [[TRUNC2:%[0-9]+]]:sgpr(s16) = G_TRUNC [[LSHR]](s32)
95    ; CHECK: S_ENDPGM 0, implicit [[TRUNC2]](s16)
96    %0:_(s32) = COPY $sgpr0
97    %1:_(s32) = COPY $sgpr1
98    %2:_(s16) = G_TRUNC %0
99    %3:_(s16) = G_TRUNC %1
100    %4:_(s16) = G_LSHR %2, %3
101    S_ENDPGM 0, implicit %4
102...
103
104---
105name: lshr_s16_sv
106legalized: true
107
108body: |
109  bb.0:
110    liveins: $sgpr0, $vgpr0
111
112    ; CHECK-LABEL: name: lshr_s16_sv
113    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
114    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
115    ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
116    ; CHECK: [[TRUNC1:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY1]](s32)
117    ; CHECK: [[COPY2:%[0-9]+]]:vgpr(s16) = COPY [[TRUNC]](s16)
118    ; CHECK: [[LSHR:%[0-9]+]]:vgpr(s16) = G_LSHR [[COPY2]], [[TRUNC1]](s16)
119    ; CHECK: S_ENDPGM 0, implicit [[LSHR]](s16)
120    %0:_(s32) = COPY $sgpr0
121    %1:_(s32) = COPY $vgpr0
122    %2:_(s16) = G_TRUNC %0
123    %3:_(s16) = G_TRUNC %1
124    %4:_(s16) = G_LSHR %2, %3
125    S_ENDPGM 0, implicit %4
126...
127
128---
129name: lshr_s16_vs
130legalized: true
131
132body: |
133  bb.0:
134    liveins: $sgpr0, $vgpr0
135    ; CHECK-LABEL: name: lshr_s16_vs
136    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
137    ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
138    ; CHECK: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
139    ; CHECK: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32)
140    ; CHECK: [[COPY2:%[0-9]+]]:vgpr(s16) = COPY [[TRUNC1]](s16)
141    ; CHECK: [[LSHR:%[0-9]+]]:vgpr(s16) = G_LSHR [[TRUNC]], [[COPY2]](s16)
142    ; CHECK: S_ENDPGM 0, implicit [[LSHR]](s16)
143    %0:_(s32) = COPY $vgpr0
144    %1:_(s32) = COPY $sgpr0
145    %2:_(s16) = G_TRUNC %0
146    %3:_(s16) = G_TRUNC %1
147    %4:_(s16) = G_LSHR %2, %3
148    S_ENDPGM 0, implicit %4
149
150...
151
152---
153name: lshr_s16_vv
154legalized: true
155
156body: |
157  bb.0:
158    liveins: $vgpr0, $vgpr1
159    ; CHECK-LABEL: name: lshr_s16_vv
160    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
161    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1
162    ; CHECK: [[TRUNC:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY]](s32)
163    ; CHECK: [[TRUNC1:%[0-9]+]]:vgpr(s16) = G_TRUNC [[COPY1]](s32)
164    ; CHECK: [[LSHR:%[0-9]+]]:vgpr(s16) = G_LSHR [[TRUNC]], [[TRUNC1]](s16)
165    ; CHECK: S_ENDPGM 0, implicit [[LSHR]](s16)
166    %0:_(s32) = COPY $vgpr0
167    %1:_(s32) = COPY $vgpr1
168    %2:_(s16) = G_TRUNC %0
169    %3:_(s16) = G_TRUNC %1
170    %4:_(s16) = G_LSHR %2, %3
171    S_ENDPGM 0, implicit %4
172
173...
174
175---
176name: lshr_v2s16_ss
177legalized: true
178
179body: |
180  bb.0:
181    liveins: $sgpr0, $sgpr1
182    ; CHECK-LABEL: name: lshr_v2s16_ss
183    ; CHECK: [[COPY:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0
184    ; CHECK: [[COPY1:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr1
185    ; CHECK: [[BITCAST:%[0-9]+]]:sgpr(s32) = G_BITCAST [[COPY]](<2 x s16>)
186    ; CHECK: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 16
187    ; CHECK: [[LSHR:%[0-9]+]]:sgpr(s32) = G_LSHR [[BITCAST]], [[C]](s32)
188    ; CHECK: [[BITCAST1:%[0-9]+]]:sgpr(s32) = G_BITCAST [[COPY1]](<2 x s16>)
189    ; CHECK: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 16
190    ; CHECK: [[LSHR1:%[0-9]+]]:sgpr(s32) = G_LSHR [[BITCAST1]], [[C1]](s32)
191    ; CHECK: [[LSHR2:%[0-9]+]]:sgpr(s32) = G_LSHR [[BITCAST]], [[BITCAST1]](s32)
192    ; CHECK: [[LSHR3:%[0-9]+]]:sgpr(s32) = G_LSHR [[LSHR]], [[LSHR1]](s32)
193    ; CHECK: [[BUILD_VECTOR_TRUNC:%[0-9]+]]:sgpr(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[LSHR2]](s32), [[LSHR3]](s32)
194    ; CHECK: S_ENDPGM 0, implicit [[BUILD_VECTOR_TRUNC]](<2 x s16>)
195    %0:_(<2 x s16>) = COPY $sgpr0
196    %1:_(<2 x s16>) = COPY $sgpr1
197    %2:_(<2 x s16>) = G_LSHR %0, %1
198    S_ENDPGM 0, implicit %2
199
200...
201
202---
203name: lshr_v2s16_sv
204legalized: true
205
206body: |
207  bb.0:
208    liveins: $sgpr0, $vgpr0
209    ; CHECK-LABEL: name: lshr_v2s16_sv
210    ; CHECK: [[COPY:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0
211    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0
212    ; CHECK: [[COPY2:%[0-9]+]]:vgpr(<2 x s16>) = COPY [[COPY]](<2 x s16>)
213    ; CHECK: [[LSHR:%[0-9]+]]:vgpr(<2 x s16>) = G_LSHR [[COPY2]], [[COPY1]](<2 x s16>)
214    ; CHECK: S_ENDPGM 0, implicit [[LSHR]](<2 x s16>)
215    %0:_(<2 x s16>) = COPY $sgpr0
216    %1:_(<2 x s16>) = COPY $vgpr0
217    %2:_(<2 x s16>) = G_LSHR %0, %1
218    S_ENDPGM 0, implicit %2
219...
220
221---
222name: lshr_v2s16_vs
223legalized: true
224
225body: |
226  bb.0:
227    liveins: $sgpr0, $vgpr0
228    ; CHECK-LABEL: name: lshr_v2s16_vs
229    ; CHECK: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0
230    ; CHECK: [[COPY1:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0
231    ; CHECK: [[COPY2:%[0-9]+]]:vgpr(<2 x s16>) = COPY [[COPY1]](<2 x s16>)
232    ; CHECK: [[LSHR:%[0-9]+]]:vgpr(<2 x s16>) = G_LSHR [[COPY]], [[COPY2]](<2 x s16>)
233    ; CHECK: S_ENDPGM 0, implicit [[LSHR]](<2 x s16>)
234    %0:_(<2 x s16>) = COPY $vgpr0
235    %1:_(<2 x s16>) = COPY $sgpr0
236    %2:_(<2 x s16>) = G_LSHR %0, %1
237    S_ENDPGM 0, implicit %2
238
239...
240
241---
242name: lshr_v2s16_vv
243legalized: true
244
245body: |
246  bb.0:
247    liveins: $vgpr0, $vgpr1
248    ; CHECK-LABEL: name: lshr_v2s16_vv
249    ; CHECK: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0
250    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1
251    ; CHECK: [[LSHR:%[0-9]+]]:vgpr(<2 x s16>) = G_LSHR [[COPY]], [[COPY1]](<2 x s16>)
252    ; CHECK: S_ENDPGM 0, implicit [[LSHR]](<2 x s16>)
253    %0:_(<2 x s16>) = COPY $vgpr0
254    %1:_(<2 x s16>) = COPY $vgpr1
255    %2:_(<2 x s16>) = G_LSHR %0, %1
256    S_ENDPGM 0, implicit %2
257
258...
259