1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
3 ; RUN: | FileCheck %s -check-prefixes=RV32I
4 ; RUN: llc -mtriple=riscv32 -mattr=+xtheadbb -verify-machineinstrs < %s \
5 ; RUN: | FileCheck %s -check-prefixes=RV32XTHEADBB
7 declare i32 @llvm.ctlz.i32(i32, i1)
9 define i32 @ctlz_i32(i32 %a) nounwind {
10 ; RV32I-LABEL: ctlz_i32:
12 ; RV32I-NEXT: beqz a0, .LBB0_2
13 ; RV32I-NEXT: # %bb.1: # %cond.false
14 ; RV32I-NEXT: addi sp, sp, -16
15 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
16 ; RV32I-NEXT: srli a1, a0, 1
17 ; RV32I-NEXT: or a0, a0, a1
18 ; RV32I-NEXT: srli a1, a0, 2
19 ; RV32I-NEXT: or a0, a0, a1
20 ; RV32I-NEXT: srli a1, a0, 4
21 ; RV32I-NEXT: or a0, a0, a1
22 ; RV32I-NEXT: srli a1, a0, 8
23 ; RV32I-NEXT: or a0, a0, a1
24 ; RV32I-NEXT: srli a1, a0, 16
25 ; RV32I-NEXT: or a0, a0, a1
26 ; RV32I-NEXT: not a0, a0
27 ; RV32I-NEXT: srli a1, a0, 1
28 ; RV32I-NEXT: lui a2, 349525
29 ; RV32I-NEXT: addi a2, a2, 1365
30 ; RV32I-NEXT: and a1, a1, a2
31 ; RV32I-NEXT: sub a0, a0, a1
32 ; RV32I-NEXT: lui a1, 209715
33 ; RV32I-NEXT: addi a1, a1, 819
34 ; RV32I-NEXT: and a2, a0, a1
35 ; RV32I-NEXT: srli a0, a0, 2
36 ; RV32I-NEXT: and a0, a0, a1
37 ; RV32I-NEXT: add a0, a2, a0
38 ; RV32I-NEXT: srli a1, a0, 4
39 ; RV32I-NEXT: add a0, a0, a1
40 ; RV32I-NEXT: lui a1, 61681
41 ; RV32I-NEXT: addi a1, a1, -241
42 ; RV32I-NEXT: and a0, a0, a1
43 ; RV32I-NEXT: lui a1, 4112
44 ; RV32I-NEXT: addi a1, a1, 257
45 ; RV32I-NEXT: call __mulsi3
46 ; RV32I-NEXT: srli a0, a0, 24
47 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
48 ; RV32I-NEXT: addi sp, sp, 16
50 ; RV32I-NEXT: .LBB0_2:
51 ; RV32I-NEXT: li a0, 32
54 ; RV32XTHEADBB-LABEL: ctlz_i32:
55 ; RV32XTHEADBB: # %bb.0:
56 ; RV32XTHEADBB-NEXT: th.ff1 a0, a0
57 ; RV32XTHEADBB-NEXT: ret
58 %1 = call i32 @llvm.ctlz.i32(i32 %a, i1 false)
62 declare i64 @llvm.ctlz.i64(i64, i1)
64 define i64 @ctlz_i64(i64 %a) nounwind {
65 ; RV32I-LABEL: ctlz_i64:
67 ; RV32I-NEXT: addi sp, sp, -32
68 ; RV32I-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
69 ; RV32I-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
70 ; RV32I-NEXT: sw s1, 20(sp) # 4-byte Folded Spill
71 ; RV32I-NEXT: sw s2, 16(sp) # 4-byte Folded Spill
72 ; RV32I-NEXT: sw s3, 12(sp) # 4-byte Folded Spill
73 ; RV32I-NEXT: sw s4, 8(sp) # 4-byte Folded Spill
74 ; RV32I-NEXT: sw s5, 4(sp) # 4-byte Folded Spill
75 ; RV32I-NEXT: sw s6, 0(sp) # 4-byte Folded Spill
76 ; RV32I-NEXT: mv s0, a1
77 ; RV32I-NEXT: mv s2, a0
78 ; RV32I-NEXT: srli a0, a1, 1
79 ; RV32I-NEXT: or a0, a1, a0
80 ; RV32I-NEXT: srli a1, a0, 2
81 ; RV32I-NEXT: or a0, a0, a1
82 ; RV32I-NEXT: srli a1, a0, 4
83 ; RV32I-NEXT: or a0, a0, a1
84 ; RV32I-NEXT: srli a1, a0, 8
85 ; RV32I-NEXT: or a0, a0, a1
86 ; RV32I-NEXT: srli a1, a0, 16
87 ; RV32I-NEXT: or a0, a0, a1
88 ; RV32I-NEXT: not a0, a0
89 ; RV32I-NEXT: srli a1, a0, 1
90 ; RV32I-NEXT: lui a2, 349525
91 ; RV32I-NEXT: addi s4, a2, 1365
92 ; RV32I-NEXT: and a1, a1, s4
93 ; RV32I-NEXT: sub a0, a0, a1
94 ; RV32I-NEXT: lui a1, 209715
95 ; RV32I-NEXT: addi s5, a1, 819
96 ; RV32I-NEXT: and a1, a0, s5
97 ; RV32I-NEXT: srli a0, a0, 2
98 ; RV32I-NEXT: and a0, a0, s5
99 ; RV32I-NEXT: add a0, a1, a0
100 ; RV32I-NEXT: srli a1, a0, 4
101 ; RV32I-NEXT: add a0, a0, a1
102 ; RV32I-NEXT: lui a1, 61681
103 ; RV32I-NEXT: addi s6, a1, -241
104 ; RV32I-NEXT: and a0, a0, s6
105 ; RV32I-NEXT: lui a1, 4112
106 ; RV32I-NEXT: addi s3, a1, 257
107 ; RV32I-NEXT: mv a1, s3
108 ; RV32I-NEXT: call __mulsi3
109 ; RV32I-NEXT: mv s1, a0
110 ; RV32I-NEXT: srli a0, s2, 1
111 ; RV32I-NEXT: or a0, s2, a0
112 ; RV32I-NEXT: srli a1, a0, 2
113 ; RV32I-NEXT: or a0, a0, a1
114 ; RV32I-NEXT: srli a1, a0, 4
115 ; RV32I-NEXT: or a0, a0, a1
116 ; RV32I-NEXT: srli a1, a0, 8
117 ; RV32I-NEXT: or a0, a0, a1
118 ; RV32I-NEXT: srli a1, a0, 16
119 ; RV32I-NEXT: or a0, a0, a1
120 ; RV32I-NEXT: not a0, a0
121 ; RV32I-NEXT: srli a1, a0, 1
122 ; RV32I-NEXT: and a1, a1, s4
123 ; RV32I-NEXT: sub a0, a0, a1
124 ; RV32I-NEXT: and a1, a0, s5
125 ; RV32I-NEXT: srli a0, a0, 2
126 ; RV32I-NEXT: and a0, a0, s5
127 ; RV32I-NEXT: add a0, a1, a0
128 ; RV32I-NEXT: srli a1, a0, 4
129 ; RV32I-NEXT: add a0, a0, a1
130 ; RV32I-NEXT: and a0, a0, s6
131 ; RV32I-NEXT: mv a1, s3
132 ; RV32I-NEXT: call __mulsi3
133 ; RV32I-NEXT: bnez s0, .LBB1_2
134 ; RV32I-NEXT: # %bb.1:
135 ; RV32I-NEXT: srli a0, a0, 24
136 ; RV32I-NEXT: addi a0, a0, 32
137 ; RV32I-NEXT: j .LBB1_3
138 ; RV32I-NEXT: .LBB1_2:
139 ; RV32I-NEXT: srli a0, s1, 24
140 ; RV32I-NEXT: .LBB1_3:
141 ; RV32I-NEXT: li a1, 0
142 ; RV32I-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
143 ; RV32I-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
144 ; RV32I-NEXT: lw s1, 20(sp) # 4-byte Folded Reload
145 ; RV32I-NEXT: lw s2, 16(sp) # 4-byte Folded Reload
146 ; RV32I-NEXT: lw s3, 12(sp) # 4-byte Folded Reload
147 ; RV32I-NEXT: lw s4, 8(sp) # 4-byte Folded Reload
148 ; RV32I-NEXT: lw s5, 4(sp) # 4-byte Folded Reload
149 ; RV32I-NEXT: lw s6, 0(sp) # 4-byte Folded Reload
150 ; RV32I-NEXT: addi sp, sp, 32
153 ; RV32XTHEADBB-LABEL: ctlz_i64:
154 ; RV32XTHEADBB: # %bb.0:
155 ; RV32XTHEADBB-NEXT: bnez a1, .LBB1_2
156 ; RV32XTHEADBB-NEXT: # %bb.1:
157 ; RV32XTHEADBB-NEXT: th.ff1 a0, a0
158 ; RV32XTHEADBB-NEXT: addi a0, a0, 32
159 ; RV32XTHEADBB-NEXT: li a1, 0
160 ; RV32XTHEADBB-NEXT: ret
161 ; RV32XTHEADBB-NEXT: .LBB1_2:
162 ; RV32XTHEADBB-NEXT: th.ff1 a0, a1
163 ; RV32XTHEADBB-NEXT: li a1, 0
164 ; RV32XTHEADBB-NEXT: ret
165 %1 = call i64 @llvm.ctlz.i64(i64 %a, i1 false)
169 declare i32 @llvm.cttz.i32(i32, i1)
171 define i32 @cttz_i32(i32 %a) nounwind {
172 ; RV32I-LABEL: cttz_i32:
174 ; RV32I-NEXT: beqz a0, .LBB2_2
175 ; RV32I-NEXT: # %bb.1: # %cond.false
176 ; RV32I-NEXT: addi sp, sp, -16
177 ; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
178 ; RV32I-NEXT: neg a1, a0
179 ; RV32I-NEXT: and a0, a0, a1
180 ; RV32I-NEXT: lui a1, 30667
181 ; RV32I-NEXT: addi a1, a1, 1329
182 ; RV32I-NEXT: call __mulsi3
183 ; RV32I-NEXT: srli a0, a0, 27
184 ; RV32I-NEXT: lui a1, %hi(.LCPI2_0)
185 ; RV32I-NEXT: addi a1, a1, %lo(.LCPI2_0)
186 ; RV32I-NEXT: add a0, a1, a0
187 ; RV32I-NEXT: lbu a0, 0(a0)
188 ; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
189 ; RV32I-NEXT: addi sp, sp, 16
191 ; RV32I-NEXT: .LBB2_2:
192 ; RV32I-NEXT: li a0, 32
195 ; RV32XTHEADBB-LABEL: cttz_i32:
196 ; RV32XTHEADBB: # %bb.0:
197 ; RV32XTHEADBB-NEXT: beqz a0, .LBB2_2
198 ; RV32XTHEADBB-NEXT: # %bb.1: # %cond.false
199 ; RV32XTHEADBB-NEXT: addi a1, a0, -1
200 ; RV32XTHEADBB-NEXT: not a0, a0
201 ; RV32XTHEADBB-NEXT: and a0, a0, a1
202 ; RV32XTHEADBB-NEXT: th.ff1 a0, a0
203 ; RV32XTHEADBB-NEXT: li a1, 32
204 ; RV32XTHEADBB-NEXT: sub a0, a1, a0
205 ; RV32XTHEADBB-NEXT: ret
206 ; RV32XTHEADBB-NEXT: .LBB2_2:
207 ; RV32XTHEADBB-NEXT: li a0, 32
208 ; RV32XTHEADBB-NEXT: ret
209 %1 = call i32 @llvm.cttz.i32(i32 %a, i1 false)
213 declare i64 @llvm.cttz.i64(i64, i1)
215 define i64 @cttz_i64(i64 %a) nounwind {
216 ; RV32I-LABEL: cttz_i64:
218 ; RV32I-NEXT: addi sp, sp, -32
219 ; RV32I-NEXT: sw ra, 28(sp) # 4-byte Folded Spill
220 ; RV32I-NEXT: sw s0, 24(sp) # 4-byte Folded Spill
221 ; RV32I-NEXT: sw s1, 20(sp) # 4-byte Folded Spill
222 ; RV32I-NEXT: sw s2, 16(sp) # 4-byte Folded Spill
223 ; RV32I-NEXT: sw s3, 12(sp) # 4-byte Folded Spill
224 ; RV32I-NEXT: sw s4, 8(sp) # 4-byte Folded Spill
225 ; RV32I-NEXT: mv s2, a1
226 ; RV32I-NEXT: mv s0, a0
227 ; RV32I-NEXT: neg a0, a0
228 ; RV32I-NEXT: and a0, s0, a0
229 ; RV32I-NEXT: lui a1, 30667
230 ; RV32I-NEXT: addi s3, a1, 1329
231 ; RV32I-NEXT: mv a1, s3
232 ; RV32I-NEXT: call __mulsi3
233 ; RV32I-NEXT: mv s1, a0
234 ; RV32I-NEXT: lui a0, %hi(.LCPI3_0)
235 ; RV32I-NEXT: addi s4, a0, %lo(.LCPI3_0)
236 ; RV32I-NEXT: neg a0, s2
237 ; RV32I-NEXT: and a0, s2, a0
238 ; RV32I-NEXT: mv a1, s3
239 ; RV32I-NEXT: call __mulsi3
240 ; RV32I-NEXT: bnez s2, .LBB3_3
241 ; RV32I-NEXT: # %bb.1:
242 ; RV32I-NEXT: li a0, 32
243 ; RV32I-NEXT: beqz s0, .LBB3_4
244 ; RV32I-NEXT: .LBB3_2:
245 ; RV32I-NEXT: srli s1, s1, 27
246 ; RV32I-NEXT: add s1, s4, s1
247 ; RV32I-NEXT: lbu a0, 0(s1)
248 ; RV32I-NEXT: j .LBB3_5
249 ; RV32I-NEXT: .LBB3_3:
250 ; RV32I-NEXT: srli a0, a0, 27
251 ; RV32I-NEXT: add a0, s4, a0
252 ; RV32I-NEXT: lbu a0, 0(a0)
253 ; RV32I-NEXT: bnez s0, .LBB3_2
254 ; RV32I-NEXT: .LBB3_4:
255 ; RV32I-NEXT: addi a0, a0, 32
256 ; RV32I-NEXT: .LBB3_5:
257 ; RV32I-NEXT: li a1, 0
258 ; RV32I-NEXT: lw ra, 28(sp) # 4-byte Folded Reload
259 ; RV32I-NEXT: lw s0, 24(sp) # 4-byte Folded Reload
260 ; RV32I-NEXT: lw s1, 20(sp) # 4-byte Folded Reload
261 ; RV32I-NEXT: lw s2, 16(sp) # 4-byte Folded Reload
262 ; RV32I-NEXT: lw s3, 12(sp) # 4-byte Folded Reload
263 ; RV32I-NEXT: lw s4, 8(sp) # 4-byte Folded Reload
264 ; RV32I-NEXT: addi sp, sp, 32
267 ; RV32XTHEADBB-LABEL: cttz_i64:
268 ; RV32XTHEADBB: # %bb.0:
269 ; RV32XTHEADBB-NEXT: bnez a0, .LBB3_2
270 ; RV32XTHEADBB-NEXT: # %bb.1:
271 ; RV32XTHEADBB-NEXT: addi a0, a1, -1
272 ; RV32XTHEADBB-NEXT: not a1, a1
273 ; RV32XTHEADBB-NEXT: and a0, a1, a0
274 ; RV32XTHEADBB-NEXT: th.ff1 a0, a0
275 ; RV32XTHEADBB-NEXT: li a1, 64
276 ; RV32XTHEADBB-NEXT: j .LBB3_3
277 ; RV32XTHEADBB-NEXT: .LBB3_2:
278 ; RV32XTHEADBB-NEXT: addi a1, a0, -1
279 ; RV32XTHEADBB-NEXT: not a0, a0
280 ; RV32XTHEADBB-NEXT: and a0, a0, a1
281 ; RV32XTHEADBB-NEXT: th.ff1 a0, a0
282 ; RV32XTHEADBB-NEXT: li a1, 32
283 ; RV32XTHEADBB-NEXT: .LBB3_3:
284 ; RV32XTHEADBB-NEXT: sub a0, a1, a0
285 ; RV32XTHEADBB-NEXT: li a1, 0
286 ; RV32XTHEADBB-NEXT: ret
287 %1 = call i64 @llvm.cttz.i64(i64 %a, i1 false)
291 define i32 @sextb_i32(i32 %a) nounwind {
292 ; RV32I-LABEL: sextb_i32:
294 ; RV32I-NEXT: slli a0, a0, 24
295 ; RV32I-NEXT: srai a0, a0, 24
298 ; RV32XTHEADBB-LABEL: sextb_i32:
299 ; RV32XTHEADBB: # %bb.0:
300 ; RV32XTHEADBB-NEXT: th.ext a0, a0, 7, 0
301 ; RV32XTHEADBB-NEXT: ret
302 %shl = shl i32 %a, 24
303 %shr = ashr exact i32 %shl, 24
307 define i64 @sextb_i64(i64 %a) nounwind {
308 ; RV32I-LABEL: sextb_i64:
310 ; RV32I-NEXT: slli a1, a0, 24
311 ; RV32I-NEXT: srai a0, a1, 24
312 ; RV32I-NEXT: srai a1, a1, 31
315 ; RV32XTHEADBB-LABEL: sextb_i64:
316 ; RV32XTHEADBB: # %bb.0:
317 ; RV32XTHEADBB-NEXT: th.ext a0, a0, 7, 0
318 ; RV32XTHEADBB-NEXT: srai a1, a0, 31
319 ; RV32XTHEADBB-NEXT: ret
320 %shl = shl i64 %a, 56
321 %shr = ashr exact i64 %shl, 56
325 define i32 @sexth_i32(i32 %a) nounwind {
326 ; RV32I-LABEL: sexth_i32:
328 ; RV32I-NEXT: slli a0, a0, 16
329 ; RV32I-NEXT: srai a0, a0, 16
332 ; RV32XTHEADBB-LABEL: sexth_i32:
333 ; RV32XTHEADBB: # %bb.0:
334 ; RV32XTHEADBB-NEXT: th.ext a0, a0, 15, 0
335 ; RV32XTHEADBB-NEXT: ret
336 %shl = shl i32 %a, 16
337 %shr = ashr exact i32 %shl, 16
341 define i32 @no_sexth_i32(i32 %a) nounwind {
342 ; RV32I-LABEL: no_sexth_i32:
344 ; RV32I-NEXT: slli a0, a0, 17
345 ; RV32I-NEXT: srai a0, a0, 16
348 ; RV32XTHEADBB-LABEL: no_sexth_i32:
349 ; RV32XTHEADBB: # %bb.0:
350 ; RV32XTHEADBB-NEXT: slli a0, a0, 17
351 ; RV32XTHEADBB-NEXT: srai a0, a0, 16
352 ; RV32XTHEADBB-NEXT: ret
353 %shl = shl i32 %a, 17
354 %shr = ashr exact i32 %shl, 16
358 define i64 @sexth_i64(i64 %a) nounwind {
359 ; RV32I-LABEL: sexth_i64:
361 ; RV32I-NEXT: slli a1, a0, 16
362 ; RV32I-NEXT: srai a0, a1, 16
363 ; RV32I-NEXT: srai a1, a1, 31
366 ; RV32XTHEADBB-LABEL: sexth_i64:
367 ; RV32XTHEADBB: # %bb.0:
368 ; RV32XTHEADBB-NEXT: th.ext a0, a0, 15, 0
369 ; RV32XTHEADBB-NEXT: srai a1, a0, 31
370 ; RV32XTHEADBB-NEXT: ret
371 %shl = shl i64 %a, 48
372 %shr = ashr exact i64 %shl, 48
376 define i64 @no_sexth_i64(i64 %a) nounwind {
377 ; RV32I-LABEL: no_sexth_i64:
379 ; RV32I-NEXT: slli a1, a0, 17
380 ; RV32I-NEXT: srai a0, a1, 16
381 ; RV32I-NEXT: srai a1, a1, 31
384 ; RV32XTHEADBB-LABEL: no_sexth_i64:
385 ; RV32XTHEADBB: # %bb.0:
386 ; RV32XTHEADBB-NEXT: slli a1, a0, 17
387 ; RV32XTHEADBB-NEXT: srai a0, a1, 16
388 ; RV32XTHEADBB-NEXT: srai a1, a1, 31
389 ; RV32XTHEADBB-NEXT: ret
390 %shl = shl i64 %a, 49
391 %shr = ashr exact i64 %shl, 48
395 define i32 @zexth_i32(i32 %a) nounwind {
396 ; RV32I-LABEL: zexth_i32:
398 ; RV32I-NEXT: slli a0, a0, 16
399 ; RV32I-NEXT: srli a0, a0, 16
402 ; RV32XTHEADBB-LABEL: zexth_i32:
403 ; RV32XTHEADBB: # %bb.0:
404 ; RV32XTHEADBB-NEXT: th.extu a0, a0, 15, 0
405 ; RV32XTHEADBB-NEXT: ret
406 %and = and i32 %a, 65535
410 define i64 @zexth_i64(i64 %a) nounwind {
411 ; RV32I-LABEL: zexth_i64:
413 ; RV32I-NEXT: slli a0, a0, 16
414 ; RV32I-NEXT: srli a0, a0, 16
415 ; RV32I-NEXT: li a1, 0
418 ; RV32XTHEADBB-LABEL: zexth_i64:
419 ; RV32XTHEADBB: # %bb.0:
420 ; RV32XTHEADBB-NEXT: th.extu a0, a0, 15, 0
421 ; RV32XTHEADBB-NEXT: li a1, 0
422 ; RV32XTHEADBB-NEXT: ret
423 %and = and i64 %a, 65535
427 declare i32 @llvm.bswap.i32(i32)
429 define i32 @bswap_i32(i32 %a) nounwind {
430 ; RV32I-LABEL: bswap_i32:
432 ; RV32I-NEXT: srli a1, a0, 8
433 ; RV32I-NEXT: lui a2, 16
434 ; RV32I-NEXT: addi a2, a2, -256
435 ; RV32I-NEXT: and a1, a1, a2
436 ; RV32I-NEXT: srli a3, a0, 24
437 ; RV32I-NEXT: or a1, a1, a3
438 ; RV32I-NEXT: and a2, a0, a2
439 ; RV32I-NEXT: slli a2, a2, 8
440 ; RV32I-NEXT: slli a0, a0, 24
441 ; RV32I-NEXT: or a0, a0, a2
442 ; RV32I-NEXT: or a0, a0, a1
445 ; RV32XTHEADBB-LABEL: bswap_i32:
446 ; RV32XTHEADBB: # %bb.0:
447 ; RV32XTHEADBB-NEXT: th.rev a0, a0
448 ; RV32XTHEADBB-NEXT: ret
449 %1 = tail call i32 @llvm.bswap.i32(i32 %a)
453 declare i64 @llvm.bswap.i64(i64)
455 define i64 @bswap_i64(i64 %a) {
456 ; RV32I-LABEL: bswap_i64:
458 ; RV32I-NEXT: srli a2, a1, 8
459 ; RV32I-NEXT: lui a3, 16
460 ; RV32I-NEXT: addi a3, a3, -256
461 ; RV32I-NEXT: and a2, a2, a3
462 ; RV32I-NEXT: srli a4, a1, 24
463 ; RV32I-NEXT: or a2, a2, a4
464 ; RV32I-NEXT: and a4, a1, a3
465 ; RV32I-NEXT: slli a4, a4, 8
466 ; RV32I-NEXT: slli a1, a1, 24
467 ; RV32I-NEXT: or a1, a1, a4
468 ; RV32I-NEXT: or a2, a1, a2
469 ; RV32I-NEXT: srli a1, a0, 8
470 ; RV32I-NEXT: and a1, a1, a3
471 ; RV32I-NEXT: srli a4, a0, 24
472 ; RV32I-NEXT: or a1, a1, a4
473 ; RV32I-NEXT: and a3, a0, a3
474 ; RV32I-NEXT: slli a3, a3, 8
475 ; RV32I-NEXT: slli a0, a0, 24
476 ; RV32I-NEXT: or a0, a0, a3
477 ; RV32I-NEXT: or a1, a0, a1
478 ; RV32I-NEXT: mv a0, a2
481 ; RV32XTHEADBB-LABEL: bswap_i64:
482 ; RV32XTHEADBB: # %bb.0:
483 ; RV32XTHEADBB-NEXT: th.rev a2, a1
484 ; RV32XTHEADBB-NEXT: th.rev a1, a0
485 ; RV32XTHEADBB-NEXT: mv a0, a2
486 ; RV32XTHEADBB-NEXT: ret
487 %1 = call i64 @llvm.bswap.i64(i64 %a)