1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=riscv64 | FileCheck %s --check-prefixes=CHECK,RV64I
3 ; RUN: llc < %s -mtriple=riscv64 -mattr=+zba,+zbb | \
4 ; RUN: FileCheck %s --check-prefixes=CHECK,RV64ZB
6 ; Make sure we emit an lw for the stack reload in 'truebb'.
7 define i1 @test_sext_w(i64 %x, i32 %y) nounwind {
8 ; CHECK-LABEL: test_sext_w:
10 ; CHECK-NEXT: addi sp, sp, -144
11 ; CHECK-NEXT: sd ra, 136(sp) # 8-byte Folded Spill
12 ; CHECK-NEXT: sd gp, 128(sp) # 8-byte Folded Spill
13 ; CHECK-NEXT: sd tp, 120(sp) # 8-byte Folded Spill
14 ; CHECK-NEXT: sd s0, 112(sp) # 8-byte Folded Spill
15 ; CHECK-NEXT: sd s1, 104(sp) # 8-byte Folded Spill
16 ; CHECK-NEXT: sd s2, 96(sp) # 8-byte Folded Spill
17 ; CHECK-NEXT: sd s3, 88(sp) # 8-byte Folded Spill
18 ; CHECK-NEXT: sd s4, 80(sp) # 8-byte Folded Spill
19 ; CHECK-NEXT: sd s5, 72(sp) # 8-byte Folded Spill
20 ; CHECK-NEXT: sd s6, 64(sp) # 8-byte Folded Spill
21 ; CHECK-NEXT: sd s7, 56(sp) # 8-byte Folded Spill
22 ; CHECK-NEXT: sd s8, 48(sp) # 8-byte Folded Spill
23 ; CHECK-NEXT: sd s9, 40(sp) # 8-byte Folded Spill
24 ; CHECK-NEXT: sd s10, 32(sp) # 8-byte Folded Spill
25 ; CHECK-NEXT: sd s11, 24(sp) # 8-byte Folded Spill
26 ; CHECK-NEXT: sd a1, 8(sp) # 8-byte Folded Spill
27 ; CHECK-NEXT: sd a0, 16(sp) # 8-byte Folded Spill
30 ; CHECK-NEXT: ld a0, 16(sp) # 8-byte Folded Reload
31 ; CHECK-NEXT: beqz a0, .LBB0_2
32 ; CHECK-NEXT: # %bb.1: # %falsebb
33 ; CHECK-NEXT: li a0, 0
34 ; CHECK-NEXT: j .LBB0_3
35 ; CHECK-NEXT: .LBB0_2: # %truebb
36 ; CHECK-NEXT: lw a0, 8(sp) # 8-byte Folded Reload
37 ; CHECK-NEXT: slti a0, a0, 0
38 ; CHECK-NEXT: .LBB0_3: # %falsebb
39 ; CHECK-NEXT: ld ra, 136(sp) # 8-byte Folded Reload
40 ; CHECK-NEXT: ld gp, 128(sp) # 8-byte Folded Reload
41 ; CHECK-NEXT: ld tp, 120(sp) # 8-byte Folded Reload
42 ; CHECK-NEXT: ld s0, 112(sp) # 8-byte Folded Reload
43 ; CHECK-NEXT: ld s1, 104(sp) # 8-byte Folded Reload
44 ; CHECK-NEXT: ld s2, 96(sp) # 8-byte Folded Reload
45 ; CHECK-NEXT: ld s3, 88(sp) # 8-byte Folded Reload
46 ; CHECK-NEXT: ld s4, 80(sp) # 8-byte Folded Reload
47 ; CHECK-NEXT: ld s5, 72(sp) # 8-byte Folded Reload
48 ; CHECK-NEXT: ld s6, 64(sp) # 8-byte Folded Reload
49 ; CHECK-NEXT: ld s7, 56(sp) # 8-byte Folded Reload
50 ; CHECK-NEXT: ld s8, 48(sp) # 8-byte Folded Reload
51 ; CHECK-NEXT: ld s9, 40(sp) # 8-byte Folded Reload
52 ; CHECK-NEXT: ld s10, 32(sp) # 8-byte Folded Reload
53 ; CHECK-NEXT: ld s11, 24(sp) # 8-byte Folded Reload
54 ; CHECK-NEXT: addi sp, sp, 144
56 tail call void asm sideeffect "", "~{x1},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x18},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28},~{x29},~{x30},~{x31}"()
57 %a = icmp eq i64 %x, 0
58 br i1 %a, label %truebb, label %falsebb
60 %b = icmp slt i32 %y, 0
66 ; Make sure we emit an lb for the stack reload in 'truebb' with Zbb.
67 define i64 @test_sext_b(i64 %x, i8 %y) nounwind {
68 ; RV64I-LABEL: test_sext_b:
70 ; RV64I-NEXT: addi sp, sp, -144
71 ; RV64I-NEXT: sd ra, 136(sp) # 8-byte Folded Spill
72 ; RV64I-NEXT: sd gp, 128(sp) # 8-byte Folded Spill
73 ; RV64I-NEXT: sd tp, 120(sp) # 8-byte Folded Spill
74 ; RV64I-NEXT: sd s0, 112(sp) # 8-byte Folded Spill
75 ; RV64I-NEXT: sd s1, 104(sp) # 8-byte Folded Spill
76 ; RV64I-NEXT: sd s2, 96(sp) # 8-byte Folded Spill
77 ; RV64I-NEXT: sd s3, 88(sp) # 8-byte Folded Spill
78 ; RV64I-NEXT: sd s4, 80(sp) # 8-byte Folded Spill
79 ; RV64I-NEXT: sd s5, 72(sp) # 8-byte Folded Spill
80 ; RV64I-NEXT: sd s6, 64(sp) # 8-byte Folded Spill
81 ; RV64I-NEXT: sd s7, 56(sp) # 8-byte Folded Spill
82 ; RV64I-NEXT: sd s8, 48(sp) # 8-byte Folded Spill
83 ; RV64I-NEXT: sd s9, 40(sp) # 8-byte Folded Spill
84 ; RV64I-NEXT: sd s10, 32(sp) # 8-byte Folded Spill
85 ; RV64I-NEXT: sd s11, 24(sp) # 8-byte Folded Spill
86 ; RV64I-NEXT: sd a1, 8(sp) # 8-byte Folded Spill
87 ; RV64I-NEXT: sd a0, 16(sp) # 8-byte Folded Spill
90 ; RV64I-NEXT: ld a0, 16(sp) # 8-byte Folded Reload
91 ; RV64I-NEXT: beqz a0, .LBB1_2
92 ; RV64I-NEXT: # %bb.1: # %falsebb
93 ; RV64I-NEXT: li a0, 0
94 ; RV64I-NEXT: j .LBB1_3
95 ; RV64I-NEXT: .LBB1_2: # %truebb
96 ; RV64I-NEXT: ld a0, 8(sp) # 8-byte Folded Reload
97 ; RV64I-NEXT: slli a0, a0, 56
98 ; RV64I-NEXT: srai a0, a0, 56
99 ; RV64I-NEXT: .LBB1_3: # %falsebb
100 ; RV64I-NEXT: ld ra, 136(sp) # 8-byte Folded Reload
101 ; RV64I-NEXT: ld gp, 128(sp) # 8-byte Folded Reload
102 ; RV64I-NEXT: ld tp, 120(sp) # 8-byte Folded Reload
103 ; RV64I-NEXT: ld s0, 112(sp) # 8-byte Folded Reload
104 ; RV64I-NEXT: ld s1, 104(sp) # 8-byte Folded Reload
105 ; RV64I-NEXT: ld s2, 96(sp) # 8-byte Folded Reload
106 ; RV64I-NEXT: ld s3, 88(sp) # 8-byte Folded Reload
107 ; RV64I-NEXT: ld s4, 80(sp) # 8-byte Folded Reload
108 ; RV64I-NEXT: ld s5, 72(sp) # 8-byte Folded Reload
109 ; RV64I-NEXT: ld s6, 64(sp) # 8-byte Folded Reload
110 ; RV64I-NEXT: ld s7, 56(sp) # 8-byte Folded Reload
111 ; RV64I-NEXT: ld s8, 48(sp) # 8-byte Folded Reload
112 ; RV64I-NEXT: ld s9, 40(sp) # 8-byte Folded Reload
113 ; RV64I-NEXT: ld s10, 32(sp) # 8-byte Folded Reload
114 ; RV64I-NEXT: ld s11, 24(sp) # 8-byte Folded Reload
115 ; RV64I-NEXT: addi sp, sp, 144
118 ; RV64ZB-LABEL: test_sext_b:
120 ; RV64ZB-NEXT: addi sp, sp, -144
121 ; RV64ZB-NEXT: sd ra, 136(sp) # 8-byte Folded Spill
122 ; RV64ZB-NEXT: sd gp, 128(sp) # 8-byte Folded Spill
123 ; RV64ZB-NEXT: sd tp, 120(sp) # 8-byte Folded Spill
124 ; RV64ZB-NEXT: sd s0, 112(sp) # 8-byte Folded Spill
125 ; RV64ZB-NEXT: sd s1, 104(sp) # 8-byte Folded Spill
126 ; RV64ZB-NEXT: sd s2, 96(sp) # 8-byte Folded Spill
127 ; RV64ZB-NEXT: sd s3, 88(sp) # 8-byte Folded Spill
128 ; RV64ZB-NEXT: sd s4, 80(sp) # 8-byte Folded Spill
129 ; RV64ZB-NEXT: sd s5, 72(sp) # 8-byte Folded Spill
130 ; RV64ZB-NEXT: sd s6, 64(sp) # 8-byte Folded Spill
131 ; RV64ZB-NEXT: sd s7, 56(sp) # 8-byte Folded Spill
132 ; RV64ZB-NEXT: sd s8, 48(sp) # 8-byte Folded Spill
133 ; RV64ZB-NEXT: sd s9, 40(sp) # 8-byte Folded Spill
134 ; RV64ZB-NEXT: sd s10, 32(sp) # 8-byte Folded Spill
135 ; RV64ZB-NEXT: sd s11, 24(sp) # 8-byte Folded Spill
136 ; RV64ZB-NEXT: sd a1, 8(sp) # 8-byte Folded Spill
137 ; RV64ZB-NEXT: sd a0, 16(sp) # 8-byte Folded Spill
139 ; RV64ZB-NEXT: #NO_APP
140 ; RV64ZB-NEXT: ld a0, 16(sp) # 8-byte Folded Reload
141 ; RV64ZB-NEXT: beqz a0, .LBB1_2
142 ; RV64ZB-NEXT: # %bb.1: # %falsebb
143 ; RV64ZB-NEXT: li a0, 0
144 ; RV64ZB-NEXT: j .LBB1_3
145 ; RV64ZB-NEXT: .LBB1_2: # %truebb
146 ; RV64ZB-NEXT: lb a0, 8(sp) # 8-byte Folded Reload
147 ; RV64ZB-NEXT: .LBB1_3: # %falsebb
148 ; RV64ZB-NEXT: ld ra, 136(sp) # 8-byte Folded Reload
149 ; RV64ZB-NEXT: ld gp, 128(sp) # 8-byte Folded Reload
150 ; RV64ZB-NEXT: ld tp, 120(sp) # 8-byte Folded Reload
151 ; RV64ZB-NEXT: ld s0, 112(sp) # 8-byte Folded Reload
152 ; RV64ZB-NEXT: ld s1, 104(sp) # 8-byte Folded Reload
153 ; RV64ZB-NEXT: ld s2, 96(sp) # 8-byte Folded Reload
154 ; RV64ZB-NEXT: ld s3, 88(sp) # 8-byte Folded Reload
155 ; RV64ZB-NEXT: ld s4, 80(sp) # 8-byte Folded Reload
156 ; RV64ZB-NEXT: ld s5, 72(sp) # 8-byte Folded Reload
157 ; RV64ZB-NEXT: ld s6, 64(sp) # 8-byte Folded Reload
158 ; RV64ZB-NEXT: ld s7, 56(sp) # 8-byte Folded Reload
159 ; RV64ZB-NEXT: ld s8, 48(sp) # 8-byte Folded Reload
160 ; RV64ZB-NEXT: ld s9, 40(sp) # 8-byte Folded Reload
161 ; RV64ZB-NEXT: ld s10, 32(sp) # 8-byte Folded Reload
162 ; RV64ZB-NEXT: ld s11, 24(sp) # 8-byte Folded Reload
163 ; RV64ZB-NEXT: addi sp, sp, 144
165 tail call void asm sideeffect "", "~{x1},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x18},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28},~{x29},~{x30},~{x31}"()
166 %a = icmp eq i64 %x, 0
167 br i1 %a, label %truebb, label %falsebb
169 %b = sext i8 %y to i64
175 ; Make sure we emit an lh for the stack reload in 'truebb' with Zbb.
176 define i64 @test_sext_h(i64 %x, i16 %y) nounwind {
177 ; RV64I-LABEL: test_sext_h:
179 ; RV64I-NEXT: addi sp, sp, -144
180 ; RV64I-NEXT: sd ra, 136(sp) # 8-byte Folded Spill
181 ; RV64I-NEXT: sd gp, 128(sp) # 8-byte Folded Spill
182 ; RV64I-NEXT: sd tp, 120(sp) # 8-byte Folded Spill
183 ; RV64I-NEXT: sd s0, 112(sp) # 8-byte Folded Spill
184 ; RV64I-NEXT: sd s1, 104(sp) # 8-byte Folded Spill
185 ; RV64I-NEXT: sd s2, 96(sp) # 8-byte Folded Spill
186 ; RV64I-NEXT: sd s3, 88(sp) # 8-byte Folded Spill
187 ; RV64I-NEXT: sd s4, 80(sp) # 8-byte Folded Spill
188 ; RV64I-NEXT: sd s5, 72(sp) # 8-byte Folded Spill
189 ; RV64I-NEXT: sd s6, 64(sp) # 8-byte Folded Spill
190 ; RV64I-NEXT: sd s7, 56(sp) # 8-byte Folded Spill
191 ; RV64I-NEXT: sd s8, 48(sp) # 8-byte Folded Spill
192 ; RV64I-NEXT: sd s9, 40(sp) # 8-byte Folded Spill
193 ; RV64I-NEXT: sd s10, 32(sp) # 8-byte Folded Spill
194 ; RV64I-NEXT: sd s11, 24(sp) # 8-byte Folded Spill
195 ; RV64I-NEXT: sd a1, 8(sp) # 8-byte Folded Spill
196 ; RV64I-NEXT: sd a0, 16(sp) # 8-byte Folded Spill
198 ; RV64I-NEXT: #NO_APP
199 ; RV64I-NEXT: ld a0, 16(sp) # 8-byte Folded Reload
200 ; RV64I-NEXT: beqz a0, .LBB2_2
201 ; RV64I-NEXT: # %bb.1: # %falsebb
202 ; RV64I-NEXT: li a0, 0
203 ; RV64I-NEXT: j .LBB2_3
204 ; RV64I-NEXT: .LBB2_2: # %truebb
205 ; RV64I-NEXT: ld a0, 8(sp) # 8-byte Folded Reload
206 ; RV64I-NEXT: slli a0, a0, 48
207 ; RV64I-NEXT: srai a0, a0, 48
208 ; RV64I-NEXT: .LBB2_3: # %falsebb
209 ; RV64I-NEXT: ld ra, 136(sp) # 8-byte Folded Reload
210 ; RV64I-NEXT: ld gp, 128(sp) # 8-byte Folded Reload
211 ; RV64I-NEXT: ld tp, 120(sp) # 8-byte Folded Reload
212 ; RV64I-NEXT: ld s0, 112(sp) # 8-byte Folded Reload
213 ; RV64I-NEXT: ld s1, 104(sp) # 8-byte Folded Reload
214 ; RV64I-NEXT: ld s2, 96(sp) # 8-byte Folded Reload
215 ; RV64I-NEXT: ld s3, 88(sp) # 8-byte Folded Reload
216 ; RV64I-NEXT: ld s4, 80(sp) # 8-byte Folded Reload
217 ; RV64I-NEXT: ld s5, 72(sp) # 8-byte Folded Reload
218 ; RV64I-NEXT: ld s6, 64(sp) # 8-byte Folded Reload
219 ; RV64I-NEXT: ld s7, 56(sp) # 8-byte Folded Reload
220 ; RV64I-NEXT: ld s8, 48(sp) # 8-byte Folded Reload
221 ; RV64I-NEXT: ld s9, 40(sp) # 8-byte Folded Reload
222 ; RV64I-NEXT: ld s10, 32(sp) # 8-byte Folded Reload
223 ; RV64I-NEXT: ld s11, 24(sp) # 8-byte Folded Reload
224 ; RV64I-NEXT: addi sp, sp, 144
227 ; RV64ZB-LABEL: test_sext_h:
229 ; RV64ZB-NEXT: addi sp, sp, -144
230 ; RV64ZB-NEXT: sd ra, 136(sp) # 8-byte Folded Spill
231 ; RV64ZB-NEXT: sd gp, 128(sp) # 8-byte Folded Spill
232 ; RV64ZB-NEXT: sd tp, 120(sp) # 8-byte Folded Spill
233 ; RV64ZB-NEXT: sd s0, 112(sp) # 8-byte Folded Spill
234 ; RV64ZB-NEXT: sd s1, 104(sp) # 8-byte Folded Spill
235 ; RV64ZB-NEXT: sd s2, 96(sp) # 8-byte Folded Spill
236 ; RV64ZB-NEXT: sd s3, 88(sp) # 8-byte Folded Spill
237 ; RV64ZB-NEXT: sd s4, 80(sp) # 8-byte Folded Spill
238 ; RV64ZB-NEXT: sd s5, 72(sp) # 8-byte Folded Spill
239 ; RV64ZB-NEXT: sd s6, 64(sp) # 8-byte Folded Spill
240 ; RV64ZB-NEXT: sd s7, 56(sp) # 8-byte Folded Spill
241 ; RV64ZB-NEXT: sd s8, 48(sp) # 8-byte Folded Spill
242 ; RV64ZB-NEXT: sd s9, 40(sp) # 8-byte Folded Spill
243 ; RV64ZB-NEXT: sd s10, 32(sp) # 8-byte Folded Spill
244 ; RV64ZB-NEXT: sd s11, 24(sp) # 8-byte Folded Spill
245 ; RV64ZB-NEXT: sd a1, 8(sp) # 8-byte Folded Spill
246 ; RV64ZB-NEXT: sd a0, 16(sp) # 8-byte Folded Spill
248 ; RV64ZB-NEXT: #NO_APP
249 ; RV64ZB-NEXT: ld a0, 16(sp) # 8-byte Folded Reload
250 ; RV64ZB-NEXT: beqz a0, .LBB2_2
251 ; RV64ZB-NEXT: # %bb.1: # %falsebb
252 ; RV64ZB-NEXT: li a0, 0
253 ; RV64ZB-NEXT: j .LBB2_3
254 ; RV64ZB-NEXT: .LBB2_2: # %truebb
255 ; RV64ZB-NEXT: lh a0, 8(sp) # 8-byte Folded Reload
256 ; RV64ZB-NEXT: .LBB2_3: # %falsebb
257 ; RV64ZB-NEXT: ld ra, 136(sp) # 8-byte Folded Reload
258 ; RV64ZB-NEXT: ld gp, 128(sp) # 8-byte Folded Reload
259 ; RV64ZB-NEXT: ld tp, 120(sp) # 8-byte Folded Reload
260 ; RV64ZB-NEXT: ld s0, 112(sp) # 8-byte Folded Reload
261 ; RV64ZB-NEXT: ld s1, 104(sp) # 8-byte Folded Reload
262 ; RV64ZB-NEXT: ld s2, 96(sp) # 8-byte Folded Reload
263 ; RV64ZB-NEXT: ld s3, 88(sp) # 8-byte Folded Reload
264 ; RV64ZB-NEXT: ld s4, 80(sp) # 8-byte Folded Reload
265 ; RV64ZB-NEXT: ld s5, 72(sp) # 8-byte Folded Reload
266 ; RV64ZB-NEXT: ld s6, 64(sp) # 8-byte Folded Reload
267 ; RV64ZB-NEXT: ld s7, 56(sp) # 8-byte Folded Reload
268 ; RV64ZB-NEXT: ld s8, 48(sp) # 8-byte Folded Reload
269 ; RV64ZB-NEXT: ld s9, 40(sp) # 8-byte Folded Reload
270 ; RV64ZB-NEXT: ld s10, 32(sp) # 8-byte Folded Reload
271 ; RV64ZB-NEXT: ld s11, 24(sp) # 8-byte Folded Reload
272 ; RV64ZB-NEXT: addi sp, sp, 144
274 tail call void asm sideeffect "", "~{x1},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x18},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28},~{x29},~{x30},~{x31}"()
275 %a = icmp eq i64 %x, 0
276 br i1 %a, label %truebb, label %falsebb
278 %b = sext i16 %y to i64
284 ; Make sure we emit an lbu for the stack reload in 'truebb' with Zbb.
285 define i64 @test_zext_b(i64 %x, i8 %y) nounwind {
286 ; CHECK-LABEL: test_zext_b:
288 ; CHECK-NEXT: addi sp, sp, -144
289 ; CHECK-NEXT: sd ra, 136(sp) # 8-byte Folded Spill
290 ; CHECK-NEXT: sd gp, 128(sp) # 8-byte Folded Spill
291 ; CHECK-NEXT: sd tp, 120(sp) # 8-byte Folded Spill
292 ; CHECK-NEXT: sd s0, 112(sp) # 8-byte Folded Spill
293 ; CHECK-NEXT: sd s1, 104(sp) # 8-byte Folded Spill
294 ; CHECK-NEXT: sd s2, 96(sp) # 8-byte Folded Spill
295 ; CHECK-NEXT: sd s3, 88(sp) # 8-byte Folded Spill
296 ; CHECK-NEXT: sd s4, 80(sp) # 8-byte Folded Spill
297 ; CHECK-NEXT: sd s5, 72(sp) # 8-byte Folded Spill
298 ; CHECK-NEXT: sd s6, 64(sp) # 8-byte Folded Spill
299 ; CHECK-NEXT: sd s7, 56(sp) # 8-byte Folded Spill
300 ; CHECK-NEXT: sd s8, 48(sp) # 8-byte Folded Spill
301 ; CHECK-NEXT: sd s9, 40(sp) # 8-byte Folded Spill
302 ; CHECK-NEXT: sd s10, 32(sp) # 8-byte Folded Spill
303 ; CHECK-NEXT: sd s11, 24(sp) # 8-byte Folded Spill
304 ; CHECK-NEXT: sd a1, 8(sp) # 8-byte Folded Spill
305 ; CHECK-NEXT: sd a0, 16(sp) # 8-byte Folded Spill
307 ; CHECK-NEXT: #NO_APP
308 ; CHECK-NEXT: ld a0, 16(sp) # 8-byte Folded Reload
309 ; CHECK-NEXT: beqz a0, .LBB3_2
310 ; CHECK-NEXT: # %bb.1: # %falsebb
311 ; CHECK-NEXT: li a0, 0
312 ; CHECK-NEXT: j .LBB3_3
313 ; CHECK-NEXT: .LBB3_2: # %truebb
314 ; CHECK-NEXT: lbu a0, 8(sp) # 8-byte Folded Reload
315 ; CHECK-NEXT: .LBB3_3: # %falsebb
316 ; CHECK-NEXT: ld ra, 136(sp) # 8-byte Folded Reload
317 ; CHECK-NEXT: ld gp, 128(sp) # 8-byte Folded Reload
318 ; CHECK-NEXT: ld tp, 120(sp) # 8-byte Folded Reload
319 ; CHECK-NEXT: ld s0, 112(sp) # 8-byte Folded Reload
320 ; CHECK-NEXT: ld s1, 104(sp) # 8-byte Folded Reload
321 ; CHECK-NEXT: ld s2, 96(sp) # 8-byte Folded Reload
322 ; CHECK-NEXT: ld s3, 88(sp) # 8-byte Folded Reload
323 ; CHECK-NEXT: ld s4, 80(sp) # 8-byte Folded Reload
324 ; CHECK-NEXT: ld s5, 72(sp) # 8-byte Folded Reload
325 ; CHECK-NEXT: ld s6, 64(sp) # 8-byte Folded Reload
326 ; CHECK-NEXT: ld s7, 56(sp) # 8-byte Folded Reload
327 ; CHECK-NEXT: ld s8, 48(sp) # 8-byte Folded Reload
328 ; CHECK-NEXT: ld s9, 40(sp) # 8-byte Folded Reload
329 ; CHECK-NEXT: ld s10, 32(sp) # 8-byte Folded Reload
330 ; CHECK-NEXT: ld s11, 24(sp) # 8-byte Folded Reload
331 ; CHECK-NEXT: addi sp, sp, 144
333 tail call void asm sideeffect "", "~{x1},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x18},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28},~{x29},~{x30},~{x31}"()
334 %a = icmp eq i64 %x, 0
335 br i1 %a, label %truebb, label %falsebb
337 %b = zext i8 %y to i64
343 ; Make sure we emit an lhu for the stack reload in 'truebb' with Zbb.
344 define i64 @test_zext_h(i64 %x, i16 %y) nounwind {
345 ; RV64I-LABEL: test_zext_h:
347 ; RV64I-NEXT: addi sp, sp, -144
348 ; RV64I-NEXT: sd ra, 136(sp) # 8-byte Folded Spill
349 ; RV64I-NEXT: sd gp, 128(sp) # 8-byte Folded Spill
350 ; RV64I-NEXT: sd tp, 120(sp) # 8-byte Folded Spill
351 ; RV64I-NEXT: sd s0, 112(sp) # 8-byte Folded Spill
352 ; RV64I-NEXT: sd s1, 104(sp) # 8-byte Folded Spill
353 ; RV64I-NEXT: sd s2, 96(sp) # 8-byte Folded Spill
354 ; RV64I-NEXT: sd s3, 88(sp) # 8-byte Folded Spill
355 ; RV64I-NEXT: sd s4, 80(sp) # 8-byte Folded Spill
356 ; RV64I-NEXT: sd s5, 72(sp) # 8-byte Folded Spill
357 ; RV64I-NEXT: sd s6, 64(sp) # 8-byte Folded Spill
358 ; RV64I-NEXT: sd s7, 56(sp) # 8-byte Folded Spill
359 ; RV64I-NEXT: sd s8, 48(sp) # 8-byte Folded Spill
360 ; RV64I-NEXT: sd s9, 40(sp) # 8-byte Folded Spill
361 ; RV64I-NEXT: sd s10, 32(sp) # 8-byte Folded Spill
362 ; RV64I-NEXT: sd s11, 24(sp) # 8-byte Folded Spill
363 ; RV64I-NEXT: sd a1, 8(sp) # 8-byte Folded Spill
364 ; RV64I-NEXT: sd a0, 16(sp) # 8-byte Folded Spill
366 ; RV64I-NEXT: #NO_APP
367 ; RV64I-NEXT: ld a0, 16(sp) # 8-byte Folded Reload
368 ; RV64I-NEXT: beqz a0, .LBB4_2
369 ; RV64I-NEXT: # %bb.1: # %falsebb
370 ; RV64I-NEXT: li a0, 0
371 ; RV64I-NEXT: j .LBB4_3
372 ; RV64I-NEXT: .LBB4_2: # %truebb
373 ; RV64I-NEXT: ld a0, 8(sp) # 8-byte Folded Reload
374 ; RV64I-NEXT: slli a0, a0, 48
375 ; RV64I-NEXT: srli a0, a0, 48
376 ; RV64I-NEXT: .LBB4_3: # %falsebb
377 ; RV64I-NEXT: ld ra, 136(sp) # 8-byte Folded Reload
378 ; RV64I-NEXT: ld gp, 128(sp) # 8-byte Folded Reload
379 ; RV64I-NEXT: ld tp, 120(sp) # 8-byte Folded Reload
380 ; RV64I-NEXT: ld s0, 112(sp) # 8-byte Folded Reload
381 ; RV64I-NEXT: ld s1, 104(sp) # 8-byte Folded Reload
382 ; RV64I-NEXT: ld s2, 96(sp) # 8-byte Folded Reload
383 ; RV64I-NEXT: ld s3, 88(sp) # 8-byte Folded Reload
384 ; RV64I-NEXT: ld s4, 80(sp) # 8-byte Folded Reload
385 ; RV64I-NEXT: ld s5, 72(sp) # 8-byte Folded Reload
386 ; RV64I-NEXT: ld s6, 64(sp) # 8-byte Folded Reload
387 ; RV64I-NEXT: ld s7, 56(sp) # 8-byte Folded Reload
388 ; RV64I-NEXT: ld s8, 48(sp) # 8-byte Folded Reload
389 ; RV64I-NEXT: ld s9, 40(sp) # 8-byte Folded Reload
390 ; RV64I-NEXT: ld s10, 32(sp) # 8-byte Folded Reload
391 ; RV64I-NEXT: ld s11, 24(sp) # 8-byte Folded Reload
392 ; RV64I-NEXT: addi sp, sp, 144
395 ; RV64ZB-LABEL: test_zext_h:
397 ; RV64ZB-NEXT: addi sp, sp, -144
398 ; RV64ZB-NEXT: sd ra, 136(sp) # 8-byte Folded Spill
399 ; RV64ZB-NEXT: sd gp, 128(sp) # 8-byte Folded Spill
400 ; RV64ZB-NEXT: sd tp, 120(sp) # 8-byte Folded Spill
401 ; RV64ZB-NEXT: sd s0, 112(sp) # 8-byte Folded Spill
402 ; RV64ZB-NEXT: sd s1, 104(sp) # 8-byte Folded Spill
403 ; RV64ZB-NEXT: sd s2, 96(sp) # 8-byte Folded Spill
404 ; RV64ZB-NEXT: sd s3, 88(sp) # 8-byte Folded Spill
405 ; RV64ZB-NEXT: sd s4, 80(sp) # 8-byte Folded Spill
406 ; RV64ZB-NEXT: sd s5, 72(sp) # 8-byte Folded Spill
407 ; RV64ZB-NEXT: sd s6, 64(sp) # 8-byte Folded Spill
408 ; RV64ZB-NEXT: sd s7, 56(sp) # 8-byte Folded Spill
409 ; RV64ZB-NEXT: sd s8, 48(sp) # 8-byte Folded Spill
410 ; RV64ZB-NEXT: sd s9, 40(sp) # 8-byte Folded Spill
411 ; RV64ZB-NEXT: sd s10, 32(sp) # 8-byte Folded Spill
412 ; RV64ZB-NEXT: sd s11, 24(sp) # 8-byte Folded Spill
413 ; RV64ZB-NEXT: sd a1, 8(sp) # 8-byte Folded Spill
414 ; RV64ZB-NEXT: sd a0, 16(sp) # 8-byte Folded Spill
416 ; RV64ZB-NEXT: #NO_APP
417 ; RV64ZB-NEXT: ld a0, 16(sp) # 8-byte Folded Reload
418 ; RV64ZB-NEXT: beqz a0, .LBB4_2
419 ; RV64ZB-NEXT: # %bb.1: # %falsebb
420 ; RV64ZB-NEXT: li a0, 0
421 ; RV64ZB-NEXT: j .LBB4_3
422 ; RV64ZB-NEXT: .LBB4_2: # %truebb
423 ; RV64ZB-NEXT: lhu a0, 8(sp) # 8-byte Folded Reload
424 ; RV64ZB-NEXT: .LBB4_3: # %falsebb
425 ; RV64ZB-NEXT: ld ra, 136(sp) # 8-byte Folded Reload
426 ; RV64ZB-NEXT: ld gp, 128(sp) # 8-byte Folded Reload
427 ; RV64ZB-NEXT: ld tp, 120(sp) # 8-byte Folded Reload
428 ; RV64ZB-NEXT: ld s0, 112(sp) # 8-byte Folded Reload
429 ; RV64ZB-NEXT: ld s1, 104(sp) # 8-byte Folded Reload
430 ; RV64ZB-NEXT: ld s2, 96(sp) # 8-byte Folded Reload
431 ; RV64ZB-NEXT: ld s3, 88(sp) # 8-byte Folded Reload
432 ; RV64ZB-NEXT: ld s4, 80(sp) # 8-byte Folded Reload
433 ; RV64ZB-NEXT: ld s5, 72(sp) # 8-byte Folded Reload
434 ; RV64ZB-NEXT: ld s6, 64(sp) # 8-byte Folded Reload
435 ; RV64ZB-NEXT: ld s7, 56(sp) # 8-byte Folded Reload
436 ; RV64ZB-NEXT: ld s8, 48(sp) # 8-byte Folded Reload
437 ; RV64ZB-NEXT: ld s9, 40(sp) # 8-byte Folded Reload
438 ; RV64ZB-NEXT: ld s10, 32(sp) # 8-byte Folded Reload
439 ; RV64ZB-NEXT: ld s11, 24(sp) # 8-byte Folded Reload
440 ; RV64ZB-NEXT: addi sp, sp, 144
442 tail call void asm sideeffect "", "~{x1},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x18},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28},~{x29},~{x30},~{x31}"()
443 %a = icmp eq i64 %x, 0
444 br i1 %a, label %truebb, label %falsebb
446 %b = zext i16 %y to i64
452 ; Make sure we emit an lwu for the stack reload in 'truebb' with Zbb.
453 define i64 @test_zext_w(i64 %x, i32 %y) nounwind {
454 ; RV64I-LABEL: test_zext_w:
456 ; RV64I-NEXT: addi sp, sp, -144
457 ; RV64I-NEXT: sd ra, 136(sp) # 8-byte Folded Spill
458 ; RV64I-NEXT: sd gp, 128(sp) # 8-byte Folded Spill
459 ; RV64I-NEXT: sd tp, 120(sp) # 8-byte Folded Spill
460 ; RV64I-NEXT: sd s0, 112(sp) # 8-byte Folded Spill
461 ; RV64I-NEXT: sd s1, 104(sp) # 8-byte Folded Spill
462 ; RV64I-NEXT: sd s2, 96(sp) # 8-byte Folded Spill
463 ; RV64I-NEXT: sd s3, 88(sp) # 8-byte Folded Spill
464 ; RV64I-NEXT: sd s4, 80(sp) # 8-byte Folded Spill
465 ; RV64I-NEXT: sd s5, 72(sp) # 8-byte Folded Spill
466 ; RV64I-NEXT: sd s6, 64(sp) # 8-byte Folded Spill
467 ; RV64I-NEXT: sd s7, 56(sp) # 8-byte Folded Spill
468 ; RV64I-NEXT: sd s8, 48(sp) # 8-byte Folded Spill
469 ; RV64I-NEXT: sd s9, 40(sp) # 8-byte Folded Spill
470 ; RV64I-NEXT: sd s10, 32(sp) # 8-byte Folded Spill
471 ; RV64I-NEXT: sd s11, 24(sp) # 8-byte Folded Spill
472 ; RV64I-NEXT: sd a1, 8(sp) # 8-byte Folded Spill
473 ; RV64I-NEXT: sd a0, 16(sp) # 8-byte Folded Spill
475 ; RV64I-NEXT: #NO_APP
476 ; RV64I-NEXT: ld a0, 16(sp) # 8-byte Folded Reload
477 ; RV64I-NEXT: beqz a0, .LBB5_2
478 ; RV64I-NEXT: # %bb.1: # %falsebb
479 ; RV64I-NEXT: li a0, 0
480 ; RV64I-NEXT: j .LBB5_3
481 ; RV64I-NEXT: .LBB5_2: # %truebb
482 ; RV64I-NEXT: ld a0, 8(sp) # 8-byte Folded Reload
483 ; RV64I-NEXT: slli a0, a0, 32
484 ; RV64I-NEXT: srli a0, a0, 32
485 ; RV64I-NEXT: .LBB5_3: # %falsebb
486 ; RV64I-NEXT: ld ra, 136(sp) # 8-byte Folded Reload
487 ; RV64I-NEXT: ld gp, 128(sp) # 8-byte Folded Reload
488 ; RV64I-NEXT: ld tp, 120(sp) # 8-byte Folded Reload
489 ; RV64I-NEXT: ld s0, 112(sp) # 8-byte Folded Reload
490 ; RV64I-NEXT: ld s1, 104(sp) # 8-byte Folded Reload
491 ; RV64I-NEXT: ld s2, 96(sp) # 8-byte Folded Reload
492 ; RV64I-NEXT: ld s3, 88(sp) # 8-byte Folded Reload
493 ; RV64I-NEXT: ld s4, 80(sp) # 8-byte Folded Reload
494 ; RV64I-NEXT: ld s5, 72(sp) # 8-byte Folded Reload
495 ; RV64I-NEXT: ld s6, 64(sp) # 8-byte Folded Reload
496 ; RV64I-NEXT: ld s7, 56(sp) # 8-byte Folded Reload
497 ; RV64I-NEXT: ld s8, 48(sp) # 8-byte Folded Reload
498 ; RV64I-NEXT: ld s9, 40(sp) # 8-byte Folded Reload
499 ; RV64I-NEXT: ld s10, 32(sp) # 8-byte Folded Reload
500 ; RV64I-NEXT: ld s11, 24(sp) # 8-byte Folded Reload
501 ; RV64I-NEXT: addi sp, sp, 144
504 ; RV64ZB-LABEL: test_zext_w:
506 ; RV64ZB-NEXT: addi sp, sp, -144
507 ; RV64ZB-NEXT: sd ra, 136(sp) # 8-byte Folded Spill
508 ; RV64ZB-NEXT: sd gp, 128(sp) # 8-byte Folded Spill
509 ; RV64ZB-NEXT: sd tp, 120(sp) # 8-byte Folded Spill
510 ; RV64ZB-NEXT: sd s0, 112(sp) # 8-byte Folded Spill
511 ; RV64ZB-NEXT: sd s1, 104(sp) # 8-byte Folded Spill
512 ; RV64ZB-NEXT: sd s2, 96(sp) # 8-byte Folded Spill
513 ; RV64ZB-NEXT: sd s3, 88(sp) # 8-byte Folded Spill
514 ; RV64ZB-NEXT: sd s4, 80(sp) # 8-byte Folded Spill
515 ; RV64ZB-NEXT: sd s5, 72(sp) # 8-byte Folded Spill
516 ; RV64ZB-NEXT: sd s6, 64(sp) # 8-byte Folded Spill
517 ; RV64ZB-NEXT: sd s7, 56(sp) # 8-byte Folded Spill
518 ; RV64ZB-NEXT: sd s8, 48(sp) # 8-byte Folded Spill
519 ; RV64ZB-NEXT: sd s9, 40(sp) # 8-byte Folded Spill
520 ; RV64ZB-NEXT: sd s10, 32(sp) # 8-byte Folded Spill
521 ; RV64ZB-NEXT: sd s11, 24(sp) # 8-byte Folded Spill
522 ; RV64ZB-NEXT: sd a1, 8(sp) # 8-byte Folded Spill
523 ; RV64ZB-NEXT: sd a0, 16(sp) # 8-byte Folded Spill
525 ; RV64ZB-NEXT: #NO_APP
526 ; RV64ZB-NEXT: ld a0, 16(sp) # 8-byte Folded Reload
527 ; RV64ZB-NEXT: beqz a0, .LBB5_2
528 ; RV64ZB-NEXT: # %bb.1: # %falsebb
529 ; RV64ZB-NEXT: li a0, 0
530 ; RV64ZB-NEXT: j .LBB5_3
531 ; RV64ZB-NEXT: .LBB5_2: # %truebb
532 ; RV64ZB-NEXT: lwu a0, 8(sp) # 8-byte Folded Reload
533 ; RV64ZB-NEXT: .LBB5_3: # %falsebb
534 ; RV64ZB-NEXT: ld ra, 136(sp) # 8-byte Folded Reload
535 ; RV64ZB-NEXT: ld gp, 128(sp) # 8-byte Folded Reload
536 ; RV64ZB-NEXT: ld tp, 120(sp) # 8-byte Folded Reload
537 ; RV64ZB-NEXT: ld s0, 112(sp) # 8-byte Folded Reload
538 ; RV64ZB-NEXT: ld s1, 104(sp) # 8-byte Folded Reload
539 ; RV64ZB-NEXT: ld s2, 96(sp) # 8-byte Folded Reload
540 ; RV64ZB-NEXT: ld s3, 88(sp) # 8-byte Folded Reload
541 ; RV64ZB-NEXT: ld s4, 80(sp) # 8-byte Folded Reload
542 ; RV64ZB-NEXT: ld s5, 72(sp) # 8-byte Folded Reload
543 ; RV64ZB-NEXT: ld s6, 64(sp) # 8-byte Folded Reload
544 ; RV64ZB-NEXT: ld s7, 56(sp) # 8-byte Folded Reload
545 ; RV64ZB-NEXT: ld s8, 48(sp) # 8-byte Folded Reload
546 ; RV64ZB-NEXT: ld s9, 40(sp) # 8-byte Folded Reload
547 ; RV64ZB-NEXT: ld s10, 32(sp) # 8-byte Folded Reload
548 ; RV64ZB-NEXT: ld s11, 24(sp) # 8-byte Folded Reload
549 ; RV64ZB-NEXT: addi sp, sp, 144
551 tail call void asm sideeffect "", "~{x1},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x18},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28},~{x29},~{x30},~{x31}"()
552 %a = icmp eq i64 %x, 0
553 br i1 %a, label %truebb, label %falsebb
555 %b = zext i32 %y to i64