1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -o - %s -mtriple=riscv64 -mattr=+c -simplify-mir \
3 # RUN: -run-pass=riscv-make-compressible | FileCheck %s
6 define void @store_common_value(ptr %a, ptr %b, ptr %c) #0 {
8 store i64 0, ptr %a, align 8
9 store i64 0, ptr %b, align 8
10 store i64 0, ptr %c, align 8
14 define void @store_common_ptr(i64 %a, i64 %b, i64 %c, i64 %d, i64 %e, i64 %f, ptr %p) #0 {
16 store volatile i64 1, ptr %p, align 8
17 store volatile i64 3, ptr %p, align 8
18 store volatile i64 5, ptr %p, align 8
22 define void @store_common_ptr_self(i64 %a, i64 %b, i64 %c, i64 %d, i64 %e, i64 %f, ptr %p) #0 {
24 %q = bitcast ptr %p to ptr
25 store volatile i64 1, ptr %p, align 8
26 store volatile i64 3, ptr %p, align 8
27 store volatile ptr %p, ptr %q, align 8
31 define void @load_common_ptr(i64 %a, i64 %b, i64 %c, i64 %d, i64 %e, i64 %f, ptr %p) #0 {
33 %g = load volatile i64, ptr %p, align 8
34 %h = load volatile i64, ptr %p, align 8
35 %i = load volatile i64, ptr %p, align 8
39 define void @store_large_offset(ptr %p) #0 {
41 %0 = getelementptr inbounds i64, ptr %p, i64 100
42 store volatile i64 1, ptr %0, align 8
43 %1 = getelementptr inbounds i64, ptr %p, i64 101
44 store volatile i64 3, ptr %1, align 8
45 %2 = getelementptr inbounds i64, ptr %p, i64 102
46 store volatile i64 5, ptr %2, align 8
47 %3 = getelementptr inbounds i64, ptr %p, i64 103
48 store volatile i64 7, ptr %3, align 8
52 define void @load_large_offset(ptr %p) #0 {
54 %0 = getelementptr inbounds i64, ptr %p, i64 100
55 %a = load volatile i64, ptr %0, align 8
56 %1 = getelementptr inbounds i64, ptr %p, i64 101
57 %b = load volatile i64, ptr %1, align 8
58 %2 = getelementptr inbounds i64, ptr %p, i64 102
59 %c = load volatile i64, ptr %2, align 8
60 %3 = getelementptr inbounds i64, ptr %p, i64 103
61 %d = load volatile i64, ptr %3, align 8
65 define void @store_common_value_no_opt(ptr %a) #0 {
67 store i64 0, ptr %a, align 8
71 define void @store_common_ptr_no_opt(i64 %a, i64 %b, i64 %c, i64 %d, i64 %e, i64 %f, ptr %p) #0 {
73 store volatile i64 1, ptr %p, align 8
77 define void @load_common_ptr_no_opt(i64 %a, i64 %b, i64 %c, i64 %d, i64 %e, i64 %f, ptr %p) #0 {
79 %g = load volatile i64, ptr %p, align 8
83 define void @store_large_offset_no_opt(ptr %p) #0 {
85 %0 = getelementptr inbounds i64, ptr %p, i64 100
86 store volatile i64 1, ptr %0, align 8
87 %1 = getelementptr inbounds i64, ptr %p, i64 101
88 store volatile i64 3, ptr %1, align 8
92 define void @load_large_offset_no_opt(ptr %p) #0 {
94 %0 = getelementptr inbounds i64, ptr %p, i64 100
95 %a = load volatile i64, ptr %0, align 8
96 %1 = getelementptr inbounds i64, ptr %p, i64 101
97 %b = load volatile i64, ptr %1, align 8
101 attributes #0 = { minsize "target-features"="+c" }
105 name: store_common_value
106 tracksRegLiveness: true
109 liveins: $x10, $x11, $x12
111 ; CHECK-LABEL: name: store_common_value
112 ; CHECK: liveins: $x10, $x11, $x12
114 ; CHECK-NEXT: $x13 = ADDI $x0, 0
115 ; CHECK-NEXT: SD $x13, killed renamable $x10, 0 :: (store (s64) into %ir.a)
116 ; CHECK-NEXT: SD $x13, killed renamable $x11, 0 :: (store (s64) into %ir.b)
117 ; CHECK-NEXT: SD $x13, killed renamable $x12, 0 :: (store (s64) into %ir.c)
118 ; CHECK-NEXT: PseudoRET
119 SD $x0, killed renamable $x10, 0 :: (store (s64) into %ir.a)
120 SD $x0, killed renamable $x11, 0 :: (store (s64) into %ir.b)
121 SD $x0, killed renamable $x12, 0 :: (store (s64) into %ir.c)
126 name: store_common_ptr
127 tracksRegLiveness: true
132 ; CHECK-LABEL: name: store_common_ptr
133 ; CHECK: liveins: $x16
135 ; CHECK-NEXT: renamable $x10 = ADDI $x0, 1
136 ; CHECK-NEXT: $x11 = ADDI $x16, 0
137 ; CHECK-NEXT: SD killed renamable $x10, $x11, 0 :: (volatile store (s64) into %ir.p)
138 ; CHECK-NEXT: renamable $x10 = ADDI $x0, 3
139 ; CHECK-NEXT: SD killed renamable $x10, $x11, 0 :: (volatile store (s64) into %ir.p)
140 ; CHECK-NEXT: renamable $x10 = ADDI $x0, 5
141 ; CHECK-NEXT: SD killed renamable $x10, killed $x11, 0 :: (volatile store (s64) into %ir.p)
142 ; CHECK-NEXT: PseudoRET
143 renamable $x10 = ADDI $x0, 1
144 SD killed renamable $x10, renamable $x16, 0 :: (volatile store (s64) into %ir.p)
145 renamable $x10 = ADDI $x0, 3
146 SD killed renamable $x10, renamable $x16, 0 :: (volatile store (s64) into %ir.p)
147 renamable $x10 = ADDI $x0, 5
148 SD killed renamable $x10, killed renamable $x16, 0 :: (volatile store (s64) into %ir.p)
153 name: store_common_ptr_self
154 tracksRegLiveness: true
159 ; CHECK-LABEL: name: store_common_ptr_self
160 ; CHECK: liveins: $x16
162 ; CHECK-NEXT: renamable $x10 = ADDI $x0, 1
163 ; CHECK-NEXT: $x11 = ADDI $x16, 0
164 ; CHECK-NEXT: SD killed renamable $x10, $x11, 0 :: (volatile store (s64) into %ir.p)
165 ; CHECK-NEXT: renamable $x10 = ADDI $x0, 3
166 ; CHECK-NEXT: SD killed renamable $x10, $x11, 0 :: (volatile store (s64) into %ir.p)
167 ; CHECK-NEXT: SD killed $x11, $x11, 0 :: (volatile store (s64) into %ir.q)
168 ; CHECK-NEXT: PseudoRET
169 renamable $x10 = ADDI $x0, 1
170 SD killed renamable $x10, renamable $x16, 0 :: (volatile store (s64) into %ir.p)
171 renamable $x10 = ADDI $x0, 3
172 SD killed renamable $x10, renamable $x16, 0 :: (volatile store (s64) into %ir.p)
173 SD killed renamable $x16, renamable $x16, 0 :: (volatile store (s64) into %ir.q)
178 name: load_common_ptr
179 tracksRegLiveness: true
184 ; CHECK-LABEL: name: load_common_ptr
185 ; CHECK: liveins: $x16
187 ; CHECK-NEXT: $x11 = ADDI $x16, 0
188 ; CHECK-NEXT: dead renamable $x10 = LD $x11, 0 :: (volatile load (s64) from %ir.p)
189 ; CHECK-NEXT: dead renamable $x10 = LD $x11, 0 :: (volatile load (s64) from %ir.p)
190 ; CHECK-NEXT: dead renamable $x10 = LD killed $x11, 0 :: (volatile load (s64) from %ir.p)
191 ; CHECK-NEXT: PseudoRET
192 dead renamable $x10 = LD renamable $x16, 0 :: (volatile load (s64) from %ir.p)
193 dead renamable $x10 = LD renamable $x16, 0 :: (volatile load (s64) from %ir.p)
194 dead renamable $x10 = LD killed renamable $x16, 0 :: (volatile load (s64) from %ir.p)
199 name: store_large_offset
200 tracksRegLiveness: true
205 ; CHECK-LABEL: name: store_large_offset
206 ; CHECK: liveins: $x10
208 ; CHECK-NEXT: renamable $x11 = ADDI $x0, 1
209 ; CHECK-NEXT: $x12 = ADDI $x10, 768
210 ; CHECK-NEXT: SD killed renamable $x11, $x12, 32 :: (volatile store (s64) into %ir.0)
211 ; CHECK-NEXT: renamable $x11 = ADDI $x0, 3
212 ; CHECK-NEXT: SD killed renamable $x11, $x12, 40 :: (volatile store (s64) into %ir.1)
213 ; CHECK-NEXT: renamable $x11 = ADDI $x0, 5
214 ; CHECK-NEXT: SD killed renamable $x11, $x12, 48 :: (volatile store (s64) into %ir.2)
215 ; CHECK-NEXT: renamable $x11 = ADDI $x0, 7
216 ; CHECK-NEXT: SD killed renamable $x11, killed $x12, 56 :: (volatile store (s64) into %ir.3)
217 ; CHECK-NEXT: PseudoRET
218 renamable $x11 = ADDI $x0, 1
219 SD killed renamable $x11, renamable $x10, 800 :: (volatile store (s64) into %ir.0)
220 renamable $x11 = ADDI $x0, 3
221 SD killed renamable $x11, renamable $x10, 808 :: (volatile store (s64) into %ir.1)
222 renamable $x11 = ADDI $x0, 5
223 SD killed renamable $x11, renamable $x10, 816 :: (volatile store (s64) into %ir.2)
224 renamable $x11 = ADDI $x0, 7
225 SD killed renamable $x11, killed renamable $x10, 824 :: (volatile store (s64) into %ir.3)
230 name: load_large_offset
231 tracksRegLiveness: true
236 ; CHECK-LABEL: name: load_large_offset
237 ; CHECK: liveins: $x10
239 ; CHECK-NEXT: $x12 = ADDI $x10, 768
240 ; CHECK-NEXT: dead renamable $x11 = LD $x12, 32 :: (volatile load (s64) from %ir.0)
241 ; CHECK-NEXT: dead renamable $x11 = LD $x12, 40 :: (volatile load (s64) from %ir.1)
242 ; CHECK-NEXT: dead renamable $x11 = LD $x12, 48 :: (volatile load (s64) from %ir.2)
243 ; CHECK-NEXT: dead renamable $x10 = LD killed $x12, 56 :: (volatile load (s64) from %ir.3)
244 ; CHECK-NEXT: PseudoRET
245 dead renamable $x11 = LD renamable $x10, 800 :: (volatile load (s64) from %ir.0)
246 dead renamable $x11 = LD renamable $x10, 808 :: (volatile load (s64) from %ir.1)
247 dead renamable $x11 = LD renamable $x10, 816 :: (volatile load (s64) from %ir.2)
248 dead renamable $x10 = LD killed renamable $x10, 824 :: (volatile load (s64) from %ir.3)
253 name: store_common_value_no_opt
254 tracksRegLiveness: true
259 ; CHECK-LABEL: name: store_common_value_no_opt
260 ; CHECK: liveins: $x10
262 ; CHECK-NEXT: SD $x0, killed renamable $x10, 0 :: (store (s64) into %ir.a)
263 ; CHECK-NEXT: PseudoRET
264 SD $x0, killed renamable $x10, 0 :: (store (s64) into %ir.a)
269 name: store_common_ptr_no_opt
270 tracksRegLiveness: true
275 ; CHECK-LABEL: name: store_common_ptr_no_opt
276 ; CHECK: liveins: $x16
278 ; CHECK-NEXT: renamable $x10 = ADDI $x0, 1
279 ; CHECK-NEXT: SD killed renamable $x10, killed renamable $x16, 0 :: (volatile store (s64) into %ir.p)
280 ; CHECK-NEXT: PseudoRET
281 renamable $x10 = ADDI $x0, 1
282 SD killed renamable $x10, killed renamable $x16, 0 :: (volatile store (s64) into %ir.p)
287 name: load_common_ptr_no_opt
288 tracksRegLiveness: true
293 ; CHECK-LABEL: name: load_common_ptr_no_opt
294 ; CHECK: liveins: $x16
296 ; CHECK-NEXT: dead renamable $x10 = LD killed renamable $x16, 0 :: (volatile load (s64) from %ir.p)
297 ; CHECK-NEXT: PseudoRET
298 dead renamable $x10 = LD killed renamable $x16, 0 :: (volatile load (s64) from %ir.p)
303 name: store_large_offset_no_opt
304 tracksRegLiveness: true
309 ; CHECK-LABEL: name: store_large_offset_no_opt
310 ; CHECK: liveins: $x10
312 ; CHECK-NEXT: renamable $x11 = ADDI $x0, 1
313 ; CHECK-NEXT: SD killed renamable $x11, renamable $x10, 800 :: (volatile store (s64) into %ir.0)
314 ; CHECK-NEXT: renamable $x11 = ADDI $x0, 3
315 ; CHECK-NEXT: SD killed renamable $x11, killed renamable $x10, 808 :: (volatile store (s64) into %ir.1)
316 ; CHECK-NEXT: PseudoRET
317 renamable $x11 = ADDI $x0, 1
318 SD killed renamable $x11, renamable $x10, 800 :: (volatile store (s64) into %ir.0)
319 renamable $x11 = ADDI $x0, 3
320 SD killed renamable $x11, killed renamable $x10, 808 :: (volatile store (s64) into %ir.1)
325 name: load_large_offset_no_opt
326 tracksRegLiveness: true
331 ; CHECK-LABEL: name: load_large_offset_no_opt
332 ; CHECK: liveins: $x10
334 ; CHECK-NEXT: dead renamable $x11 = LD renamable $x10, 800 :: (volatile load (s64) from %ir.0)
335 ; CHECK-NEXT: dead renamable $x10 = LD killed renamable $x10, 808 :: (volatile load (s64) from %ir.1)
336 ; CHECK-NEXT: PseudoRET
337 dead renamable $x11 = LD renamable $x10, 800 :: (volatile load (s64) from %ir.0)
338 dead renamable $x10 = LD killed renamable $x10, 808 :: (volatile load (s64) from %ir.1)