1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - \
4 # RUN: llc -mtriple=riscv32 -mattr=+unaligned-scalar-mem -run-pass=legalizer %s -o - \
5 # RUN: | FileCheck %s --check-prefix=UNALIGNED
10 tracksRegLiveness: true
24 ; CHECK-LABEL: name: store_i8
25 ; CHECK: liveins: $x10, $x11
27 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
28 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
29 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
30 ; CHECK-NEXT: G_STORE [[TRUNC]](s16), [[COPY1]](p0) :: (store (s8))
31 ; CHECK-NEXT: PseudoRET
33 ; UNALIGNED-LABEL: name: store_i8
34 ; UNALIGNED: liveins: $x10, $x11
35 ; UNALIGNED-NEXT: {{ $}}
36 ; UNALIGNED-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
37 ; UNALIGNED-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
38 ; UNALIGNED-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
39 ; UNALIGNED-NEXT: G_STORE [[TRUNC]](s16), [[COPY1]](p0) :: (store (s8))
40 ; UNALIGNED-NEXT: PseudoRET
42 %0:_(s8) = G_TRUNC %2(s32)
44 G_STORE %0(s8), %1(p0) :: (store (s8))
51 tracksRegLiveness: true
65 ; CHECK-LABEL: name: store_i16
66 ; CHECK: liveins: $x10, $x11
68 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
69 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
70 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
71 ; CHECK-NEXT: G_STORE [[TRUNC]](s16), [[COPY1]](p0) :: (store (s16))
72 ; CHECK-NEXT: PseudoRET
74 ; UNALIGNED-LABEL: name: store_i16
75 ; UNALIGNED: liveins: $x10, $x11
76 ; UNALIGNED-NEXT: {{ $}}
77 ; UNALIGNED-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
78 ; UNALIGNED-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
79 ; UNALIGNED-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
80 ; UNALIGNED-NEXT: G_STORE [[TRUNC]](s16), [[COPY1]](p0) :: (store (s16))
81 ; UNALIGNED-NEXT: PseudoRET
83 %0:_(s16) = G_TRUNC %2(s32)
85 G_STORE %0(s16), %1(p0) :: (store (s16))
92 tracksRegLiveness: true
105 ; CHECK-LABEL: name: store_i32
106 ; CHECK: liveins: $x10, $x11
108 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
109 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
110 ; CHECK-NEXT: G_STORE [[COPY]](s32), [[COPY1]](p0) :: (store (s32))
111 ; CHECK-NEXT: PseudoRET
113 ; UNALIGNED-LABEL: name: store_i32
114 ; UNALIGNED: liveins: $x10, $x11
115 ; UNALIGNED-NEXT: {{ $}}
116 ; UNALIGNED-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
117 ; UNALIGNED-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
118 ; UNALIGNED-NEXT: G_STORE [[COPY]](s32), [[COPY1]](p0) :: (store (s32))
119 ; UNALIGNED-NEXT: PseudoRET
120 %0:_(s32) = COPY $x10
122 G_STORE %0(s32), %1(p0) :: (store (s32))
129 tracksRegLiveness: true
131 - { id: 0, class: _ }
132 - { id: 1, class: _ }
133 - { id: 2, class: _ }
134 - { id: 3, class: _ }
142 liveins: $x10, $x11, $x12
144 ; CHECK-LABEL: name: store_i64
145 ; CHECK: liveins: $x10, $x11, $x12
147 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
148 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
149 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(p0) = COPY $x12
150 ; CHECK-NEXT: G_STORE [[COPY]](s32), [[COPY2]](p0) :: (store (s32), align 8)
151 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
152 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY2]], [[C]](s32)
153 ; CHECK-NEXT: G_STORE [[COPY1]](s32), [[PTR_ADD]](p0) :: (store (s32) into unknown-address + 4)
154 ; CHECK-NEXT: PseudoRET
156 ; UNALIGNED-LABEL: name: store_i64
157 ; UNALIGNED: liveins: $x10, $x11, $x12
158 ; UNALIGNED-NEXT: {{ $}}
159 ; UNALIGNED-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
160 ; UNALIGNED-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
161 ; UNALIGNED-NEXT: [[COPY2:%[0-9]+]]:_(p0) = COPY $x12
162 ; UNALIGNED-NEXT: G_STORE [[COPY]](s32), [[COPY2]](p0) :: (store (s32), align 8)
163 ; UNALIGNED-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
164 ; UNALIGNED-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY2]], [[C]](s32)
165 ; UNALIGNED-NEXT: G_STORE [[COPY1]](s32), [[PTR_ADD]](p0) :: (store (s32) into unknown-address + 4)
166 ; UNALIGNED-NEXT: PseudoRET
167 %2:_(s32) = COPY $x10
168 %3:_(s32) = COPY $x11
169 %0:_(s64) = G_MERGE_VALUES %2(s32), %3(s32)
171 G_STORE %0(s64), %1(p0) :: (store (s64))
178 tracksRegLiveness: true
180 - { id: 0, class: _ }
181 - { id: 1, class: _ }
191 ; CHECK-LABEL: name: store_ptr
192 ; CHECK: liveins: $x10, $x11
194 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
195 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
196 ; CHECK-NEXT: G_STORE [[COPY]](p0), [[COPY1]](p0) :: (store (p0), align 8)
197 ; CHECK-NEXT: PseudoRET
199 ; UNALIGNED-LABEL: name: store_ptr
200 ; UNALIGNED: liveins: $x10, $x11
201 ; UNALIGNED-NEXT: {{ $}}
202 ; UNALIGNED-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
203 ; UNALIGNED-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
204 ; UNALIGNED-NEXT: G_STORE [[COPY]](p0), [[COPY1]](p0) :: (store (p0), align 8)
205 ; UNALIGNED-NEXT: PseudoRET
208 G_STORE %0(p0), %1(p0) :: (store (p0), align 8)
213 name: store_i16_unaligned
215 tracksRegLiveness: true
217 - { id: 0, class: _ }
218 - { id: 1, class: _ }
219 - { id: 2, class: _ }
229 ; CHECK-LABEL: name: store_i16_unaligned
230 ; CHECK: liveins: $x10, $x11
232 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
233 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
234 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
235 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s16) = COPY [[TRUNC]](s16)
236 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
237 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
238 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C1]]
239 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[AND]], [[C]](s32)
240 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[LSHR]](s32)
241 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
242 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY1]], [[C2]](s32)
243 ; CHECK-NEXT: G_STORE [[COPY2]](s16), [[COPY1]](p0) :: (store (s8))
244 ; CHECK-NEXT: G_STORE [[TRUNC1]](s16), [[PTR_ADD]](p0) :: (store (s8) into unknown-address + 1)
245 ; CHECK-NEXT: PseudoRET
247 ; UNALIGNED-LABEL: name: store_i16_unaligned
248 ; UNALIGNED: liveins: $x10, $x11
249 ; UNALIGNED-NEXT: {{ $}}
250 ; UNALIGNED-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
251 ; UNALIGNED-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
252 ; UNALIGNED-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
253 ; UNALIGNED-NEXT: G_STORE [[TRUNC]](s16), [[COPY1]](p0) :: (store (s16), align 1)
254 ; UNALIGNED-NEXT: PseudoRET
255 %2:_(s32) = COPY $x10
256 %0:_(s16) = G_TRUNC %2(s32)
258 G_STORE %0(s16), %1(p0) :: (store (s16), align 1)
263 name: store_i32_unaligned
265 tracksRegLiveness: true
267 - { id: 0, class: _ }
268 - { id: 1, class: _ }
278 ; CHECK-LABEL: name: store_i32_unaligned
279 ; CHECK: liveins: $x10, $x11
281 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
282 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
283 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
284 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
285 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[COPY2]], [[C]](s32)
286 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
287 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY1]], [[C1]](s32)
288 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY2]](s32)
289 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
290 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
291 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C3]]
292 ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s32) = G_LSHR [[AND]], [[C2]](s32)
293 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[LSHR1]](s32)
294 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
295 ; CHECK-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY1]], [[C4]](s32)
296 ; CHECK-NEXT: G_STORE [[TRUNC]](s16), [[COPY1]](p0) :: (store (s8))
297 ; CHECK-NEXT: G_STORE [[TRUNC1]](s16), [[PTR_ADD1]](p0) :: (store (s8) into unknown-address + 1)
298 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:_(s16) = G_TRUNC [[LSHR]](s32)
299 ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
300 ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s32) = G_LSHR [[LSHR]], [[C5]](s32)
301 ; CHECK-NEXT: [[TRUNC3:%[0-9]+]]:_(s16) = G_TRUNC [[LSHR2]](s32)
302 ; CHECK-NEXT: [[PTR_ADD2:%[0-9]+]]:_(p0) = G_PTR_ADD [[PTR_ADD]], [[C4]](s32)
303 ; CHECK-NEXT: G_STORE [[TRUNC2]](s16), [[PTR_ADD]](p0) :: (store (s8) into unknown-address + 2)
304 ; CHECK-NEXT: G_STORE [[TRUNC3]](s16), [[PTR_ADD2]](p0) :: (store (s8) into unknown-address + 3)
305 ; CHECK-NEXT: PseudoRET
307 ; UNALIGNED-LABEL: name: store_i32_unaligned
308 ; UNALIGNED: liveins: $x10, $x11
309 ; UNALIGNED-NEXT: {{ $}}
310 ; UNALIGNED-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
311 ; UNALIGNED-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
312 ; UNALIGNED-NEXT: G_STORE [[COPY]](s32), [[COPY1]](p0) :: (store (s32), align 1)
313 ; UNALIGNED-NEXT: PseudoRET
314 %0:_(s32) = COPY $x10
316 G_STORE %0(s32), %1(p0) :: (store (s32), align 1)
321 name: store_i32_align2
323 tracksRegLiveness: true
325 - { id: 0, class: _ }
326 - { id: 1, class: _ }
336 ; CHECK-LABEL: name: store_i32_align2
337 ; CHECK: liveins: $x10, $x11
339 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
340 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
341 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
342 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
343 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[COPY2]], [[C]](s32)
344 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
345 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY1]], [[C1]](s32)
346 ; CHECK-NEXT: G_STORE [[COPY2]](s32), [[COPY1]](p0) :: (store (s16))
347 ; CHECK-NEXT: G_STORE [[LSHR]](s32), [[PTR_ADD]](p0) :: (store (s16) into unknown-address + 2)
348 ; CHECK-NEXT: PseudoRET
350 ; UNALIGNED-LABEL: name: store_i32_align2
351 ; UNALIGNED: liveins: $x10, $x11
352 ; UNALIGNED-NEXT: {{ $}}
353 ; UNALIGNED-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
354 ; UNALIGNED-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
355 ; UNALIGNED-NEXT: G_STORE [[COPY]](s32), [[COPY1]](p0) :: (store (s32), align 2)
356 ; UNALIGNED-NEXT: PseudoRET
357 %0:_(s32) = COPY $x10
359 G_STORE %0(s32), %1(p0) :: (store (s32), align 2)