1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect %s -verify-machineinstrs -o - -regbankselect-fast | FileCheck %s
3# RUN: llc -march=amdgcn -mcpu=fiji -run-pass=regbankselect %s -verify-machineinstrs -o - -regbankselect-greedy | FileCheck %s
4
5---
6name: sext_inreg_s_s32_1
7legalized: true
8
9body: |
10  bb.0:
11    liveins: $sgpr0
12
13    ; CHECK-LABEL: name: sext_inreg_s_s32_1
14    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
15    ; CHECK: [[SEXT_INREG:%[0-9]+]]:sgpr(s32) = G_SEXT_INREG [[COPY]], 1
16    ; CHECK: S_ENDPGM 0, implicit [[SEXT_INREG]](s32)
17    %0:_(s32) = COPY $sgpr0
18    %1:_(s32) = G_SEXT_INREG %0, 1
19    S_ENDPGM 0, implicit %1
20
21...
22
23---
24name: sext_inreg_s_s64_1
25legalized: true
26
27body: |
28  bb.0:
29    liveins: $sgpr0_sgpr1
30
31    ; CHECK-LABEL: name: sext_inreg_s_s64_1
32    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s64) = COPY $sgpr0_sgpr1
33    ; CHECK: [[SEXT_INREG:%[0-9]+]]:sgpr(s64) = G_SEXT_INREG [[COPY]], 1
34    ; CHECK: S_ENDPGM 0, implicit [[SEXT_INREG]](s64)
35    %0:_(s64) = COPY $sgpr0_sgpr1
36    %1:_(s64) = G_SEXT_INREG %0, 1
37    S_ENDPGM 0, implicit %1
38
39...
40
41---
42name: sext_inreg_s_s64_31
43legalized: true
44
45body: |
46  bb.0:
47    liveins: $sgpr0_sgpr1
48
49    ; CHECK-LABEL: name: sext_inreg_s_s64_31
50    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s64) = COPY $sgpr0_sgpr1
51    ; CHECK: [[SEXT_INREG:%[0-9]+]]:sgpr(s64) = G_SEXT_INREG [[COPY]], 31
52    ; CHECK: S_ENDPGM 0, implicit [[SEXT_INREG]](s64)
53    %0:_(s64) = COPY $sgpr0_sgpr1
54    %1:_(s64) = G_SEXT_INREG %0, 31
55    S_ENDPGM 0, implicit %1
56
57...
58
59---
60name: sext_inreg_s_s64_32
61legalized: true
62
63body: |
64  bb.0:
65    liveins: $sgpr0_sgpr1
66
67    ; CHECK-LABEL: name: sext_inreg_s_s64_32
68    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s64) = COPY $sgpr0_sgpr1
69    ; CHECK: [[SEXT_INREG:%[0-9]+]]:sgpr(s64) = G_SEXT_INREG [[COPY]], 32
70    ; CHECK: S_ENDPGM 0, implicit [[SEXT_INREG]](s64)
71    %0:_(s64) = COPY $sgpr0_sgpr1
72    %1:_(s64) = G_SEXT_INREG %0, 32
73    S_ENDPGM 0, implicit %1
74
75...
76
77---
78name: sext_inreg_s_s64_33
79legalized: true
80
81body: |
82  bb.0:
83    liveins: $sgpr0_sgpr1
84
85    ; CHECK-LABEL: name: sext_inreg_s_s64_33
86    ; CHECK: [[COPY:%[0-9]+]]:sgpr(s64) = COPY $sgpr0_sgpr1
87    ; CHECK: [[SEXT_INREG:%[0-9]+]]:sgpr(s64) = G_SEXT_INREG [[COPY]], 32
88    ; CHECK: S_ENDPGM 0, implicit [[SEXT_INREG]](s64)
89    %0:_(s64) = COPY $sgpr0_sgpr1
90    %1:_(s64) = G_SEXT_INREG %0, 32
91    S_ENDPGM 0, implicit %1
92
93...
94
95---
96name: sext_inreg_v_s32_1
97legalized: true
98
99body: |
100  bb.0:
101    liveins: $vgpr0
102
103    ; CHECK-LABEL: name: sext_inreg_v_s32_1
104    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
105    ; CHECK: [[SEXT_INREG:%[0-9]+]]:vgpr(s32) = G_SEXT_INREG [[COPY]], 1
106    ; CHECK: S_ENDPGM 0, implicit [[SEXT_INREG]](s32)
107    %0:_(s32) = COPY $vgpr0
108    %1:_(s32) = G_SEXT_INREG %0, 1
109    S_ENDPGM 0, implicit %1
110
111...
112
113---
114name: sext_inreg_v_s64_1
115legalized: true
116
117body: |
118  bb.0:
119    liveins: $vgpr0_vgpr1
120
121    ; CHECK-LABEL: name: sext_inreg_v_s64_1
122    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s64) = COPY $vgpr0_vgpr1
123    ; CHECK: [[UV:%[0-9]+]]:vgpr(s32), [[UV1:%[0-9]+]]:vgpr(s32) = G_UNMERGE_VALUES [[COPY]](s64)
124    ; CHECK: [[SEXT_INREG:%[0-9]+]]:vgpr(s32) = G_SEXT_INREG [[UV]], 1
125    ; CHECK: [[C:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 31
126    ; CHECK: [[ASHR:%[0-9]+]]:vgpr(s32) = G_ASHR [[SEXT_INREG]], [[C]](s32)
127    ; CHECK: [[MV:%[0-9]+]]:vgpr(s64) = G_MERGE_VALUES [[SEXT_INREG]](s32), [[ASHR]](s32)
128    ; CHECK: S_ENDPGM 0, implicit [[MV]](s64)
129    %0:_(s64) = COPY $vgpr0_vgpr1
130    %1:_(s64) = G_SEXT_INREG %0, 1
131    S_ENDPGM 0, implicit %1
132
133...
134
135---
136name: sext_inreg_v_s64_31
137legalized: true
138
139body: |
140  bb.0:
141    liveins: $vgpr0_vgpr1
142
143    ; CHECK-LABEL: name: sext_inreg_v_s64_31
144    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s64) = COPY $vgpr0_vgpr1
145    ; CHECK: [[UV:%[0-9]+]]:vgpr(s32), [[UV1:%[0-9]+]]:vgpr(s32) = G_UNMERGE_VALUES [[COPY]](s64)
146    ; CHECK: [[SEXT_INREG:%[0-9]+]]:vgpr(s32) = G_SEXT_INREG [[UV]], 31
147    ; CHECK: [[C:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 31
148    ; CHECK: [[ASHR:%[0-9]+]]:vgpr(s32) = G_ASHR [[SEXT_INREG]], [[C]](s32)
149    ; CHECK: [[MV:%[0-9]+]]:vgpr(s64) = G_MERGE_VALUES [[SEXT_INREG]](s32), [[ASHR]](s32)
150    ; CHECK: S_ENDPGM 0, implicit [[MV]](s64)
151    %0:_(s64) = COPY $vgpr0_vgpr1
152    %1:_(s64) = G_SEXT_INREG %0, 31
153    S_ENDPGM 0, implicit %1
154
155...
156
157---
158name: sext_inreg_v_s64_32
159legalized: true
160
161body: |
162  bb.0:
163    liveins: $vgpr0_vgpr1
164
165    ; CHECK-LABEL: name: sext_inreg_v_s64_32
166    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s64) = COPY $vgpr0_vgpr1
167    ; CHECK: [[UV:%[0-9]+]]:vgpr(s32), [[UV1:%[0-9]+]]:vgpr(s32) = G_UNMERGE_VALUES [[COPY]](s64)
168    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[UV]](s32)
169    ; CHECK: [[C:%[0-9]+]]:vgpr(s32) = G_CONSTANT i32 31
170    ; CHECK: [[ASHR:%[0-9]+]]:vgpr(s32) = G_ASHR [[COPY1]], [[C]](s32)
171    ; CHECK: [[MV:%[0-9]+]]:vgpr(s64) = G_MERGE_VALUES [[COPY1]](s32), [[ASHR]](s32)
172    ; CHECK: S_ENDPGM 0, implicit [[MV]](s64)
173    %0:_(s64) = COPY $vgpr0_vgpr1
174    %1:_(s64) = G_SEXT_INREG %0, 32
175    S_ENDPGM 0, implicit %1
176
177...
178
179---
180name: sext_inreg_v_s64_33
181legalized: true
182
183body: |
184  bb.0:
185    liveins: $vgpr0_vgpr1
186
187    ; CHECK-LABEL: name: sext_inreg_v_s64_33
188    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s64) = COPY $vgpr0_vgpr1
189    ; CHECK: [[UV:%[0-9]+]]:vgpr(s32), [[UV1:%[0-9]+]]:vgpr(s32) = G_UNMERGE_VALUES [[COPY]](s64)
190    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[UV]](s32)
191    ; CHECK: [[SEXT_INREG:%[0-9]+]]:vgpr(s32) = G_SEXT_INREG [[COPY1]], 1
192    ; CHECK: [[MV:%[0-9]+]]:vgpr(s64) = G_MERGE_VALUES [[COPY1]](s32), [[SEXT_INREG]](s32)
193    ; CHECK: S_ENDPGM 0, implicit [[MV]](s64)
194    %0:_(s64) = COPY $vgpr0_vgpr1
195    %1:_(s64) = G_SEXT_INREG %0, 33
196    S_ENDPGM 0, implicit %1
197
198...
199
200---
201name: sext_inreg_v_s64_35
202legalized: true
203
204body: |
205  bb.0:
206    liveins: $vgpr0_vgpr1
207
208    ; CHECK-LABEL: name: sext_inreg_v_s64_35
209    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s64) = COPY $vgpr0_vgpr1
210    ; CHECK: [[UV:%[0-9]+]]:vgpr(s32), [[UV1:%[0-9]+]]:vgpr(s32) = G_UNMERGE_VALUES [[COPY]](s64)
211    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[UV]](s32)
212    ; CHECK: [[SEXT_INREG:%[0-9]+]]:vgpr(s32) = G_SEXT_INREG [[COPY1]], 3
213    ; CHECK: [[MV:%[0-9]+]]:vgpr(s64) = G_MERGE_VALUES [[COPY1]](s32), [[SEXT_INREG]](s32)
214    ; CHECK: S_ENDPGM 0, implicit [[MV]](s64)
215    %0:_(s64) = COPY $vgpr0_vgpr1
216    %1:_(s64) = G_SEXT_INREG %0, 35
217    S_ENDPGM 0, implicit %1
218
219...
220
221---
222name: sext_inreg_v_s64_63
223legalized: true
224
225body: |
226  bb.0:
227    liveins: $vgpr0_vgpr1
228
229    ; CHECK-LABEL: name: sext_inreg_v_s64_63
230    ; CHECK: [[COPY:%[0-9]+]]:vgpr(s64) = COPY $vgpr0_vgpr1
231    ; CHECK: [[UV:%[0-9]+]]:vgpr(s32), [[UV1:%[0-9]+]]:vgpr(s32) = G_UNMERGE_VALUES [[COPY]](s64)
232    ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY [[UV]](s32)
233    ; CHECK: [[SEXT_INREG:%[0-9]+]]:vgpr(s32) = G_SEXT_INREG [[COPY1]], 31
234    ; CHECK: [[MV:%[0-9]+]]:vgpr(s64) = G_MERGE_VALUES [[COPY1]](s32), [[SEXT_INREG]](s32)
235    ; CHECK: S_ENDPGM 0, implicit [[MV]](s64)
236    %0:_(s64) = COPY $vgpr0_vgpr1
237    %1:_(s64) = G_SEXT_INREG %0, 63
238    S_ENDPGM 0, implicit %1
239
240...
241