1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -O0 -march=aarch64 -run-pass=legalizer -global-isel-abort=1 %s -o - | FileCheck %s
3---
4name:            test_load
5body: |
6  bb.0:
7    liveins: $x0
8
9    ; CHECK-LABEL: name: test_load
10    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
11    ; CHECK: [[LOAD:%[0-9]+]]:_(s8) = G_LOAD [[COPY]](p0) :: (load 1)
12    ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[LOAD]](s8)
13    ; CHECK: $w0 = COPY [[ANYEXT]](s32)
14    ; CHECK: [[LOAD1:%[0-9]+]]:_(s8) = G_LOAD [[COPY]](p0) :: (load 1)
15    ; CHECK: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[LOAD1]](s8)
16    ; CHECK: $w0 = COPY [[ANYEXT1]](s32)
17    ; CHECK: [[LOAD2:%[0-9]+]]:_(s16) = G_LOAD [[COPY]](p0) :: (load 2)
18    ; CHECK: [[ANYEXT2:%[0-9]+]]:_(s32) = G_ANYEXT [[LOAD2]](s16)
19    ; CHECK: $w0 = COPY [[ANYEXT2]](s32)
20    ; CHECK: $w0 = COPY [[ANYEXT1]](s32)
21    ; CHECK: [[LOAD3:%[0-9]+]]:_(s64) = G_LOAD [[COPY]](p0) :: (load 8)
22    ; CHECK: $x0 = COPY [[LOAD3]](s64)
23    ; CHECK: [[LOAD4:%[0-9]+]]:_(p0) = G_LOAD [[COPY]](p0) :: (load 8)
24    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[LOAD4]](p0)
25    ; CHECK: $x0 = COPY [[PTRTOINT]](s64)
26    ; CHECK: [[LOAD5:%[0-9]+]]:_(<2 x s32>) = G_LOAD [[COPY]](p0) :: (load 8)
27    ; CHECK: [[BITCAST:%[0-9]+]]:_(s64) = G_BITCAST [[LOAD5]](<2 x s32>)
28    ; CHECK: $x0 = COPY [[BITCAST]](s64)
29    ; CHECK: [[LOAD6:%[0-9]+]]:_(s128) = G_LOAD [[COPY]](p0) :: (load 16)
30    ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[LOAD6]](s128)
31    ; CHECK: $x0 = COPY [[TRUNC]](s64)
32    %0:_(p0) = COPY $x0
33    %1:_(s1) = G_LOAD %0(p0) :: (load 1)
34    %2:_(s32) = G_ANYEXT %1(s1)
35    $w0 = COPY %2(s32)
36    %3:_(s8) = G_LOAD %0(p0) :: (load 1)
37    %4:_(s32) = G_ANYEXT %3(s8)
38    $w0 = COPY %4(s32)
39    %5:_(s16) = G_LOAD %0(p0) :: (load 2)
40    %6:_(s32) = G_ANYEXT %5(s16)
41    $w0 = COPY %6(s32)
42    %7:_(s32) = G_LOAD %0(p0) :: (load 4)
43    $w0 = COPY %4(s32)
44    %8:_(s64) = G_LOAD %0(p0) :: (load 8)
45    $x0 = COPY %8(s64)
46    %9:_(p0) = G_LOAD %0(p0) :: (load 8)
47    %10:_(s64) = G_PTRTOINT %9(p0)
48    $x0 = COPY %10(s64)
49    %11:_(<2 x s32>) = G_LOAD %0(p0) :: (load 8)
50    %12:_(s64) = G_BITCAST %11(<2 x s32>)
51    $x0 = COPY %12(s64)
52    %13:_(s128) = G_LOAD %0(p0) :: (load 16)
53    %14:_(s64) = G_TRUNC %13(s128)
54    $x0 = COPY %14(s64)
55...
56
57---
58name:            test_store
59body: |
60  bb.0:
61    liveins: $x0, $w1
62
63    ; CHECK-LABEL: name: test_store
64    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
65    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
66    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
67    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
68    ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
69    ; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[AND]](s32)
70    ; CHECK: G_STORE [[TRUNC]](s8), [[COPY]](p0) :: (store 1)
71    ; CHECK: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY1]](s32)
72    ; CHECK: G_STORE [[TRUNC1]](s8), [[COPY]](p0) :: (store 1)
73    ; CHECK: [[TRUNC2:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
74    ; CHECK: G_STORE [[TRUNC2]](s16), [[COPY]](p0) :: (store 2)
75    ; CHECK: G_STORE [[COPY1]](s32), [[COPY]](p0) :: (store 4)
76    ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
77    ; CHECK: G_STORE [[PTRTOINT]](s64), [[COPY]](p0) :: (store 8)
78    ; CHECK: G_STORE [[COPY]](p0), [[COPY]](p0) :: (store 8)
79    ; CHECK: [[PTRTOINT1:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
80    ; CHECK: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[PTRTOINT1]](s64), [[PTRTOINT1]](s64)
81    ; CHECK: G_STORE [[MV]](s128), [[COPY]](p0) :: (store 16)
82    %0:_(p0) = COPY $x0
83    %1:_(s32) = COPY $w1
84    %2:_(s1) = G_TRUNC %1(s32)
85    G_STORE %2(s1), %0(p0) :: (store 1)
86    %3:_(s8) = G_TRUNC %1(s32)
87    G_STORE %3(s8), %0(p0) :: (store 1)
88    %4:_(s16) = G_TRUNC %1(s32)
89    G_STORE %4(s16), %0(p0) :: (store 2)
90    G_STORE %1(s32), %0(p0) :: (store 4)
91    %5:_(s64) = G_PTRTOINT %0(p0)
92    G_STORE %5(s64), %0(p0) :: (store 8)
93    G_STORE %0(p0), %0(p0) :: (store 8)
94    %6:_(s64) = G_PTRTOINT %0(p0)
95    %7:_(s128) = G_MERGE_VALUES %6(s64), %6
96    G_STORE %7(s128), %0(p0) :: (store 16)
97...
98---
99name:            store_4xi16
100alignment:       4
101tracksRegLiveness: true
102machineFunctionInfo: {}
103body:             |
104  bb.1:
105    liveins: $d0, $x0
106
107    ; CHECK-LABEL: name: store_4xi16
108    ; CHECK: liveins: $d0, $x0
109    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
110    ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x0
111    ; CHECK: G_STORE [[COPY]](<4 x s16>), [[COPY1]](p0) :: (store 8)
112    ; CHECK: RET_ReallyLR
113    %0:_(<4 x s16>) = COPY $d0
114    %1:_(p0) = COPY $x0
115    G_STORE %0(<4 x s16>), %1(p0) :: (store 8)
116    RET_ReallyLR
117
118...
119---
120name:            store_4xi32
121alignment:       4
122tracksRegLiveness: true
123machineFunctionInfo: {}
124body:             |
125  bb.1:
126    liveins: $q0, $x0
127
128    ; CHECK-LABEL: name: store_4xi32
129    ; CHECK: liveins: $q0, $x0
130    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
131    ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x0
132    ; CHECK: G_STORE [[COPY]](<4 x s32>), [[COPY1]](p0) :: (store 16)
133    ; CHECK: RET_ReallyLR
134    %0:_(<4 x s32>) = COPY $q0
135    %1:_(p0) = COPY $x0
136    G_STORE %0(<4 x s32>), %1(p0) :: (store 16)
137    RET_ReallyLR
138
139...
140---
141name:            store_8xi16
142alignment:       4
143tracksRegLiveness: true
144machineFunctionInfo: {}
145body:             |
146  bb.1:
147    liveins: $q0, $x0
148
149    ; CHECK-LABEL: name: store_8xi16
150    ; CHECK: liveins: $q0, $x0
151    ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
152    ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x0
153    ; CHECK: G_STORE [[COPY]](<8 x s16>), [[COPY1]](p0) :: (store 16)
154    ; CHECK: RET_ReallyLR
155    %0:_(<8 x s16>) = COPY $q0
156    %1:_(p0) = COPY $x0
157    G_STORE %0(<8 x s16>), %1(p0) :: (store 16)
158    RET_ReallyLR
159
160...
161---
162name:            store_16xi8
163alignment:       4
164tracksRegLiveness: true
165machineFunctionInfo: {}
166body:             |
167  bb.1:
168    liveins: $q0, $x0
169
170    ; CHECK-LABEL: name: store_16xi8
171    ; CHECK: liveins: $q0, $x0
172    ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
173    ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x0
174    ; CHECK: G_STORE [[COPY]](<16 x s8>), [[COPY1]](p0) :: (store 16)
175    ; CHECK: RET_ReallyLR
176    %0:_(<16 x s8>) = COPY $q0
177    %1:_(p0) = COPY $x0
178    G_STORE %0(<16 x s8>), %1(p0) :: (store 16)
179    RET_ReallyLR
180
181...
182---
183name:            load_4xi16
184alignment:       4
185tracksRegLiveness: true
186machineFunctionInfo: {}
187body:             |
188  bb.1:
189    liveins: $x0
190
191    ; CHECK-LABEL: name: load_4xi16
192    ; CHECK: liveins: $x0
193    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
194    ; CHECK: [[LOAD:%[0-9]+]]:_(<4 x s16>) = G_LOAD [[COPY]](p0) :: (load 8)
195    ; CHECK: $d0 = COPY [[LOAD]](<4 x s16>)
196    ; CHECK: RET_ReallyLR implicit $d0
197    %0:_(p0) = COPY $x0
198    %1:_(<4 x s16>) = G_LOAD %0(p0) :: (load 8)
199    $d0 = COPY %1(<4 x s16>)
200    RET_ReallyLR implicit $d0
201
202...
203---
204name:            load_4xi32
205alignment:       4
206tracksRegLiveness: true
207machineFunctionInfo: {}
208body:             |
209  bb.1:
210    liveins: $x0
211
212    ; CHECK-LABEL: name: load_4xi32
213    ; CHECK: liveins: $x0
214    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
215    ; CHECK: [[LOAD:%[0-9]+]]:_(<4 x s32>) = G_LOAD [[COPY]](p0) :: (load 16)
216    ; CHECK: $q0 = COPY [[LOAD]](<4 x s32>)
217    ; CHECK: RET_ReallyLR implicit $q0
218    %0:_(p0) = COPY $x0
219    %1:_(<4 x s32>) = G_LOAD %0(p0) :: (load 16)
220    $q0 = COPY %1(<4 x s32>)
221    RET_ReallyLR implicit $q0
222
223...
224---
225name:            load_8xi16
226alignment:       4
227tracksRegLiveness: true
228machineFunctionInfo: {}
229body:             |
230  bb.1:
231    liveins: $x0
232
233    ; CHECK-LABEL: name: load_8xi16
234    ; CHECK: liveins: $x0
235    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
236    ; CHECK: [[LOAD:%[0-9]+]]:_(<8 x s16>) = G_LOAD [[COPY]](p0) :: (load 16)
237    ; CHECK: $q0 = COPY [[LOAD]](<8 x s16>)
238    ; CHECK: RET_ReallyLR implicit $q0
239    %0:_(p0) = COPY $x0
240    %1:_(<8 x s16>) = G_LOAD %0(p0) :: (load 16)
241    $q0 = COPY %1(<8 x s16>)
242    RET_ReallyLR implicit $q0
243
244...
245---
246name:            load_16xi8
247alignment:       4
248tracksRegLiveness: true
249machineFunctionInfo: {}
250body:             |
251  bb.1:
252    liveins: $x0
253
254    ; CHECK-LABEL: name: load_16xi8
255    ; CHECK: liveins: $x0
256    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
257    ; CHECK: [[LOAD:%[0-9]+]]:_(<16 x s8>) = G_LOAD [[COPY]](p0) :: (load 16)
258    ; CHECK: $q0 = COPY [[LOAD]](<16 x s8>)
259    ; CHECK: RET_ReallyLR implicit $q0
260    %0:_(p0) = COPY $x0
261    %1:_(<16 x s8>) = G_LOAD %0(p0) :: (load 16)
262    $q0 = COPY %1(<16 x s8>)
263    RET_ReallyLR implicit $q0
264
265...
266---
267name:            load_8xi8
268alignment:       4
269tracksRegLiveness: true
270machineFunctionInfo: {}
271body:             |
272  bb.1:
273    liveins: $x0
274    ; CHECK-LABEL: name: load_8xi8
275    ; CHECK: liveins: $x0
276    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
277    ; CHECK: [[LOAD:%[0-9]+]]:_(<8 x s8>) = G_LOAD [[COPY]](p0) :: (load 8)
278    ; CHECK: $d0 = COPY [[LOAD]](<8 x s8>)
279    ; CHECK: RET_ReallyLR implicit $d0
280    %0:_(p0) = COPY $x0
281    %1:_(<8 x s8>) = G_LOAD %0(p0) :: (load 8)
282    $d0 = COPY %1(<8 x s8>)
283    RET_ReallyLR implicit $d0
284
285...
286---
287name:            store_8xi8
288alignment:       4
289tracksRegLiveness: true
290machineFunctionInfo: {}
291body:             |
292  bb.1:
293    liveins: $x0, $d0
294    ; CHECK-LABEL: name: store_8xi8
295    ; CHECK: liveins: $x0, $d0
296    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
297    ; CHECK: [[COPY1:%[0-9]+]]:_(<8 x s8>) = COPY $d0
298    ; CHECK: G_STORE [[COPY1]](<8 x s8>), [[COPY]](p0) :: (store 8)
299    ; CHECK: RET_ReallyLR
300    %0:_(p0) = COPY $x0
301    %1:_(<8 x s8>) = COPY $d0
302    G_STORE %1(<8 x s8>), %0(p0) :: (store 8)
303    RET_ReallyLR
304...
305