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=CHECK,RV32,RV32I
4 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
5 ; RUN: | FileCheck %s -check-prefixes=CHECK,RV64,RV64I
6 ; RUN: llc -mtriple=riscv32 -mattr=+zbs -verify-machineinstrs < %s \
7 ; RUN: | FileCheck %s -check-prefixes=CHECK,ZBS,RV32,RV32ZBS
8 ; RUN: llc -mtriple=riscv64 -mattr=+zbs -verify-machineinstrs < %s \
9 ; RUN: | FileCheck %s -check-prefixes=CHECK,ZBS,RV64,RV64ZBS
10 ; RUN: llc -mtriple=riscv32 -mattr=+xtheadbs -verify-machineinstrs < %s \
11 ; RUN: | FileCheck %s -check-prefixes=CHECK,XTHEADBS,RV32,RV32XTHEADBS
12 ; RUN: llc -mtriple=riscv64 -mattr=+xtheadbs -verify-machineinstrs < %s \
13 ; RUN: | FileCheck %s -check-prefixes=CHECK,XTHEADBS,RV64,RV64XTHEADBS
15 define signext i32 @bittest_7_i32(i32 signext %a) nounwind {
16 ; CHECK-LABEL: bittest_7_i32:
18 ; CHECK-NEXT: andi a0, a0, 128
19 ; CHECK-NEXT: seqz a0, a0
22 %not = xor i32 %shr, -1
23 %and = and i32 %not, 1
27 define signext i32 @bittest_10_i32(i32 signext %a) nounwind {
28 ; CHECK-LABEL: bittest_10_i32:
30 ; CHECK-NEXT: andi a0, a0, 1024
31 ; CHECK-NEXT: seqz a0, a0
33 %shr = lshr i32 %a, 10
34 %not = xor i32 %shr, -1
35 %and = and i32 %not, 1
39 define signext i32 @bittest_11_i32(i32 signext %a) nounwind {
40 ; RV32I-LABEL: bittest_11_i32:
42 ; RV32I-NEXT: not a0, a0
43 ; RV32I-NEXT: slli a0, a0, 20
44 ; RV32I-NEXT: srli a0, a0, 31
47 ; RV64I-LABEL: bittest_11_i32:
49 ; RV64I-NEXT: not a0, a0
50 ; RV64I-NEXT: slli a0, a0, 52
51 ; RV64I-NEXT: srli a0, a0, 63
54 ; ZBS-LABEL: bittest_11_i32:
56 ; ZBS-NEXT: not a0, a0
57 ; ZBS-NEXT: bexti a0, a0, 11
60 ; XTHEADBS-LABEL: bittest_11_i32:
62 ; XTHEADBS-NEXT: not a0, a0
63 ; XTHEADBS-NEXT: th.tst a0, a0, 11
65 %shr = lshr i32 %a, 11
66 %not = xor i32 %shr, -1
67 %and = and i32 %not, 1
71 define signext i32 @bittest_31_i32(i32 signext %a) nounwind {
72 ; RV32-LABEL: bittest_31_i32:
74 ; RV32-NEXT: not a0, a0
75 ; RV32-NEXT: srli a0, a0, 31
78 ; RV64-LABEL: bittest_31_i32:
80 ; RV64-NEXT: not a0, a0
81 ; RV64-NEXT: srliw a0, a0, 31
83 %shr = lshr i32 %a, 31
84 %not = xor i32 %shr, -1
85 %and = and i32 %not, 1
89 define i64 @bittest_7_i64(i64 %a) nounwind {
90 ; RV32-LABEL: bittest_7_i64:
92 ; RV32-NEXT: andi a0, a0, 128
93 ; RV32-NEXT: seqz a0, a0
97 ; RV64-LABEL: bittest_7_i64:
99 ; RV64-NEXT: andi a0, a0, 128
100 ; RV64-NEXT: seqz a0, a0
102 %shr = lshr i64 %a, 7
103 %not = xor i64 %shr, -1
104 %and = and i64 %not, 1
108 define i64 @bittest_10_i64(i64 %a) nounwind {
109 ; RV32-LABEL: bittest_10_i64:
111 ; RV32-NEXT: andi a0, a0, 1024
112 ; RV32-NEXT: seqz a0, a0
113 ; RV32-NEXT: li a1, 0
116 ; RV64-LABEL: bittest_10_i64:
118 ; RV64-NEXT: andi a0, a0, 1024
119 ; RV64-NEXT: seqz a0, a0
121 %shr = lshr i64 %a, 10
122 %not = xor i64 %shr, -1
123 %and = and i64 %not, 1
127 define i64 @bittest_11_i64(i64 %a) nounwind {
128 ; RV32I-LABEL: bittest_11_i64:
130 ; RV32I-NEXT: not a0, a0
131 ; RV32I-NEXT: slli a0, a0, 20
132 ; RV32I-NEXT: srli a0, a0, 31
133 ; RV32I-NEXT: li a1, 0
136 ; RV64I-LABEL: bittest_11_i64:
138 ; RV64I-NEXT: not a0, a0
139 ; RV64I-NEXT: slli a0, a0, 52
140 ; RV64I-NEXT: srli a0, a0, 63
143 ; RV32ZBS-LABEL: bittest_11_i64:
145 ; RV32ZBS-NEXT: not a0, a0
146 ; RV32ZBS-NEXT: bexti a0, a0, 11
147 ; RV32ZBS-NEXT: li a1, 0
150 ; RV64ZBS-LABEL: bittest_11_i64:
152 ; RV64ZBS-NEXT: not a0, a0
153 ; RV64ZBS-NEXT: bexti a0, a0, 11
156 ; RV32XTHEADBS-LABEL: bittest_11_i64:
157 ; RV32XTHEADBS: # %bb.0:
158 ; RV32XTHEADBS-NEXT: not a0, a0
159 ; RV32XTHEADBS-NEXT: th.tst a0, a0, 11
160 ; RV32XTHEADBS-NEXT: li a1, 0
161 ; RV32XTHEADBS-NEXT: ret
163 ; RV64XTHEADBS-LABEL: bittest_11_i64:
164 ; RV64XTHEADBS: # %bb.0:
165 ; RV64XTHEADBS-NEXT: not a0, a0
166 ; RV64XTHEADBS-NEXT: th.tst a0, a0, 11
167 ; RV64XTHEADBS-NEXT: ret
168 %shr = lshr i64 %a, 11
169 %not = xor i64 %shr, -1
170 %and = and i64 %not, 1
174 define i64 @bittest_31_i64(i64 %a) nounwind {
175 ; RV32-LABEL: bittest_31_i64:
177 ; RV32-NEXT: not a0, a0
178 ; RV32-NEXT: srli a0, a0, 31
179 ; RV32-NEXT: li a1, 0
182 ; RV64I-LABEL: bittest_31_i64:
184 ; RV64I-NEXT: not a0, a0
185 ; RV64I-NEXT: srliw a0, a0, 31
188 ; RV64ZBS-LABEL: bittest_31_i64:
190 ; RV64ZBS-NEXT: not a0, a0
191 ; RV64ZBS-NEXT: bexti a0, a0, 31
194 ; RV64XTHEADBS-LABEL: bittest_31_i64:
195 ; RV64XTHEADBS: # %bb.0:
196 ; RV64XTHEADBS-NEXT: not a0, a0
197 ; RV64XTHEADBS-NEXT: th.tst a0, a0, 31
198 ; RV64XTHEADBS-NEXT: ret
199 %shr = lshr i64 %a, 31
200 %not = xor i64 %shr, -1
201 %and = and i64 %not, 1
205 define i64 @bittest_32_i64(i64 %a) nounwind {
206 ; RV32-LABEL: bittest_32_i64:
208 ; RV32-NEXT: not a0, a1
209 ; RV32-NEXT: andi a0, a0, 1
210 ; RV32-NEXT: li a1, 0
213 ; RV64I-LABEL: bittest_32_i64:
215 ; RV64I-NEXT: not a0, a0
216 ; RV64I-NEXT: slli a0, a0, 31
217 ; RV64I-NEXT: srli a0, a0, 63
220 ; RV64ZBS-LABEL: bittest_32_i64:
222 ; RV64ZBS-NEXT: not a0, a0
223 ; RV64ZBS-NEXT: bexti a0, a0, 32
226 ; RV64XTHEADBS-LABEL: bittest_32_i64:
227 ; RV64XTHEADBS: # %bb.0:
228 ; RV64XTHEADBS-NEXT: not a0, a0
229 ; RV64XTHEADBS-NEXT: th.tst a0, a0, 32
230 ; RV64XTHEADBS-NEXT: ret
231 %shr = lshr i64 %a, 32
232 %not = xor i64 %shr, -1
233 %and = and i64 %not, 1
237 define i64 @bittest_63_i64(i64 %a) nounwind {
238 ; RV32-LABEL: bittest_63_i64:
240 ; RV32-NEXT: not a0, a1
241 ; RV32-NEXT: srli a0, a0, 31
242 ; RV32-NEXT: li a1, 0
245 ; RV64-LABEL: bittest_63_i64:
247 ; RV64-NEXT: not a0, a0
248 ; RV64-NEXT: srli a0, a0, 63
250 %shr = lshr i64 %a, 63
251 %not = xor i64 %shr, -1
252 %and = and i64 %not, 1
256 ; Make sure we use (andi (srl X, Y), 1) or bext.
257 define i1 @bittest_constant_by_var_shr_i32(i32 signext %b) nounwind {
258 ; RV32I-LABEL: bittest_constant_by_var_shr_i32:
260 ; RV32I-NEXT: lui a1, 301408
261 ; RV32I-NEXT: addi a1, a1, 722
262 ; RV32I-NEXT: srl a0, a1, a0
263 ; RV32I-NEXT: andi a0, a0, 1
266 ; RV64I-LABEL: bittest_constant_by_var_shr_i32:
268 ; RV64I-NEXT: lui a1, 301408
269 ; RV64I-NEXT: addi a1, a1, 722
270 ; RV64I-NEXT: srlw a0, a1, a0
271 ; RV64I-NEXT: andi a0, a0, 1
274 ; RV32ZBS-LABEL: bittest_constant_by_var_shr_i32:
276 ; RV32ZBS-NEXT: lui a1, 301408
277 ; RV32ZBS-NEXT: addi a1, a1, 722
278 ; RV32ZBS-NEXT: bext a0, a1, a0
281 ; RV64ZBS-LABEL: bittest_constant_by_var_shr_i32:
283 ; RV64ZBS-NEXT: lui a1, 301408
284 ; RV64ZBS-NEXT: addiw a1, a1, 722
285 ; RV64ZBS-NEXT: bext a0, a1, a0
288 ; RV32XTHEADBS-LABEL: bittest_constant_by_var_shr_i32:
289 ; RV32XTHEADBS: # %bb.0:
290 ; RV32XTHEADBS-NEXT: lui a1, 301408
291 ; RV32XTHEADBS-NEXT: addi a1, a1, 722
292 ; RV32XTHEADBS-NEXT: srl a0, a1, a0
293 ; RV32XTHEADBS-NEXT: andi a0, a0, 1
294 ; RV32XTHEADBS-NEXT: ret
296 ; RV64XTHEADBS-LABEL: bittest_constant_by_var_shr_i32:
297 ; RV64XTHEADBS: # %bb.0:
298 ; RV64XTHEADBS-NEXT: lui a1, 301408
299 ; RV64XTHEADBS-NEXT: addi a1, a1, 722
300 ; RV64XTHEADBS-NEXT: srlw a0, a1, a0
301 ; RV64XTHEADBS-NEXT: andi a0, a0, 1
302 ; RV64XTHEADBS-NEXT: ret
303 %shl = lshr i32 1234567890, %b
304 %and = and i32 %shl, 1
305 %cmp = icmp ne i32 %and, 0
309 ; Make sure we use (andi (srl X, Y), 1) or bext.
310 define i1 @bittest_constant_by_var_shl_i32(i32 signext %b) nounwind {
311 ; RV32I-LABEL: bittest_constant_by_var_shl_i32:
313 ; RV32I-NEXT: lui a1, 301408
314 ; RV32I-NEXT: addi a1, a1, 722
315 ; RV32I-NEXT: srl a0, a1, a0
316 ; RV32I-NEXT: andi a0, a0, 1
319 ; RV64I-LABEL: bittest_constant_by_var_shl_i32:
321 ; RV64I-NEXT: lui a1, 301408
322 ; RV64I-NEXT: addi a1, a1, 722
323 ; RV64I-NEXT: srlw a0, a1, a0
324 ; RV64I-NEXT: andi a0, a0, 1
327 ; RV32ZBS-LABEL: bittest_constant_by_var_shl_i32:
329 ; RV32ZBS-NEXT: lui a1, 301408
330 ; RV32ZBS-NEXT: addi a1, a1, 722
331 ; RV32ZBS-NEXT: bext a0, a1, a0
334 ; RV64ZBS-LABEL: bittest_constant_by_var_shl_i32:
336 ; RV64ZBS-NEXT: lui a1, 301408
337 ; RV64ZBS-NEXT: addiw a1, a1, 722
338 ; RV64ZBS-NEXT: bext a0, a1, a0
341 ; RV32XTHEADBS-LABEL: bittest_constant_by_var_shl_i32:
342 ; RV32XTHEADBS: # %bb.0:
343 ; RV32XTHEADBS-NEXT: lui a1, 301408
344 ; RV32XTHEADBS-NEXT: addi a1, a1, 722
345 ; RV32XTHEADBS-NEXT: srl a0, a1, a0
346 ; RV32XTHEADBS-NEXT: andi a0, a0, 1
347 ; RV32XTHEADBS-NEXT: ret
349 ; RV64XTHEADBS-LABEL: bittest_constant_by_var_shl_i32:
350 ; RV64XTHEADBS: # %bb.0:
351 ; RV64XTHEADBS-NEXT: lui a1, 301408
352 ; RV64XTHEADBS-NEXT: addi a1, a1, 722
353 ; RV64XTHEADBS-NEXT: srlw a0, a1, a0
354 ; RV64XTHEADBS-NEXT: andi a0, a0, 1
355 ; RV64XTHEADBS-NEXT: ret
357 %and = and i32 %shl, 1234567890
358 %cmp = icmp ne i32 %and, 0
362 ; Make sure we use (andi (srl X, Y), 1) or bext.
363 define i1 @bittest_constant_by_var_shr_i64(i64 %b) nounwind {
364 ; RV32-LABEL: bittest_constant_by_var_shr_i64:
366 ; RV32-NEXT: lui a1, 301408
367 ; RV32-NEXT: addi a1, a1, 722
368 ; RV32-NEXT: srl a1, a1, a0
369 ; RV32-NEXT: addi a0, a0, -32
370 ; RV32-NEXT: srli a0, a0, 31
371 ; RV32-NEXT: and a0, a0, a1
374 ; RV64I-LABEL: bittest_constant_by_var_shr_i64:
376 ; RV64I-NEXT: lui a1, 301408
377 ; RV64I-NEXT: addiw a1, a1, 722
378 ; RV64I-NEXT: srl a0, a1, a0
379 ; RV64I-NEXT: andi a0, a0, 1
382 ; RV64ZBS-LABEL: bittest_constant_by_var_shr_i64:
384 ; RV64ZBS-NEXT: lui a1, 301408
385 ; RV64ZBS-NEXT: addiw a1, a1, 722
386 ; RV64ZBS-NEXT: bext a0, a1, a0
389 ; RV64XTHEADBS-LABEL: bittest_constant_by_var_shr_i64:
390 ; RV64XTHEADBS: # %bb.0:
391 ; RV64XTHEADBS-NEXT: lui a1, 301408
392 ; RV64XTHEADBS-NEXT: addiw a1, a1, 722
393 ; RV64XTHEADBS-NEXT: srl a0, a1, a0
394 ; RV64XTHEADBS-NEXT: andi a0, a0, 1
395 ; RV64XTHEADBS-NEXT: ret
396 %shl = lshr i64 1234567890, %b
397 %and = and i64 %shl, 1
398 %cmp = icmp ne i64 %and, 0
402 ; Make sure we use (andi (srl X, Y), 1) or bext.
403 define i1 @bittest_constant_by_var_shl_i64(i64 %b) nounwind {
404 ; RV32-LABEL: bittest_constant_by_var_shl_i64:
406 ; RV32-NEXT: lui a1, 301408
407 ; RV32-NEXT: addi a1, a1, 722
408 ; RV32-NEXT: srl a1, a1, a0
409 ; RV32-NEXT: addi a0, a0, -32
410 ; RV32-NEXT: srli a0, a0, 31
411 ; RV32-NEXT: and a0, a0, a1
414 ; RV64I-LABEL: bittest_constant_by_var_shl_i64:
416 ; RV64I-NEXT: lui a1, 301408
417 ; RV64I-NEXT: addiw a1, a1, 722
418 ; RV64I-NEXT: srl a0, a1, a0
419 ; RV64I-NEXT: andi a0, a0, 1
422 ; RV64ZBS-LABEL: bittest_constant_by_var_shl_i64:
424 ; RV64ZBS-NEXT: lui a1, 301408
425 ; RV64ZBS-NEXT: addiw a1, a1, 722
426 ; RV64ZBS-NEXT: bext a0, a1, a0
429 ; RV64XTHEADBS-LABEL: bittest_constant_by_var_shl_i64:
430 ; RV64XTHEADBS: # %bb.0:
431 ; RV64XTHEADBS-NEXT: lui a1, 301408
432 ; RV64XTHEADBS-NEXT: addiw a1, a1, 722
433 ; RV64XTHEADBS-NEXT: srl a0, a1, a0
434 ; RV64XTHEADBS-NEXT: andi a0, a0, 1
435 ; RV64XTHEADBS-NEXT: ret
437 %and = and i64 %shl, 1234567890
438 %cmp = icmp ne i64 %and, 0
442 ; We want to use (andi (srl X, Y), 1) or bext before the beqz.
443 define void @bittest_switch(i32 signext %0) {
444 ; RV32I-LABEL: bittest_switch:
446 ; RV32I-NEXT: li a1, 31
447 ; RV32I-NEXT: bltu a1, a0, .LBB14_3
448 ; RV32I-NEXT: # %bb.1:
449 ; RV32I-NEXT: lui a1, 524291
450 ; RV32I-NEXT: addi a1, a1, 768
451 ; RV32I-NEXT: srl a0, a1, a0
452 ; RV32I-NEXT: andi a0, a0, 1
453 ; RV32I-NEXT: beqz a0, .LBB14_3
454 ; RV32I-NEXT: # %bb.2:
455 ; RV32I-NEXT: tail bar
456 ; RV32I-NEXT: .LBB14_3:
459 ; RV64I-LABEL: bittest_switch:
461 ; RV64I-NEXT: li a1, 31
462 ; RV64I-NEXT: bltu a1, a0, .LBB14_3
463 ; RV64I-NEXT: # %bb.1:
464 ; RV64I-NEXT: lui a1, 2048
465 ; RV64I-NEXT: addiw a1, a1, 51
466 ; RV64I-NEXT: slli a1, a1, 8
467 ; RV64I-NEXT: srl a0, a1, a0
468 ; RV64I-NEXT: andi a0, a0, 1
469 ; RV64I-NEXT: beqz a0, .LBB14_3
470 ; RV64I-NEXT: # %bb.2:
471 ; RV64I-NEXT: tail bar
472 ; RV64I-NEXT: .LBB14_3:
475 ; RV32ZBS-LABEL: bittest_switch:
477 ; RV32ZBS-NEXT: li a1, 31
478 ; RV32ZBS-NEXT: bltu a1, a0, .LBB14_3
479 ; RV32ZBS-NEXT: # %bb.1:
480 ; RV32ZBS-NEXT: lui a1, 524291
481 ; RV32ZBS-NEXT: addi a1, a1, 768
482 ; RV32ZBS-NEXT: bext a0, a1, a0
483 ; RV32ZBS-NEXT: beqz a0, .LBB14_3
484 ; RV32ZBS-NEXT: # %bb.2:
485 ; RV32ZBS-NEXT: tail bar
486 ; RV32ZBS-NEXT: .LBB14_3:
489 ; RV64ZBS-LABEL: bittest_switch:
491 ; RV64ZBS-NEXT: li a1, 31
492 ; RV64ZBS-NEXT: bltu a1, a0, .LBB14_3
493 ; RV64ZBS-NEXT: # %bb.1:
494 ; RV64ZBS-NEXT: lui a1, 2048
495 ; RV64ZBS-NEXT: addiw a1, a1, 51
496 ; RV64ZBS-NEXT: slli a1, a1, 8
497 ; RV64ZBS-NEXT: bext a0, a1, a0
498 ; RV64ZBS-NEXT: beqz a0, .LBB14_3
499 ; RV64ZBS-NEXT: # %bb.2:
500 ; RV64ZBS-NEXT: tail bar
501 ; RV64ZBS-NEXT: .LBB14_3:
504 ; RV32XTHEADBS-LABEL: bittest_switch:
505 ; RV32XTHEADBS: # %bb.0:
506 ; RV32XTHEADBS-NEXT: li a1, 31
507 ; RV32XTHEADBS-NEXT: bltu a1, a0, .LBB14_3
508 ; RV32XTHEADBS-NEXT: # %bb.1:
509 ; RV32XTHEADBS-NEXT: lui a1, 524291
510 ; RV32XTHEADBS-NEXT: addi a1, a1, 768
511 ; RV32XTHEADBS-NEXT: srl a0, a1, a0
512 ; RV32XTHEADBS-NEXT: andi a0, a0, 1
513 ; RV32XTHEADBS-NEXT: beqz a0, .LBB14_3
514 ; RV32XTHEADBS-NEXT: # %bb.2:
515 ; RV32XTHEADBS-NEXT: tail bar
516 ; RV32XTHEADBS-NEXT: .LBB14_3:
517 ; RV32XTHEADBS-NEXT: ret
519 ; RV64XTHEADBS-LABEL: bittest_switch:
520 ; RV64XTHEADBS: # %bb.0:
521 ; RV64XTHEADBS-NEXT: li a1, 31
522 ; RV64XTHEADBS-NEXT: bltu a1, a0, .LBB14_3
523 ; RV64XTHEADBS-NEXT: # %bb.1:
524 ; RV64XTHEADBS-NEXT: lui a1, 2048
525 ; RV64XTHEADBS-NEXT: addiw a1, a1, 51
526 ; RV64XTHEADBS-NEXT: slli a1, a1, 8
527 ; RV64XTHEADBS-NEXT: srl a0, a1, a0
528 ; RV64XTHEADBS-NEXT: andi a0, a0, 1
529 ; RV64XTHEADBS-NEXT: beqz a0, .LBB14_3
530 ; RV64XTHEADBS-NEXT: # %bb.2:
531 ; RV64XTHEADBS-NEXT: tail bar
532 ; RV64XTHEADBS-NEXT: .LBB14_3:
533 ; RV64XTHEADBS-NEXT: ret
534 switch i32 %0, label %3 [
543 tail call void @bar()
552 define signext i32 @bit_10_z_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
553 ; CHECK-LABEL: bit_10_z_select_i32:
555 ; CHECK-NEXT: andi a3, a0, 1024
556 ; CHECK-NEXT: mv a0, a1
557 ; CHECK-NEXT: beqz a3, .LBB15_2
558 ; CHECK-NEXT: # %bb.1:
559 ; CHECK-NEXT: mv a0, a2
560 ; CHECK-NEXT: .LBB15_2:
562 %1 = and i32 %a, 1024
563 %2 = icmp eq i32 %1, 0
564 %3 = select i1 %2, i32 %b, i32 %c
568 define signext i32 @bit_10_nz_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
569 ; RV32-LABEL: bit_10_nz_select_i32:
571 ; RV32-NEXT: slli a3, a0, 21
572 ; RV32-NEXT: mv a0, a1
573 ; RV32-NEXT: bltz a3, .LBB16_2
574 ; RV32-NEXT: # %bb.1:
575 ; RV32-NEXT: mv a0, a2
576 ; RV32-NEXT: .LBB16_2:
579 ; RV64-LABEL: bit_10_nz_select_i32:
581 ; RV64-NEXT: slli a3, a0, 53
582 ; RV64-NEXT: mv a0, a1
583 ; RV64-NEXT: bltz a3, .LBB16_2
584 ; RV64-NEXT: # %bb.1:
585 ; RV64-NEXT: mv a0, a2
586 ; RV64-NEXT: .LBB16_2:
588 %1 = and i32 %a, 1024
589 %2 = icmp ne i32 %1, 0
590 %3 = select i1 %2, i32 %b, i32 %c
594 define signext i32 @bit_11_z_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
595 ; RV32-LABEL: bit_11_z_select_i32:
597 ; RV32-NEXT: slli a3, a0, 20
598 ; RV32-NEXT: mv a0, a1
599 ; RV32-NEXT: bgez a3, .LBB17_2
600 ; RV32-NEXT: # %bb.1:
601 ; RV32-NEXT: mv a0, a2
602 ; RV32-NEXT: .LBB17_2:
605 ; RV64-LABEL: bit_11_z_select_i32:
607 ; RV64-NEXT: slli a3, a0, 52
608 ; RV64-NEXT: mv a0, a1
609 ; RV64-NEXT: bgez a3, .LBB17_2
610 ; RV64-NEXT: # %bb.1:
611 ; RV64-NEXT: mv a0, a2
612 ; RV64-NEXT: .LBB17_2:
614 %1 = and i32 %a, 2048
615 %2 = icmp eq i32 %1, 0
616 %3 = select i1 %2, i32 %b, i32 %c
620 define signext i32 @bit_11_nz_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
621 ; RV32-LABEL: bit_11_nz_select_i32:
623 ; RV32-NEXT: slli a3, a0, 20
624 ; RV32-NEXT: mv a0, a1
625 ; RV32-NEXT: bltz a3, .LBB18_2
626 ; RV32-NEXT: # %bb.1:
627 ; RV32-NEXT: mv a0, a2
628 ; RV32-NEXT: .LBB18_2:
631 ; RV64-LABEL: bit_11_nz_select_i32:
633 ; RV64-NEXT: slli a3, a0, 52
634 ; RV64-NEXT: mv a0, a1
635 ; RV64-NEXT: bltz a3, .LBB18_2
636 ; RV64-NEXT: # %bb.1:
637 ; RV64-NEXT: mv a0, a2
638 ; RV64-NEXT: .LBB18_2:
640 %1 = and i32 %a, 2048
641 %2 = icmp ne i32 %1, 0
642 %3 = select i1 %2, i32 %b, i32 %c
646 define signext i32 @bit_20_z_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
647 ; RV32-LABEL: bit_20_z_select_i32:
649 ; RV32-NEXT: slli a3, a0, 11
650 ; RV32-NEXT: mv a0, a1
651 ; RV32-NEXT: bgez a3, .LBB19_2
652 ; RV32-NEXT: # %bb.1:
653 ; RV32-NEXT: mv a0, a2
654 ; RV32-NEXT: .LBB19_2:
657 ; RV64-LABEL: bit_20_z_select_i32:
659 ; RV64-NEXT: slli a3, a0, 43
660 ; RV64-NEXT: mv a0, a1
661 ; RV64-NEXT: bgez a3, .LBB19_2
662 ; RV64-NEXT: # %bb.1:
663 ; RV64-NEXT: mv a0, a2
664 ; RV64-NEXT: .LBB19_2:
666 %1 = and i32 %a, 1048576
667 %2 = icmp eq i32 %1, 0
668 %3 = select i1 %2, i32 %b, i32 %c
672 define signext i32 @bit_20_nz_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
673 ; RV32-LABEL: bit_20_nz_select_i32:
675 ; RV32-NEXT: slli a3, a0, 11
676 ; RV32-NEXT: mv a0, a1
677 ; RV32-NEXT: bltz a3, .LBB20_2
678 ; RV32-NEXT: # %bb.1:
679 ; RV32-NEXT: mv a0, a2
680 ; RV32-NEXT: .LBB20_2:
683 ; RV64-LABEL: bit_20_nz_select_i32:
685 ; RV64-NEXT: slli a3, a0, 43
686 ; RV64-NEXT: mv a0, a1
687 ; RV64-NEXT: bltz a3, .LBB20_2
688 ; RV64-NEXT: # %bb.1:
689 ; RV64-NEXT: mv a0, a2
690 ; RV64-NEXT: .LBB20_2:
692 %1 = and i32 %a, 1048576
693 %2 = icmp ne i32 %1, 0
694 %3 = select i1 %2, i32 %b, i32 %c
698 define signext i32 @bit_31_z_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
699 ; RV32-LABEL: bit_31_z_select_i32:
701 ; RV32-NEXT: bgez a0, .LBB21_2
702 ; RV32-NEXT: # %bb.1:
703 ; RV32-NEXT: mv a1, a2
704 ; RV32-NEXT: .LBB21_2:
705 ; RV32-NEXT: mv a0, a1
708 ; RV64-LABEL: bit_31_z_select_i32:
710 ; RV64-NEXT: lui a3, 524288
711 ; RV64-NEXT: and a3, a0, a3
712 ; RV64-NEXT: mv a0, a1
713 ; RV64-NEXT: beqz a3, .LBB21_2
714 ; RV64-NEXT: # %bb.1:
715 ; RV64-NEXT: mv a0, a2
716 ; RV64-NEXT: .LBB21_2:
718 %1 = and i32 %a, 2147483648
719 %2 = icmp eq i32 %1, 0
720 %3 = select i1 %2, i32 %b, i32 %c
724 define signext i32 @bit_31_nz_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
725 ; RV32-LABEL: bit_31_nz_select_i32:
727 ; RV32-NEXT: srli a3, a0, 31
728 ; RV32-NEXT: mv a0, a1
729 ; RV32-NEXT: bnez a3, .LBB22_2
730 ; RV32-NEXT: # %bb.1:
731 ; RV32-NEXT: mv a0, a2
732 ; RV32-NEXT: .LBB22_2:
735 ; RV64-LABEL: bit_31_nz_select_i32:
737 ; RV64-NEXT: lui a3, 524288
738 ; RV64-NEXT: and a3, a0, a3
739 ; RV64-NEXT: mv a0, a1
740 ; RV64-NEXT: bnez a3, .LBB22_2
741 ; RV64-NEXT: # %bb.1:
742 ; RV64-NEXT: mv a0, a2
743 ; RV64-NEXT: .LBB22_2:
745 %1 = and i32 %a, 2147483648
746 %2 = icmp ne i32 %1, 0
747 %3 = select i1 %2, i32 %b, i32 %c
751 define i64 @bit_10_z_select_i64(i64 %a, i64 %b, i64 %c) {
752 ; RV32-LABEL: bit_10_z_select_i64:
754 ; RV32-NEXT: andi a6, a0, 1024
755 ; RV32-NEXT: mv a1, a3
756 ; RV32-NEXT: mv a0, a2
757 ; RV32-NEXT: beqz a6, .LBB23_2
758 ; RV32-NEXT: # %bb.1:
759 ; RV32-NEXT: mv a0, a4
760 ; RV32-NEXT: mv a1, a5
761 ; RV32-NEXT: .LBB23_2:
764 ; RV64-LABEL: bit_10_z_select_i64:
766 ; RV64-NEXT: andi a3, a0, 1024
767 ; RV64-NEXT: mv a0, a1
768 ; RV64-NEXT: beqz a3, .LBB23_2
769 ; RV64-NEXT: # %bb.1:
770 ; RV64-NEXT: mv a0, a2
771 ; RV64-NEXT: .LBB23_2:
773 %1 = and i64 %a, 1024
774 %2 = icmp eq i64 %1, 0
775 %3 = select i1 %2, i64 %b, i64 %c
779 define i64 @bit_10_nz_select_i64(i64 %a, i64 %b, i64 %c) {
780 ; RV32I-LABEL: bit_10_nz_select_i64:
782 ; RV32I-NEXT: slli a0, a0, 21
783 ; RV32I-NEXT: srli a6, a0, 31
784 ; RV32I-NEXT: mv a1, a3
785 ; RV32I-NEXT: mv a0, a2
786 ; RV32I-NEXT: bnez a6, .LBB24_2
787 ; RV32I-NEXT: # %bb.1:
788 ; RV32I-NEXT: mv a0, a4
789 ; RV32I-NEXT: mv a1, a5
790 ; RV32I-NEXT: .LBB24_2:
793 ; RV64-LABEL: bit_10_nz_select_i64:
795 ; RV64-NEXT: slli a3, a0, 53
796 ; RV64-NEXT: mv a0, a1
797 ; RV64-NEXT: bltz a3, .LBB24_2
798 ; RV64-NEXT: # %bb.1:
799 ; RV64-NEXT: mv a0, a2
800 ; RV64-NEXT: .LBB24_2:
803 ; RV32ZBS-LABEL: bit_10_nz_select_i64:
805 ; RV32ZBS-NEXT: bexti a6, a0, 10
806 ; RV32ZBS-NEXT: mv a1, a3
807 ; RV32ZBS-NEXT: mv a0, a2
808 ; RV32ZBS-NEXT: bnez a6, .LBB24_2
809 ; RV32ZBS-NEXT: # %bb.1:
810 ; RV32ZBS-NEXT: mv a0, a4
811 ; RV32ZBS-NEXT: mv a1, a5
812 ; RV32ZBS-NEXT: .LBB24_2:
815 ; RV32XTHEADBS-LABEL: bit_10_nz_select_i64:
816 ; RV32XTHEADBS: # %bb.0:
817 ; RV32XTHEADBS-NEXT: th.tst a6, a0, 10
818 ; RV32XTHEADBS-NEXT: mv a1, a3
819 ; RV32XTHEADBS-NEXT: mv a0, a2
820 ; RV32XTHEADBS-NEXT: bnez a6, .LBB24_2
821 ; RV32XTHEADBS-NEXT: # %bb.1:
822 ; RV32XTHEADBS-NEXT: mv a0, a4
823 ; RV32XTHEADBS-NEXT: mv a1, a5
824 ; RV32XTHEADBS-NEXT: .LBB24_2:
825 ; RV32XTHEADBS-NEXT: ret
826 %1 = and i64 %a, 1024
827 %2 = icmp ne i64 %1, 0
828 %3 = select i1 %2, i64 %b, i64 %c
832 define i64 @bit_11_z_select_i64(i64 %a, i64 %b, i64 %c) {
833 ; RV32-LABEL: bit_11_z_select_i64:
835 ; RV32-NEXT: slli a6, a0, 20
836 ; RV32-NEXT: mv a1, a3
837 ; RV32-NEXT: mv a0, a2
838 ; RV32-NEXT: bgez a6, .LBB25_2
839 ; RV32-NEXT: # %bb.1:
840 ; RV32-NEXT: mv a0, a4
841 ; RV32-NEXT: mv a1, a5
842 ; RV32-NEXT: .LBB25_2:
845 ; RV64-LABEL: bit_11_z_select_i64:
847 ; RV64-NEXT: slli a3, a0, 52
848 ; RV64-NEXT: mv a0, a1
849 ; RV64-NEXT: bgez a3, .LBB25_2
850 ; RV64-NEXT: # %bb.1:
851 ; RV64-NEXT: mv a0, a2
852 ; RV64-NEXT: .LBB25_2:
854 %1 = and i64 %a, 2048
855 %2 = icmp eq i64 %1, 0
856 %3 = select i1 %2, i64 %b, i64 %c
860 define i64 @bit_11_nz_select_i64(i64 %a, i64 %b, i64 %c) {
861 ; RV32I-LABEL: bit_11_nz_select_i64:
863 ; RV32I-NEXT: slli a0, a0, 20
864 ; RV32I-NEXT: srli a6, a0, 31
865 ; RV32I-NEXT: mv a1, a3
866 ; RV32I-NEXT: mv a0, a2
867 ; RV32I-NEXT: bnez a6, .LBB26_2
868 ; RV32I-NEXT: # %bb.1:
869 ; RV32I-NEXT: mv a0, a4
870 ; RV32I-NEXT: mv a1, a5
871 ; RV32I-NEXT: .LBB26_2:
874 ; RV64-LABEL: bit_11_nz_select_i64:
876 ; RV64-NEXT: slli a3, a0, 52
877 ; RV64-NEXT: mv a0, a1
878 ; RV64-NEXT: bltz a3, .LBB26_2
879 ; RV64-NEXT: # %bb.1:
880 ; RV64-NEXT: mv a0, a2
881 ; RV64-NEXT: .LBB26_2:
884 ; RV32ZBS-LABEL: bit_11_nz_select_i64:
886 ; RV32ZBS-NEXT: bexti a6, a0, 11
887 ; RV32ZBS-NEXT: mv a1, a3
888 ; RV32ZBS-NEXT: mv a0, a2
889 ; RV32ZBS-NEXT: bnez a6, .LBB26_2
890 ; RV32ZBS-NEXT: # %bb.1:
891 ; RV32ZBS-NEXT: mv a0, a4
892 ; RV32ZBS-NEXT: mv a1, a5
893 ; RV32ZBS-NEXT: .LBB26_2:
896 ; RV32XTHEADBS-LABEL: bit_11_nz_select_i64:
897 ; RV32XTHEADBS: # %bb.0:
898 ; RV32XTHEADBS-NEXT: th.tst a6, a0, 11
899 ; RV32XTHEADBS-NEXT: mv a1, a3
900 ; RV32XTHEADBS-NEXT: mv a0, a2
901 ; RV32XTHEADBS-NEXT: bnez a6, .LBB26_2
902 ; RV32XTHEADBS-NEXT: # %bb.1:
903 ; RV32XTHEADBS-NEXT: mv a0, a4
904 ; RV32XTHEADBS-NEXT: mv a1, a5
905 ; RV32XTHEADBS-NEXT: .LBB26_2:
906 ; RV32XTHEADBS-NEXT: ret
907 %1 = and i64 %a, 2048
908 %2 = icmp ne i64 %1, 0
909 %3 = select i1 %2, i64 %b, i64 %c
913 define i64 @bit_20_z_select_i64(i64 %a, i64 %b, i64 %c) {
914 ; RV32-LABEL: bit_20_z_select_i64:
916 ; RV32-NEXT: slli a6, a0, 11
917 ; RV32-NEXT: mv a1, a3
918 ; RV32-NEXT: mv a0, a2
919 ; RV32-NEXT: bgez a6, .LBB27_2
920 ; RV32-NEXT: # %bb.1:
921 ; RV32-NEXT: mv a0, a4
922 ; RV32-NEXT: mv a1, a5
923 ; RV32-NEXT: .LBB27_2:
926 ; RV64-LABEL: bit_20_z_select_i64:
928 ; RV64-NEXT: slli a3, a0, 43
929 ; RV64-NEXT: mv a0, a1
930 ; RV64-NEXT: bgez a3, .LBB27_2
931 ; RV64-NEXT: # %bb.1:
932 ; RV64-NEXT: mv a0, a2
933 ; RV64-NEXT: .LBB27_2:
935 %1 = and i64 %a, 1048576
936 %2 = icmp eq i64 %1, 0
937 %3 = select i1 %2, i64 %b, i64 %c
941 define i64 @bit_20_nz_select_i64(i64 %a, i64 %b, i64 %c) {
942 ; RV32I-LABEL: bit_20_nz_select_i64:
944 ; RV32I-NEXT: slli a0, a0, 11
945 ; RV32I-NEXT: srli a6, a0, 31
946 ; RV32I-NEXT: mv a1, a3
947 ; RV32I-NEXT: mv a0, a2
948 ; RV32I-NEXT: bnez a6, .LBB28_2
949 ; RV32I-NEXT: # %bb.1:
950 ; RV32I-NEXT: mv a0, a4
951 ; RV32I-NEXT: mv a1, a5
952 ; RV32I-NEXT: .LBB28_2:
955 ; RV64-LABEL: bit_20_nz_select_i64:
957 ; RV64-NEXT: slli a3, a0, 43
958 ; RV64-NEXT: mv a0, a1
959 ; RV64-NEXT: bltz a3, .LBB28_2
960 ; RV64-NEXT: # %bb.1:
961 ; RV64-NEXT: mv a0, a2
962 ; RV64-NEXT: .LBB28_2:
965 ; RV32ZBS-LABEL: bit_20_nz_select_i64:
967 ; RV32ZBS-NEXT: bexti a6, a0, 20
968 ; RV32ZBS-NEXT: mv a1, a3
969 ; RV32ZBS-NEXT: mv a0, a2
970 ; RV32ZBS-NEXT: bnez a6, .LBB28_2
971 ; RV32ZBS-NEXT: # %bb.1:
972 ; RV32ZBS-NEXT: mv a0, a4
973 ; RV32ZBS-NEXT: mv a1, a5
974 ; RV32ZBS-NEXT: .LBB28_2:
977 ; RV32XTHEADBS-LABEL: bit_20_nz_select_i64:
978 ; RV32XTHEADBS: # %bb.0:
979 ; RV32XTHEADBS-NEXT: th.tst a6, a0, 20
980 ; RV32XTHEADBS-NEXT: mv a1, a3
981 ; RV32XTHEADBS-NEXT: mv a0, a2
982 ; RV32XTHEADBS-NEXT: bnez a6, .LBB28_2
983 ; RV32XTHEADBS-NEXT: # %bb.1:
984 ; RV32XTHEADBS-NEXT: mv a0, a4
985 ; RV32XTHEADBS-NEXT: mv a1, a5
986 ; RV32XTHEADBS-NEXT: .LBB28_2:
987 ; RV32XTHEADBS-NEXT: ret
988 %1 = and i64 %a, 1048576
989 %2 = icmp ne i64 %1, 0
990 %3 = select i1 %2, i64 %b, i64 %c
994 define i64 @bit_31_z_select_i64(i64 %a, i64 %b, i64 %c) {
995 ; RV32-LABEL: bit_31_z_select_i64:
997 ; RV32-NEXT: mv a1, a3
998 ; RV32-NEXT: bgez a0, .LBB29_2
999 ; RV32-NEXT: # %bb.1:
1000 ; RV32-NEXT: mv a2, a4
1001 ; RV32-NEXT: mv a1, a5
1002 ; RV32-NEXT: .LBB29_2:
1003 ; RV32-NEXT: mv a0, a2
1006 ; RV64-LABEL: bit_31_z_select_i64:
1008 ; RV64-NEXT: slli a3, a0, 32
1009 ; RV64-NEXT: mv a0, a1
1010 ; RV64-NEXT: bgez a3, .LBB29_2
1011 ; RV64-NEXT: # %bb.1:
1012 ; RV64-NEXT: mv a0, a2
1013 ; RV64-NEXT: .LBB29_2:
1015 %1 = and i64 %a, 2147483648
1016 %2 = icmp eq i64 %1, 0
1017 %3 = select i1 %2, i64 %b, i64 %c
1021 define i64 @bit_31_nz_select_i64(i64 %a, i64 %b, i64 %c) {
1022 ; RV32-LABEL: bit_31_nz_select_i64:
1024 ; RV32-NEXT: srli a6, a0, 31
1025 ; RV32-NEXT: mv a1, a3
1026 ; RV32-NEXT: mv a0, a2
1027 ; RV32-NEXT: bnez a6, .LBB30_2
1028 ; RV32-NEXT: # %bb.1:
1029 ; RV32-NEXT: mv a0, a4
1030 ; RV32-NEXT: mv a1, a5
1031 ; RV32-NEXT: .LBB30_2:
1034 ; RV64-LABEL: bit_31_nz_select_i64:
1036 ; RV64-NEXT: slli a3, a0, 32
1037 ; RV64-NEXT: mv a0, a1
1038 ; RV64-NEXT: bltz a3, .LBB30_2
1039 ; RV64-NEXT: # %bb.1:
1040 ; RV64-NEXT: mv a0, a2
1041 ; RV64-NEXT: .LBB30_2:
1043 %1 = and i64 %a, 2147483648
1044 %2 = icmp ne i64 %1, 0
1045 %3 = select i1 %2, i64 %b, i64 %c
1049 define i64 @bit_32_z_select_i64(i64 %a, i64 %b, i64 %c) {
1050 ; RV32-LABEL: bit_32_z_select_i64:
1052 ; RV32-NEXT: andi a6, a1, 1
1053 ; RV32-NEXT: mv a1, a3
1054 ; RV32-NEXT: mv a0, a2
1055 ; RV32-NEXT: beqz a6, .LBB31_2
1056 ; RV32-NEXT: # %bb.1:
1057 ; RV32-NEXT: mv a0, a4
1058 ; RV32-NEXT: mv a1, a5
1059 ; RV32-NEXT: .LBB31_2:
1062 ; RV64-LABEL: bit_32_z_select_i64:
1064 ; RV64-NEXT: slli a3, a0, 31
1065 ; RV64-NEXT: mv a0, a1
1066 ; RV64-NEXT: bgez a3, .LBB31_2
1067 ; RV64-NEXT: # %bb.1:
1068 ; RV64-NEXT: mv a0, a2
1069 ; RV64-NEXT: .LBB31_2:
1071 %1 = and i64 %a, 4294967296
1072 %2 = icmp eq i64 %1, 0
1073 %3 = select i1 %2, i64 %b, i64 %c
1077 define i64 @bit_32_nz_select_i64(i64 %a, i64 %b, i64 %c) {
1078 ; RV32-LABEL: bit_32_nz_select_i64:
1080 ; RV32-NEXT: andi a6, a1, 1
1081 ; RV32-NEXT: mv a1, a3
1082 ; RV32-NEXT: mv a0, a2
1083 ; RV32-NEXT: bnez a6, .LBB32_2
1084 ; RV32-NEXT: # %bb.1:
1085 ; RV32-NEXT: mv a0, a4
1086 ; RV32-NEXT: mv a1, a5
1087 ; RV32-NEXT: .LBB32_2:
1090 ; RV64-LABEL: bit_32_nz_select_i64:
1092 ; RV64-NEXT: slli a3, a0, 31
1093 ; RV64-NEXT: mv a0, a1
1094 ; RV64-NEXT: bltz a3, .LBB32_2
1095 ; RV64-NEXT: # %bb.1:
1096 ; RV64-NEXT: mv a0, a2
1097 ; RV64-NEXT: .LBB32_2:
1099 %1 = and i64 %a, 4294967296
1100 %2 = icmp ne i64 %1, 0
1101 %3 = select i1 %2, i64 %b, i64 %c
1105 define i64 @bit_55_z_select_i64(i64 %a, i64 %b, i64 %c) {
1106 ; RV32-LABEL: bit_55_z_select_i64:
1108 ; RV32-NEXT: slli a6, a1, 8
1109 ; RV32-NEXT: mv a1, a3
1110 ; RV32-NEXT: mv a0, a2
1111 ; RV32-NEXT: bgez a6, .LBB33_2
1112 ; RV32-NEXT: # %bb.1:
1113 ; RV32-NEXT: mv a0, a4
1114 ; RV32-NEXT: mv a1, a5
1115 ; RV32-NEXT: .LBB33_2:
1118 ; RV64-LABEL: bit_55_z_select_i64:
1120 ; RV64-NEXT: slli a3, a0, 8
1121 ; RV64-NEXT: mv a0, a1
1122 ; RV64-NEXT: bgez a3, .LBB33_2
1123 ; RV64-NEXT: # %bb.1:
1124 ; RV64-NEXT: mv a0, a2
1125 ; RV64-NEXT: .LBB33_2:
1127 %1 = and i64 %a, 36028797018963968
1128 %2 = icmp eq i64 %1, 0
1129 %3 = select i1 %2, i64 %b, i64 %c
1133 define i64 @bit_55_nz_select_i64(i64 %a, i64 %b, i64 %c) {
1134 ; RV32I-LABEL: bit_55_nz_select_i64:
1136 ; RV32I-NEXT: slli a1, a1, 8
1137 ; RV32I-NEXT: srli a6, a1, 31
1138 ; RV32I-NEXT: mv a1, a3
1139 ; RV32I-NEXT: mv a0, a2
1140 ; RV32I-NEXT: bnez a6, .LBB34_2
1141 ; RV32I-NEXT: # %bb.1:
1142 ; RV32I-NEXT: mv a0, a4
1143 ; RV32I-NEXT: mv a1, a5
1144 ; RV32I-NEXT: .LBB34_2:
1147 ; RV64-LABEL: bit_55_nz_select_i64:
1149 ; RV64-NEXT: slli a3, a0, 8
1150 ; RV64-NEXT: mv a0, a1
1151 ; RV64-NEXT: bltz a3, .LBB34_2
1152 ; RV64-NEXT: # %bb.1:
1153 ; RV64-NEXT: mv a0, a2
1154 ; RV64-NEXT: .LBB34_2:
1157 ; RV32ZBS-LABEL: bit_55_nz_select_i64:
1159 ; RV32ZBS-NEXT: bexti a6, a1, 23
1160 ; RV32ZBS-NEXT: mv a1, a3
1161 ; RV32ZBS-NEXT: mv a0, a2
1162 ; RV32ZBS-NEXT: bnez a6, .LBB34_2
1163 ; RV32ZBS-NEXT: # %bb.1:
1164 ; RV32ZBS-NEXT: mv a0, a4
1165 ; RV32ZBS-NEXT: mv a1, a5
1166 ; RV32ZBS-NEXT: .LBB34_2:
1169 ; RV32XTHEADBS-LABEL: bit_55_nz_select_i64:
1170 ; RV32XTHEADBS: # %bb.0:
1171 ; RV32XTHEADBS-NEXT: th.tst a6, a1, 23
1172 ; RV32XTHEADBS-NEXT: mv a1, a3
1173 ; RV32XTHEADBS-NEXT: mv a0, a2
1174 ; RV32XTHEADBS-NEXT: bnez a6, .LBB34_2
1175 ; RV32XTHEADBS-NEXT: # %bb.1:
1176 ; RV32XTHEADBS-NEXT: mv a0, a4
1177 ; RV32XTHEADBS-NEXT: mv a1, a5
1178 ; RV32XTHEADBS-NEXT: .LBB34_2:
1179 ; RV32XTHEADBS-NEXT: ret
1180 %1 = and i64 %a, 36028797018963968
1181 %2 = icmp ne i64 %1, 0
1182 %3 = select i1 %2, i64 %b, i64 %c
1186 define i64 @bit_63_z_select_i64(i64 %a, i64 %b, i64 %c) {
1187 ; RV32-LABEL: bit_63_z_select_i64:
1189 ; RV32-NEXT: mv a0, a2
1190 ; RV32-NEXT: bgez a1, .LBB35_2
1191 ; RV32-NEXT: # %bb.1:
1192 ; RV32-NEXT: mv a0, a4
1193 ; RV32-NEXT: mv a3, a5
1194 ; RV32-NEXT: .LBB35_2:
1195 ; RV32-NEXT: mv a1, a3
1198 ; RV64-LABEL: bit_63_z_select_i64:
1200 ; RV64-NEXT: bgez a0, .LBB35_2
1201 ; RV64-NEXT: # %bb.1:
1202 ; RV64-NEXT: mv a1, a2
1203 ; RV64-NEXT: .LBB35_2:
1204 ; RV64-NEXT: mv a0, a1
1206 %1 = and i64 %a, 9223372036854775808
1207 %2 = icmp eq i64 %1, 0
1208 %3 = select i1 %2, i64 %b, i64 %c
1212 define i64 @bit_63_nz_select_i64(i64 %a, i64 %b, i64 %c) {
1213 ; RV32-LABEL: bit_63_nz_select_i64:
1215 ; RV32-NEXT: srli a6, a1, 31
1216 ; RV32-NEXT: mv a1, a3
1217 ; RV32-NEXT: mv a0, a2
1218 ; RV32-NEXT: bnez a6, .LBB36_2
1219 ; RV32-NEXT: # %bb.1:
1220 ; RV32-NEXT: mv a0, a4
1221 ; RV32-NEXT: mv a1, a5
1222 ; RV32-NEXT: .LBB36_2:
1225 ; RV64-LABEL: bit_63_nz_select_i64:
1227 ; RV64-NEXT: srli a3, a0, 63
1228 ; RV64-NEXT: mv a0, a1
1229 ; RV64-NEXT: bnez a3, .LBB36_2
1230 ; RV64-NEXT: # %bb.1:
1231 ; RV64-NEXT: mv a0, a2
1232 ; RV64-NEXT: .LBB36_2:
1234 %1 = and i64 %a, 9223372036854775808
1235 %2 = icmp ne i64 %1, 0
1236 %3 = select i1 %2, i64 %b, i64 %c
1240 define void @bit_10_z_branch_i32(i32 signext %0) {
1241 ; CHECK-LABEL: bit_10_z_branch_i32:
1243 ; CHECK-NEXT: andi a0, a0, 1024
1244 ; CHECK-NEXT: bnez a0, .LBB37_2
1245 ; CHECK-NEXT: # %bb.1:
1246 ; CHECK-NEXT: tail bar
1247 ; CHECK-NEXT: .LBB37_2:
1249 %2 = and i32 %0, 1024
1250 %3 = icmp eq i32 %2, 0
1251 br i1 %3, label %4, label %5
1254 tail call void @bar()
1261 define void @bit_10_nz_branch_i32(i32 signext %0) {
1262 ; CHECK-LABEL: bit_10_nz_branch_i32:
1264 ; CHECK-NEXT: andi a0, a0, 1024
1265 ; CHECK-NEXT: beqz a0, .LBB38_2
1266 ; CHECK-NEXT: # %bb.1:
1267 ; CHECK-NEXT: tail bar
1268 ; CHECK-NEXT: .LBB38_2:
1270 %2 = and i32 %0, 1024
1271 %3 = icmp ne i32 %2, 0
1272 br i1 %3, label %4, label %5
1275 tail call void @bar()
1282 define void @bit_11_z_branch_i32(i32 signext %0) {
1283 ; RV32-LABEL: bit_11_z_branch_i32:
1285 ; RV32-NEXT: slli a0, a0, 20
1286 ; RV32-NEXT: bltz a0, .LBB39_2
1287 ; RV32-NEXT: # %bb.1:
1288 ; RV32-NEXT: tail bar
1289 ; RV32-NEXT: .LBB39_2:
1292 ; RV64-LABEL: bit_11_z_branch_i32:
1294 ; RV64-NEXT: slli a0, a0, 52
1295 ; RV64-NEXT: bltz a0, .LBB39_2
1296 ; RV64-NEXT: # %bb.1:
1297 ; RV64-NEXT: tail bar
1298 ; RV64-NEXT: .LBB39_2:
1300 %2 = and i32 %0, 2048
1301 %3 = icmp eq i32 %2, 0
1302 br i1 %3, label %4, label %5
1305 tail call void @bar()
1312 define void @bit_11_nz_branch_i32(i32 signext %0) {
1313 ; RV32-LABEL: bit_11_nz_branch_i32:
1315 ; RV32-NEXT: slli a0, a0, 20
1316 ; RV32-NEXT: bgez a0, .LBB40_2
1317 ; RV32-NEXT: # %bb.1:
1318 ; RV32-NEXT: tail bar
1319 ; RV32-NEXT: .LBB40_2:
1322 ; RV64-LABEL: bit_11_nz_branch_i32:
1324 ; RV64-NEXT: slli a0, a0, 52
1325 ; RV64-NEXT: bgez a0, .LBB40_2
1326 ; RV64-NEXT: # %bb.1:
1327 ; RV64-NEXT: tail bar
1328 ; RV64-NEXT: .LBB40_2:
1330 %2 = and i32 %0, 2048
1331 %3 = icmp ne i32 %2, 0
1332 br i1 %3, label %4, label %5
1335 tail call void @bar()
1342 define void @bit_24_z_branch_i32(i32 signext %0) {
1343 ; RV32-LABEL: bit_24_z_branch_i32:
1345 ; RV32-NEXT: slli a0, a0, 7
1346 ; RV32-NEXT: bltz a0, .LBB41_2
1347 ; RV32-NEXT: # %bb.1:
1348 ; RV32-NEXT: tail bar
1349 ; RV32-NEXT: .LBB41_2:
1352 ; RV64-LABEL: bit_24_z_branch_i32:
1354 ; RV64-NEXT: slli a0, a0, 39
1355 ; RV64-NEXT: bltz a0, .LBB41_2
1356 ; RV64-NEXT: # %bb.1:
1357 ; RV64-NEXT: tail bar
1358 ; RV64-NEXT: .LBB41_2:
1360 %2 = and i32 %0, 16777216
1361 %3 = icmp eq i32 %2, 0
1362 br i1 %3, label %4, label %5
1365 tail call void @bar()
1372 define void @bit_24_nz_branch_i32(i32 signext %0) {
1373 ; RV32-LABEL: bit_24_nz_branch_i32:
1375 ; RV32-NEXT: slli a0, a0, 7
1376 ; RV32-NEXT: bgez a0, .LBB42_2
1377 ; RV32-NEXT: # %bb.1:
1378 ; RV32-NEXT: tail bar
1379 ; RV32-NEXT: .LBB42_2:
1382 ; RV64-LABEL: bit_24_nz_branch_i32:
1384 ; RV64-NEXT: slli a0, a0, 39
1385 ; RV64-NEXT: bgez a0, .LBB42_2
1386 ; RV64-NEXT: # %bb.1:
1387 ; RV64-NEXT: tail bar
1388 ; RV64-NEXT: .LBB42_2:
1390 %2 = and i32 %0, 16777216
1391 %3 = icmp ne i32 %2, 0
1392 br i1 %3, label %4, label %5
1395 tail call void @bar()
1402 define void @bit_31_z_branch_i32(i32 signext %0) {
1403 ; RV32-LABEL: bit_31_z_branch_i32:
1405 ; RV32-NEXT: bltz a0, .LBB43_2
1406 ; RV32-NEXT: # %bb.1:
1407 ; RV32-NEXT: tail bar
1408 ; RV32-NEXT: .LBB43_2:
1411 ; RV64-LABEL: bit_31_z_branch_i32:
1413 ; RV64-NEXT: lui a1, 524288
1414 ; RV64-NEXT: and a0, a0, a1
1415 ; RV64-NEXT: bnez a0, .LBB43_2
1416 ; RV64-NEXT: # %bb.1:
1417 ; RV64-NEXT: tail bar
1418 ; RV64-NEXT: .LBB43_2:
1420 %2 = and i32 %0, 2147483648
1421 %3 = icmp eq i32 %2, 0
1422 br i1 %3, label %4, label %5
1425 tail call void @bar()
1432 define void @bit_31_nz_branch_i32(i32 signext %0) {
1433 ; RV32-LABEL: bit_31_nz_branch_i32:
1435 ; RV32-NEXT: bgez a0, .LBB44_2
1436 ; RV32-NEXT: # %bb.1:
1437 ; RV32-NEXT: tail bar
1438 ; RV32-NEXT: .LBB44_2:
1441 ; RV64-LABEL: bit_31_nz_branch_i32:
1443 ; RV64-NEXT: lui a1, 524288
1444 ; RV64-NEXT: and a0, a0, a1
1445 ; RV64-NEXT: beqz a0, .LBB44_2
1446 ; RV64-NEXT: # %bb.1:
1447 ; RV64-NEXT: tail bar
1448 ; RV64-NEXT: .LBB44_2:
1450 %2 = and i32 %0, 2147483648
1451 %3 = icmp ne i32 %2, 0
1452 br i1 %3, label %4, label %5
1455 tail call void @bar()
1462 define void @bit_10_z_branch_i64(i64 %0) {
1463 ; CHECK-LABEL: bit_10_z_branch_i64:
1465 ; CHECK-NEXT: andi a0, a0, 1024
1466 ; CHECK-NEXT: bnez a0, .LBB45_2
1467 ; CHECK-NEXT: # %bb.1:
1468 ; CHECK-NEXT: tail bar
1469 ; CHECK-NEXT: .LBB45_2:
1471 %2 = and i64 %0, 1024
1472 %3 = icmp eq i64 %2, 0
1473 br i1 %3, label %4, label %5
1476 tail call void @bar()
1483 define void @bit_10_nz_branch_i64(i64 %0) {
1484 ; CHECK-LABEL: bit_10_nz_branch_i64:
1486 ; CHECK-NEXT: andi a0, a0, 1024
1487 ; CHECK-NEXT: beqz a0, .LBB46_2
1488 ; CHECK-NEXT: # %bb.1:
1489 ; CHECK-NEXT: tail bar
1490 ; CHECK-NEXT: .LBB46_2:
1492 %2 = and i64 %0, 1024
1493 %3 = icmp ne i64 %2, 0
1494 br i1 %3, label %4, label %5
1497 tail call void @bar()
1504 define void @bit_11_z_branch_i64(i64 %0) {
1505 ; RV32-LABEL: bit_11_z_branch_i64:
1507 ; RV32-NEXT: slli a0, a0, 20
1508 ; RV32-NEXT: bltz a0, .LBB47_2
1509 ; RV32-NEXT: # %bb.1:
1510 ; RV32-NEXT: tail bar
1511 ; RV32-NEXT: .LBB47_2:
1514 ; RV64-LABEL: bit_11_z_branch_i64:
1516 ; RV64-NEXT: slli a0, a0, 52
1517 ; RV64-NEXT: bltz a0, .LBB47_2
1518 ; RV64-NEXT: # %bb.1:
1519 ; RV64-NEXT: tail bar
1520 ; RV64-NEXT: .LBB47_2:
1522 %2 = and i64 %0, 2048
1523 %3 = icmp eq i64 %2, 0
1524 br i1 %3, label %4, label %5
1527 tail call void @bar()
1534 define void @bit_11_nz_branch_i64(i64 %0) {
1535 ; RV32-LABEL: bit_11_nz_branch_i64:
1537 ; RV32-NEXT: slli a0, a0, 20
1538 ; RV32-NEXT: bgez a0, .LBB48_2
1539 ; RV32-NEXT: # %bb.1:
1540 ; RV32-NEXT: tail bar
1541 ; RV32-NEXT: .LBB48_2:
1544 ; RV64-LABEL: bit_11_nz_branch_i64:
1546 ; RV64-NEXT: slli a0, a0, 52
1547 ; RV64-NEXT: bgez a0, .LBB48_2
1548 ; RV64-NEXT: # %bb.1:
1549 ; RV64-NEXT: tail bar
1550 ; RV64-NEXT: .LBB48_2:
1552 %2 = and i64 %0, 2048
1553 %3 = icmp ne i64 %2, 0
1554 br i1 %3, label %4, label %5
1557 tail call void @bar()
1564 define void @bit_24_z_branch_i64(i64 %0) {
1565 ; RV32-LABEL: bit_24_z_branch_i64:
1567 ; RV32-NEXT: slli a0, a0, 7
1568 ; RV32-NEXT: bltz a0, .LBB49_2
1569 ; RV32-NEXT: # %bb.1:
1570 ; RV32-NEXT: tail bar
1571 ; RV32-NEXT: .LBB49_2:
1574 ; RV64-LABEL: bit_24_z_branch_i64:
1576 ; RV64-NEXT: slli a0, a0, 39
1577 ; RV64-NEXT: bltz a0, .LBB49_2
1578 ; RV64-NEXT: # %bb.1:
1579 ; RV64-NEXT: tail bar
1580 ; RV64-NEXT: .LBB49_2:
1582 %2 = and i64 %0, 16777216
1583 %3 = icmp eq i64 %2, 0
1584 br i1 %3, label %4, label %5
1587 tail call void @bar()
1594 define void @bit_24_nz_branch_i64(i64 %0) {
1595 ; RV32-LABEL: bit_24_nz_branch_i64:
1597 ; RV32-NEXT: slli a0, a0, 7
1598 ; RV32-NEXT: bgez a0, .LBB50_2
1599 ; RV32-NEXT: # %bb.1:
1600 ; RV32-NEXT: tail bar
1601 ; RV32-NEXT: .LBB50_2:
1604 ; RV64-LABEL: bit_24_nz_branch_i64:
1606 ; RV64-NEXT: slli a0, a0, 39
1607 ; RV64-NEXT: bgez a0, .LBB50_2
1608 ; RV64-NEXT: # %bb.1:
1609 ; RV64-NEXT: tail bar
1610 ; RV64-NEXT: .LBB50_2:
1612 %2 = and i64 %0, 16777216
1613 %3 = icmp ne i64 %2, 0
1614 br i1 %3, label %4, label %5
1617 tail call void @bar()
1624 define void @bit_31_z_branch_i64(i64 %0) {
1625 ; RV32-LABEL: bit_31_z_branch_i64:
1627 ; RV32-NEXT: bltz a0, .LBB51_2
1628 ; RV32-NEXT: # %bb.1:
1629 ; RV32-NEXT: tail bar
1630 ; RV32-NEXT: .LBB51_2:
1633 ; RV64-LABEL: bit_31_z_branch_i64:
1635 ; RV64-NEXT: slli a0, a0, 32
1636 ; RV64-NEXT: bltz a0, .LBB51_2
1637 ; RV64-NEXT: # %bb.1:
1638 ; RV64-NEXT: tail bar
1639 ; RV64-NEXT: .LBB51_2:
1641 %2 = and i64 %0, 2147483648
1642 %3 = icmp eq i64 %2, 0
1643 br i1 %3, label %4, label %5
1646 tail call void @bar()
1653 define void @bit_31_nz_branch_i64(i64 %0) {
1654 ; RV32-LABEL: bit_31_nz_branch_i64:
1656 ; RV32-NEXT: bgez a0, .LBB52_2
1657 ; RV32-NEXT: # %bb.1:
1658 ; RV32-NEXT: tail bar
1659 ; RV32-NEXT: .LBB52_2:
1662 ; RV64-LABEL: bit_31_nz_branch_i64:
1664 ; RV64-NEXT: slli a0, a0, 32
1665 ; RV64-NEXT: bgez a0, .LBB52_2
1666 ; RV64-NEXT: # %bb.1:
1667 ; RV64-NEXT: tail bar
1668 ; RV64-NEXT: .LBB52_2:
1670 %2 = and i64 %0, 2147483648
1671 %3 = icmp ne i64 %2, 0
1672 br i1 %3, label %4, label %5
1675 tail call void @bar()
1682 define void @bit_32_z_branch_i64(i64 %0) {
1683 ; RV32-LABEL: bit_32_z_branch_i64:
1685 ; RV32-NEXT: andi a1, a1, 1
1686 ; RV32-NEXT: bnez a1, .LBB53_2
1687 ; RV32-NEXT: # %bb.1:
1688 ; RV32-NEXT: tail bar
1689 ; RV32-NEXT: .LBB53_2:
1692 ; RV64-LABEL: bit_32_z_branch_i64:
1694 ; RV64-NEXT: slli a0, a0, 31
1695 ; RV64-NEXT: bltz a0, .LBB53_2
1696 ; RV64-NEXT: # %bb.1:
1697 ; RV64-NEXT: tail bar
1698 ; RV64-NEXT: .LBB53_2:
1700 %2 = and i64 %0, 4294967296
1701 %3 = icmp eq i64 %2, 0
1702 br i1 %3, label %4, label %5
1705 tail call void @bar()
1712 define void @bit_32_nz_branch_i64(i64 %0) {
1713 ; RV32-LABEL: bit_32_nz_branch_i64:
1715 ; RV32-NEXT: andi a1, a1, 1
1716 ; RV32-NEXT: beqz a1, .LBB54_2
1717 ; RV32-NEXT: # %bb.1:
1718 ; RV32-NEXT: tail bar
1719 ; RV32-NEXT: .LBB54_2:
1722 ; RV64-LABEL: bit_32_nz_branch_i64:
1724 ; RV64-NEXT: slli a0, a0, 31
1725 ; RV64-NEXT: bgez a0, .LBB54_2
1726 ; RV64-NEXT: # %bb.1:
1727 ; RV64-NEXT: tail bar
1728 ; RV64-NEXT: .LBB54_2:
1730 %2 = and i64 %0, 4294967296
1731 %3 = icmp ne i64 %2, 0
1732 br i1 %3, label %4, label %5
1735 tail call void @bar()
1742 define void @bit_62_z_branch_i64(i64 %0) {
1743 ; RV32-LABEL: bit_62_z_branch_i64:
1745 ; RV32-NEXT: slli a1, a1, 1
1746 ; RV32-NEXT: bltz a1, .LBB55_2
1747 ; RV32-NEXT: # %bb.1:
1748 ; RV32-NEXT: tail bar
1749 ; RV32-NEXT: .LBB55_2:
1752 ; RV64-LABEL: bit_62_z_branch_i64:
1754 ; RV64-NEXT: slli a0, a0, 1
1755 ; RV64-NEXT: bltz a0, .LBB55_2
1756 ; RV64-NEXT: # %bb.1:
1757 ; RV64-NEXT: tail bar
1758 ; RV64-NEXT: .LBB55_2:
1760 %2 = and i64 %0, 4611686018427387904
1761 %3 = icmp eq i64 %2, 0
1762 br i1 %3, label %4, label %5
1765 tail call void @bar()
1772 define void @bit_62_nz_branch_i64(i64 %0) {
1773 ; RV32-LABEL: bit_62_nz_branch_i64:
1775 ; RV32-NEXT: slli a1, a1, 1
1776 ; RV32-NEXT: bgez a1, .LBB56_2
1777 ; RV32-NEXT: # %bb.1:
1778 ; RV32-NEXT: tail bar
1779 ; RV32-NEXT: .LBB56_2:
1782 ; RV64-LABEL: bit_62_nz_branch_i64:
1784 ; RV64-NEXT: slli a0, a0, 1
1785 ; RV64-NEXT: bgez a0, .LBB56_2
1786 ; RV64-NEXT: # %bb.1:
1787 ; RV64-NEXT: tail bar
1788 ; RV64-NEXT: .LBB56_2:
1790 %2 = and i64 %0, 4611686018427387904
1791 %3 = icmp ne i64 %2, 0
1792 br i1 %3, label %4, label %5
1795 tail call void @bar()
1802 define void @bit_63_z_branch_i64(i64 %0) {
1803 ; RV32-LABEL: bit_63_z_branch_i64:
1805 ; RV32-NEXT: bltz a1, .LBB57_2
1806 ; RV32-NEXT: # %bb.1:
1807 ; RV32-NEXT: tail bar
1808 ; RV32-NEXT: .LBB57_2:
1811 ; RV64-LABEL: bit_63_z_branch_i64:
1813 ; RV64-NEXT: bltz a0, .LBB57_2
1814 ; RV64-NEXT: # %bb.1:
1815 ; RV64-NEXT: tail bar
1816 ; RV64-NEXT: .LBB57_2:
1818 %2 = and i64 %0, 9223372036854775808
1819 %3 = icmp eq i64 %2, 0
1820 br i1 %3, label %4, label %5
1823 tail call void @bar()
1830 define void @bit_63_nz_branch_i64(i64 %0) {
1831 ; RV32-LABEL: bit_63_nz_branch_i64:
1833 ; RV32-NEXT: bgez a1, .LBB58_2
1834 ; RV32-NEXT: # %bb.1:
1835 ; RV32-NEXT: tail bar
1836 ; RV32-NEXT: .LBB58_2:
1839 ; RV64-LABEL: bit_63_nz_branch_i64:
1841 ; RV64-NEXT: bgez a0, .LBB58_2
1842 ; RV64-NEXT: # %bb.1:
1843 ; RV64-NEXT: tail bar
1844 ; RV64-NEXT: .LBB58_2:
1846 %2 = and i64 %0, 9223372036854775808
1847 %3 = icmp ne i64 %2, 0
1848 br i1 %3, label %4, label %5
1851 tail call void @bar()
1858 define signext i32 @bit_10_1_z_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
1859 ; CHECK-LABEL: bit_10_1_z_select_i32:
1861 ; CHECK-NEXT: andi a3, a0, 1023
1862 ; CHECK-NEXT: mv a0, a1
1863 ; CHECK-NEXT: beqz a3, .LBB59_2
1864 ; CHECK-NEXT: # %bb.1:
1865 ; CHECK-NEXT: mv a0, a2
1866 ; CHECK-NEXT: .LBB59_2:
1868 %1 = and i32 %a, 1023
1869 %2 = icmp eq i32 %1, 0
1870 %3 = select i1 %2, i32 %b, i32 %c
1874 define signext i32 @bit_10_1_nz_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
1875 ; CHECK-LABEL: bit_10_1_nz_select_i32:
1877 ; CHECK-NEXT: andi a3, a0, 1023
1878 ; CHECK-NEXT: mv a0, a1
1879 ; CHECK-NEXT: bnez a3, .LBB60_2
1880 ; CHECK-NEXT: # %bb.1:
1881 ; CHECK-NEXT: mv a0, a2
1882 ; CHECK-NEXT: .LBB60_2:
1884 %1 = and i32 %a, 1023
1885 %2 = icmp ne i32 %1, 0
1886 %3 = select i1 %2, i32 %b, i32 %c
1890 define signext i32 @bit_11_1_z_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
1891 ; CHECK-LABEL: bit_11_1_z_select_i32:
1893 ; CHECK-NEXT: andi a3, a0, 2047
1894 ; CHECK-NEXT: mv a0, a1
1895 ; CHECK-NEXT: beqz a3, .LBB61_2
1896 ; CHECK-NEXT: # %bb.1:
1897 ; CHECK-NEXT: mv a0, a2
1898 ; CHECK-NEXT: .LBB61_2:
1900 %1 = and i32 %a, 2047
1901 %2 = icmp eq i32 %1, 0
1902 %3 = select i1 %2, i32 %b, i32 %c
1906 define signext i32 @bit_11_1_nz_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
1907 ; CHECK-LABEL: bit_11_1_nz_select_i32:
1909 ; CHECK-NEXT: andi a3, a0, 2047
1910 ; CHECK-NEXT: mv a0, a1
1911 ; CHECK-NEXT: bnez a3, .LBB62_2
1912 ; CHECK-NEXT: # %bb.1:
1913 ; CHECK-NEXT: mv a0, a2
1914 ; CHECK-NEXT: .LBB62_2:
1916 %1 = and i32 %a, 2047
1917 %2 = icmp ne i32 %1, 0
1918 %3 = select i1 %2, i32 %b, i32 %c
1922 define signext i32 @bit_16_1_z_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
1923 ; RV32-LABEL: bit_16_1_z_select_i32:
1925 ; RV32-NEXT: slli a3, a0, 16
1926 ; RV32-NEXT: mv a0, a1
1927 ; RV32-NEXT: beqz a3, .LBB63_2
1928 ; RV32-NEXT: # %bb.1:
1929 ; RV32-NEXT: mv a0, a2
1930 ; RV32-NEXT: .LBB63_2:
1933 ; RV64-LABEL: bit_16_1_z_select_i32:
1935 ; RV64-NEXT: slli a3, a0, 48
1936 ; RV64-NEXT: mv a0, a1
1937 ; RV64-NEXT: beqz a3, .LBB63_2
1938 ; RV64-NEXT: # %bb.1:
1939 ; RV64-NEXT: mv a0, a2
1940 ; RV64-NEXT: .LBB63_2:
1942 %1 = and i32 %a, 65535
1943 %2 = icmp eq i32 %1, 0
1944 %3 = select i1 %2, i32 %b, i32 %c
1948 define signext i32 @bit_16_1_nz_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
1949 ; RV32-LABEL: bit_16_1_nz_select_i32:
1951 ; RV32-NEXT: slli a3, a0, 16
1952 ; RV32-NEXT: mv a0, a1
1953 ; RV32-NEXT: bnez a3, .LBB64_2
1954 ; RV32-NEXT: # %bb.1:
1955 ; RV32-NEXT: mv a0, a2
1956 ; RV32-NEXT: .LBB64_2:
1959 ; RV64-LABEL: bit_16_1_nz_select_i32:
1961 ; RV64-NEXT: slli a3, a0, 48
1962 ; RV64-NEXT: mv a0, a1
1963 ; RV64-NEXT: bnez a3, .LBB64_2
1964 ; RV64-NEXT: # %bb.1:
1965 ; RV64-NEXT: mv a0, a2
1966 ; RV64-NEXT: .LBB64_2:
1968 %1 = and i32 %a, 65535
1969 %2 = icmp ne i32 %1, 0
1970 %3 = select i1 %2, i32 %b, i32 %c
1974 define signext i32 @bit_20_1_z_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
1975 ; RV32-LABEL: bit_20_1_z_select_i32:
1977 ; RV32-NEXT: slli a3, a0, 12
1978 ; RV32-NEXT: mv a0, a1
1979 ; RV32-NEXT: beqz a3, .LBB65_2
1980 ; RV32-NEXT: # %bb.1:
1981 ; RV32-NEXT: mv a0, a2
1982 ; RV32-NEXT: .LBB65_2:
1985 ; RV64-LABEL: bit_20_1_z_select_i32:
1987 ; RV64-NEXT: slli a3, a0, 44
1988 ; RV64-NEXT: mv a0, a1
1989 ; RV64-NEXT: beqz a3, .LBB65_2
1990 ; RV64-NEXT: # %bb.1:
1991 ; RV64-NEXT: mv a0, a2
1992 ; RV64-NEXT: .LBB65_2:
1994 %1 = and i32 %a, 1048575
1995 %2 = icmp eq i32 %1, 0
1996 %3 = select i1 %2, i32 %b, i32 %c
2000 define signext i32 @bit_20_1_nz_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
2001 ; RV32-LABEL: bit_20_1_nz_select_i32:
2003 ; RV32-NEXT: slli a3, a0, 12
2004 ; RV32-NEXT: mv a0, a1
2005 ; RV32-NEXT: bnez a3, .LBB66_2
2006 ; RV32-NEXT: # %bb.1:
2007 ; RV32-NEXT: mv a0, a2
2008 ; RV32-NEXT: .LBB66_2:
2011 ; RV64-LABEL: bit_20_1_nz_select_i32:
2013 ; RV64-NEXT: slli a3, a0, 44
2014 ; RV64-NEXT: mv a0, a1
2015 ; RV64-NEXT: bnez a3, .LBB66_2
2016 ; RV64-NEXT: # %bb.1:
2017 ; RV64-NEXT: mv a0, a2
2018 ; RV64-NEXT: .LBB66_2:
2020 %1 = and i32 %a, 1048575
2021 %2 = icmp ne i32 %1, 0
2022 %3 = select i1 %2, i32 %b, i32 %c
2026 define signext i32 @bit_31_1_z_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
2027 ; RV32-LABEL: bit_31_1_z_select_i32:
2029 ; RV32-NEXT: slli a3, a0, 1
2030 ; RV32-NEXT: mv a0, a1
2031 ; RV32-NEXT: beqz a3, .LBB67_2
2032 ; RV32-NEXT: # %bb.1:
2033 ; RV32-NEXT: mv a0, a2
2034 ; RV32-NEXT: .LBB67_2:
2037 ; RV64-LABEL: bit_31_1_z_select_i32:
2039 ; RV64-NEXT: slli a3, a0, 33
2040 ; RV64-NEXT: mv a0, a1
2041 ; RV64-NEXT: beqz a3, .LBB67_2
2042 ; RV64-NEXT: # %bb.1:
2043 ; RV64-NEXT: mv a0, a2
2044 ; RV64-NEXT: .LBB67_2:
2046 %1 = and i32 %a, 2147483647
2047 %2 = icmp eq i32 %1, 0
2048 %3 = select i1 %2, i32 %b, i32 %c
2052 define signext i32 @bit_31_1_nz_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
2053 ; RV32-LABEL: bit_31_1_nz_select_i32:
2055 ; RV32-NEXT: slli a3, a0, 1
2056 ; RV32-NEXT: mv a0, a1
2057 ; RV32-NEXT: bnez a3, .LBB68_2
2058 ; RV32-NEXT: # %bb.1:
2059 ; RV32-NEXT: mv a0, a2
2060 ; RV32-NEXT: .LBB68_2:
2063 ; RV64-LABEL: bit_31_1_nz_select_i32:
2065 ; RV64-NEXT: slli a3, a0, 33
2066 ; RV64-NEXT: mv a0, a1
2067 ; RV64-NEXT: bnez a3, .LBB68_2
2068 ; RV64-NEXT: # %bb.1:
2069 ; RV64-NEXT: mv a0, a2
2070 ; RV64-NEXT: .LBB68_2:
2072 %1 = and i32 %a, 2147483647
2073 %2 = icmp ne i32 %1, 0
2074 %3 = select i1 %2, i32 %b, i32 %c
2078 define signext i32 @bit_32_1_z_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
2079 ; CHECK-LABEL: bit_32_1_z_select_i32:
2081 ; CHECK-NEXT: beqz a0, .LBB69_2
2082 ; CHECK-NEXT: # %bb.1:
2083 ; CHECK-NEXT: mv a1, a2
2084 ; CHECK-NEXT: .LBB69_2:
2085 ; CHECK-NEXT: mv a0, a1
2087 %1 = and i32 %a, 4294967295
2088 %2 = icmp eq i32 %1, 0
2089 %3 = select i1 %2, i32 %b, i32 %c
2093 define signext i32 @bit_32_1_nz_select_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
2094 ; CHECK-LABEL: bit_32_1_nz_select_i32:
2096 ; CHECK-NEXT: bnez a0, .LBB70_2
2097 ; CHECK-NEXT: # %bb.1:
2098 ; CHECK-NEXT: mv a1, a2
2099 ; CHECK-NEXT: .LBB70_2:
2100 ; CHECK-NEXT: mv a0, a1
2102 %1 = and i32 %a, 4294967295
2103 %2 = icmp ne i32 %1, 0
2104 %3 = select i1 %2, i32 %b, i32 %c
2108 define i64 @bit_10_1_z_select_i64(i64 %a, i64 %b, i64 %c) {
2109 ; RV32-LABEL: bit_10_1_z_select_i64:
2111 ; RV32-NEXT: andi a6, a0, 1023
2112 ; RV32-NEXT: mv a1, a3
2113 ; RV32-NEXT: mv a0, a2
2114 ; RV32-NEXT: beqz a6, .LBB71_2
2115 ; RV32-NEXT: # %bb.1:
2116 ; RV32-NEXT: mv a0, a4
2117 ; RV32-NEXT: mv a1, a5
2118 ; RV32-NEXT: .LBB71_2:
2121 ; RV64-LABEL: bit_10_1_z_select_i64:
2123 ; RV64-NEXT: andi a3, a0, 1023
2124 ; RV64-NEXT: mv a0, a1
2125 ; RV64-NEXT: beqz a3, .LBB71_2
2126 ; RV64-NEXT: # %bb.1:
2127 ; RV64-NEXT: mv a0, a2
2128 ; RV64-NEXT: .LBB71_2:
2130 %1 = and i64 %a, 1023
2131 %2 = icmp eq i64 %1, 0
2132 %3 = select i1 %2, i64 %b, i64 %c
2136 define i64 @bit_10_1_nz_select_i64(i64 %a, i64 %b, i64 %c) {
2137 ; RV32-LABEL: bit_10_1_nz_select_i64:
2139 ; RV32-NEXT: andi a6, a0, 1023
2140 ; RV32-NEXT: mv a1, a3
2141 ; RV32-NEXT: mv a0, a2
2142 ; RV32-NEXT: bnez a6, .LBB72_2
2143 ; RV32-NEXT: # %bb.1:
2144 ; RV32-NEXT: mv a0, a4
2145 ; RV32-NEXT: mv a1, a5
2146 ; RV32-NEXT: .LBB72_2:
2149 ; RV64-LABEL: bit_10_1_nz_select_i64:
2151 ; RV64-NEXT: andi a3, a0, 1023
2152 ; RV64-NEXT: mv a0, a1
2153 ; RV64-NEXT: bnez a3, .LBB72_2
2154 ; RV64-NEXT: # %bb.1:
2155 ; RV64-NEXT: mv a0, a2
2156 ; RV64-NEXT: .LBB72_2:
2158 %1 = and i64 %a, 1023
2159 %2 = icmp ne i64 %1, 0
2160 %3 = select i1 %2, i64 %b, i64 %c
2164 define i64 @bit_11_1_z_select_i64(i64 %a, i64 %b, i64 %c) {
2165 ; RV32-LABEL: bit_11_1_z_select_i64:
2167 ; RV32-NEXT: andi a6, a0, 2047
2168 ; RV32-NEXT: mv a1, a3
2169 ; RV32-NEXT: mv a0, a2
2170 ; RV32-NEXT: beqz a6, .LBB73_2
2171 ; RV32-NEXT: # %bb.1:
2172 ; RV32-NEXT: mv a0, a4
2173 ; RV32-NEXT: mv a1, a5
2174 ; RV32-NEXT: .LBB73_2:
2177 ; RV64-LABEL: bit_11_1_z_select_i64:
2179 ; RV64-NEXT: andi a3, a0, 2047
2180 ; RV64-NEXT: mv a0, a1
2181 ; RV64-NEXT: beqz a3, .LBB73_2
2182 ; RV64-NEXT: # %bb.1:
2183 ; RV64-NEXT: mv a0, a2
2184 ; RV64-NEXT: .LBB73_2:
2186 %1 = and i64 %a, 2047
2187 %2 = icmp eq i64 %1, 0
2188 %3 = select i1 %2, i64 %b, i64 %c
2192 define i64 @bit_11_1_nz_select_i64(i64 %a, i64 %b, i64 %c) {
2193 ; RV32-LABEL: bit_11_1_nz_select_i64:
2195 ; RV32-NEXT: andi a6, a0, 2047
2196 ; RV32-NEXT: mv a1, a3
2197 ; RV32-NEXT: mv a0, a2
2198 ; RV32-NEXT: bnez a6, .LBB74_2
2199 ; RV32-NEXT: # %bb.1:
2200 ; RV32-NEXT: mv a0, a4
2201 ; RV32-NEXT: mv a1, a5
2202 ; RV32-NEXT: .LBB74_2:
2205 ; RV64-LABEL: bit_11_1_nz_select_i64:
2207 ; RV64-NEXT: andi a3, a0, 2047
2208 ; RV64-NEXT: mv a0, a1
2209 ; RV64-NEXT: bnez a3, .LBB74_2
2210 ; RV64-NEXT: # %bb.1:
2211 ; RV64-NEXT: mv a0, a2
2212 ; RV64-NEXT: .LBB74_2:
2214 %1 = and i64 %a, 2047
2215 %2 = icmp ne i64 %1, 0
2216 %3 = select i1 %2, i64 %b, i64 %c
2220 define i64 @bit_16_1_z_select_i64(i64 %a, i64 %b, i64 %c) {
2221 ; RV32-LABEL: bit_16_1_z_select_i64:
2223 ; RV32-NEXT: slli a6, a0, 16
2224 ; RV32-NEXT: mv a1, a3
2225 ; RV32-NEXT: mv a0, a2
2226 ; RV32-NEXT: beqz a6, .LBB75_2
2227 ; RV32-NEXT: # %bb.1:
2228 ; RV32-NEXT: mv a0, a4
2229 ; RV32-NEXT: mv a1, a5
2230 ; RV32-NEXT: .LBB75_2:
2233 ; RV64-LABEL: bit_16_1_z_select_i64:
2235 ; RV64-NEXT: slli a3, a0, 48
2236 ; RV64-NEXT: mv a0, a1
2237 ; RV64-NEXT: beqz a3, .LBB75_2
2238 ; RV64-NEXT: # %bb.1:
2239 ; RV64-NEXT: mv a0, a2
2240 ; RV64-NEXT: .LBB75_2:
2242 %1 = and i64 %a, 65535
2243 %2 = icmp eq i64 %1, 0
2244 %3 = select i1 %2, i64 %b, i64 %c
2248 define i64 @bit_16_1_nz_select_i64(i64 %a, i64 %b, i64 %c) {
2249 ; RV32-LABEL: bit_16_1_nz_select_i64:
2251 ; RV32-NEXT: mv a1, a3
2252 ; RV32-NEXT: bnez a0, .LBB76_2
2253 ; RV32-NEXT: # %bb.1:
2254 ; RV32-NEXT: mv a2, a4
2255 ; RV32-NEXT: mv a1, a5
2256 ; RV32-NEXT: .LBB76_2:
2257 ; RV32-NEXT: mv a0, a2
2260 ; RV64-LABEL: bit_16_1_nz_select_i64:
2262 ; RV64-NEXT: sext.w a3, a0
2263 ; RV64-NEXT: mv a0, a1
2264 ; RV64-NEXT: bnez a3, .LBB76_2
2265 ; RV64-NEXT: # %bb.1:
2266 ; RV64-NEXT: mv a0, a2
2267 ; RV64-NEXT: .LBB76_2:
2269 %1 = and i64 %a, 4294967295
2270 %2 = icmp ne i64 %1, 0
2271 %3 = select i1 %2, i64 %b, i64 %c
2276 define i64 @bit_20_1_z_select_i64(i64 %a, i64 %b, i64 %c) {
2277 ; RV32-LABEL: bit_20_1_z_select_i64:
2279 ; RV32-NEXT: slli a6, a0, 12
2280 ; RV32-NEXT: mv a1, a3
2281 ; RV32-NEXT: mv a0, a2
2282 ; RV32-NEXT: beqz a6, .LBB77_2
2283 ; RV32-NEXT: # %bb.1:
2284 ; RV32-NEXT: mv a0, a4
2285 ; RV32-NEXT: mv a1, a5
2286 ; RV32-NEXT: .LBB77_2:
2289 ; RV64-LABEL: bit_20_1_z_select_i64:
2291 ; RV64-NEXT: slli a3, a0, 44
2292 ; RV64-NEXT: mv a0, a1
2293 ; RV64-NEXT: beqz a3, .LBB77_2
2294 ; RV64-NEXT: # %bb.1:
2295 ; RV64-NEXT: mv a0, a2
2296 ; RV64-NEXT: .LBB77_2:
2298 %1 = and i64 %a, 1048575
2299 %2 = icmp eq i64 %1, 0
2300 %3 = select i1 %2, i64 %b, i64 %c
2304 define i64 @bit_20_1_nz_select_i64(i64 %a, i64 %b, i64 %c) {
2305 ; RV32-LABEL: bit_20_1_nz_select_i64:
2307 ; RV32-NEXT: slli a6, a0, 12
2308 ; RV32-NEXT: mv a1, a3
2309 ; RV32-NEXT: mv a0, a2
2310 ; RV32-NEXT: bnez a6, .LBB78_2
2311 ; RV32-NEXT: # %bb.1:
2312 ; RV32-NEXT: mv a0, a4
2313 ; RV32-NEXT: mv a1, a5
2314 ; RV32-NEXT: .LBB78_2:
2317 ; RV64-LABEL: bit_20_1_nz_select_i64:
2319 ; RV64-NEXT: slli a3, a0, 44
2320 ; RV64-NEXT: mv a0, a1
2321 ; RV64-NEXT: bnez a3, .LBB78_2
2322 ; RV64-NEXT: # %bb.1:
2323 ; RV64-NEXT: mv a0, a2
2324 ; RV64-NEXT: .LBB78_2:
2326 %1 = and i64 %a, 1048575
2327 %2 = icmp ne i64 %1, 0
2328 %3 = select i1 %2, i64 %b, i64 %c
2332 define i64 @bit_31_1_z_select_i64(i64 %a, i64 %b, i64 %c) {
2333 ; RV32-LABEL: bit_31_1_z_select_i64:
2335 ; RV32-NEXT: slli a6, a0, 1
2336 ; RV32-NEXT: mv a1, a3
2337 ; RV32-NEXT: mv a0, a2
2338 ; RV32-NEXT: beqz a6, .LBB79_2
2339 ; RV32-NEXT: # %bb.1:
2340 ; RV32-NEXT: mv a0, a4
2341 ; RV32-NEXT: mv a1, a5
2342 ; RV32-NEXT: .LBB79_2:
2345 ; RV64-LABEL: bit_31_1_z_select_i64:
2347 ; RV64-NEXT: slli a3, a0, 33
2348 ; RV64-NEXT: mv a0, a1
2349 ; RV64-NEXT: beqz a3, .LBB79_2
2350 ; RV64-NEXT: # %bb.1:
2351 ; RV64-NEXT: mv a0, a2
2352 ; RV64-NEXT: .LBB79_2:
2354 %1 = and i64 %a, 2147483647
2355 %2 = icmp eq i64 %1, 0
2356 %3 = select i1 %2, i64 %b, i64 %c
2360 define i64 @bit_31_1_nz_select_i64(i64 %a, i64 %b, i64 %c) {
2361 ; RV32-LABEL: bit_31_1_nz_select_i64:
2363 ; RV32-NEXT: slli a6, a0, 1
2364 ; RV32-NEXT: mv a1, a3
2365 ; RV32-NEXT: mv a0, a2
2366 ; RV32-NEXT: bnez a6, .LBB80_2
2367 ; RV32-NEXT: # %bb.1:
2368 ; RV32-NEXT: mv a0, a4
2369 ; RV32-NEXT: mv a1, a5
2370 ; RV32-NEXT: .LBB80_2:
2373 ; RV64-LABEL: bit_31_1_nz_select_i64:
2375 ; RV64-NEXT: slli a3, a0, 33
2376 ; RV64-NEXT: mv a0, a1
2377 ; RV64-NEXT: bnez a3, .LBB80_2
2378 ; RV64-NEXT: # %bb.1:
2379 ; RV64-NEXT: mv a0, a2
2380 ; RV64-NEXT: .LBB80_2:
2382 %1 = and i64 %a, 2147483647
2383 %2 = icmp ne i64 %1, 0
2384 %3 = select i1 %2, i64 %b, i64 %c
2388 define i64 @bit_32_1_z_select_i64(i64 %a, i64 %b, i64 %c) {
2389 ; RV32-LABEL: bit_32_1_z_select_i64:
2391 ; RV32-NEXT: mv a1, a3
2392 ; RV32-NEXT: beqz a0, .LBB81_2
2393 ; RV32-NEXT: # %bb.1:
2394 ; RV32-NEXT: mv a2, a4
2395 ; RV32-NEXT: mv a1, a5
2396 ; RV32-NEXT: .LBB81_2:
2397 ; RV32-NEXT: mv a0, a2
2400 ; RV64-LABEL: bit_32_1_z_select_i64:
2402 ; RV64-NEXT: sext.w a3, a0
2403 ; RV64-NEXT: mv a0, a1
2404 ; RV64-NEXT: beqz a3, .LBB81_2
2405 ; RV64-NEXT: # %bb.1:
2406 ; RV64-NEXT: mv a0, a2
2407 ; RV64-NEXT: .LBB81_2:
2409 %1 = and i64 %a, 4294967295
2410 %2 = icmp eq i64 %1, 0
2411 %3 = select i1 %2, i64 %b, i64 %c
2415 define i64 @bit_32_1_nz_select_i64(i64 %a, i64 %b, i64 %c) {
2416 ; RV32-LABEL: bit_32_1_nz_select_i64:
2418 ; RV32-NEXT: mv a1, a3
2419 ; RV32-NEXT: bnez a0, .LBB82_2
2420 ; RV32-NEXT: # %bb.1:
2421 ; RV32-NEXT: mv a2, a4
2422 ; RV32-NEXT: mv a1, a5
2423 ; RV32-NEXT: .LBB82_2:
2424 ; RV32-NEXT: mv a0, a2
2427 ; RV64-LABEL: bit_32_1_nz_select_i64:
2429 ; RV64-NEXT: sext.w a3, a0
2430 ; RV64-NEXT: mv a0, a1
2431 ; RV64-NEXT: bnez a3, .LBB82_2
2432 ; RV64-NEXT: # %bb.1:
2433 ; RV64-NEXT: mv a0, a2
2434 ; RV64-NEXT: .LBB82_2:
2436 %1 = and i64 %a, 4294967295
2437 %2 = icmp ne i64 %1, 0
2438 %3 = select i1 %2, i64 %b, i64 %c
2442 define i64 @bit_55_1_z_select_i64(i64 %a, i64 %b, i64 %c) {
2443 ; RV32-LABEL: bit_55_1_z_select_i64:
2445 ; RV32-NEXT: slli a1, a1, 9
2446 ; RV32-NEXT: srli a1, a1, 9
2447 ; RV32-NEXT: or a6, a0, a1
2448 ; RV32-NEXT: mv a1, a3
2449 ; RV32-NEXT: mv a0, a2
2450 ; RV32-NEXT: beqz a6, .LBB83_2
2451 ; RV32-NEXT: # %bb.1:
2452 ; RV32-NEXT: mv a0, a4
2453 ; RV32-NEXT: mv a1, a5
2454 ; RV32-NEXT: .LBB83_2:
2457 ; RV64-LABEL: bit_55_1_z_select_i64:
2459 ; RV64-NEXT: slli a3, a0, 9
2460 ; RV64-NEXT: mv a0, a1
2461 ; RV64-NEXT: beqz a3, .LBB83_2
2462 ; RV64-NEXT: # %bb.1:
2463 ; RV64-NEXT: mv a0, a2
2464 ; RV64-NEXT: .LBB83_2:
2466 %1 = and i64 %a, 36028797018963967
2467 %2 = icmp eq i64 %1, 0
2468 %3 = select i1 %2, i64 %b, i64 %c
2472 define i64 @bit_55_1_nz_select_i64(i64 %a, i64 %b, i64 %c) {
2473 ; RV32-LABEL: bit_55_1_nz_select_i64:
2475 ; RV32-NEXT: slli a1, a1, 9
2476 ; RV32-NEXT: srli a1, a1, 9
2477 ; RV32-NEXT: or a6, a0, a1
2478 ; RV32-NEXT: mv a1, a3
2479 ; RV32-NEXT: mv a0, a2
2480 ; RV32-NEXT: bnez a6, .LBB84_2
2481 ; RV32-NEXT: # %bb.1:
2482 ; RV32-NEXT: mv a0, a4
2483 ; RV32-NEXT: mv a1, a5
2484 ; RV32-NEXT: .LBB84_2:
2487 ; RV64-LABEL: bit_55_1_nz_select_i64:
2489 ; RV64-NEXT: slli a3, a0, 9
2490 ; RV64-NEXT: mv a0, a1
2491 ; RV64-NEXT: bnez a3, .LBB84_2
2492 ; RV64-NEXT: # %bb.1:
2493 ; RV64-NEXT: mv a0, a2
2494 ; RV64-NEXT: .LBB84_2:
2496 %1 = and i64 %a, 36028797018963967
2497 %2 = icmp ne i64 %1, 0
2498 %3 = select i1 %2, i64 %b, i64 %c
2502 define i64 @bit_63_1_z_select_i64(i64 %a, i64 %b, i64 %c) {
2503 ; RV32I-LABEL: bit_63_1_z_select_i64:
2505 ; RV32I-NEXT: slli a1, a1, 1
2506 ; RV32I-NEXT: srli a1, a1, 1
2507 ; RV32I-NEXT: or a6, a0, a1
2508 ; RV32I-NEXT: mv a1, a3
2509 ; RV32I-NEXT: mv a0, a2
2510 ; RV32I-NEXT: beqz a6, .LBB85_2
2511 ; RV32I-NEXT: # %bb.1:
2512 ; RV32I-NEXT: mv a0, a4
2513 ; RV32I-NEXT: mv a1, a5
2514 ; RV32I-NEXT: .LBB85_2:
2517 ; RV64-LABEL: bit_63_1_z_select_i64:
2519 ; RV64-NEXT: slli a3, a0, 1
2520 ; RV64-NEXT: mv a0, a1
2521 ; RV64-NEXT: beqz a3, .LBB85_2
2522 ; RV64-NEXT: # %bb.1:
2523 ; RV64-NEXT: mv a0, a2
2524 ; RV64-NEXT: .LBB85_2:
2527 ; RV32ZBS-LABEL: bit_63_1_z_select_i64:
2529 ; RV32ZBS-NEXT: bclri a1, a1, 31
2530 ; RV32ZBS-NEXT: or a6, a0, a1
2531 ; RV32ZBS-NEXT: mv a1, a3
2532 ; RV32ZBS-NEXT: mv a0, a2
2533 ; RV32ZBS-NEXT: beqz a6, .LBB85_2
2534 ; RV32ZBS-NEXT: # %bb.1:
2535 ; RV32ZBS-NEXT: mv a0, a4
2536 ; RV32ZBS-NEXT: mv a1, a5
2537 ; RV32ZBS-NEXT: .LBB85_2:
2540 ; RV32XTHEADBS-LABEL: bit_63_1_z_select_i64:
2541 ; RV32XTHEADBS: # %bb.0:
2542 ; RV32XTHEADBS-NEXT: slli a1, a1, 1
2543 ; RV32XTHEADBS-NEXT: srli a1, a1, 1
2544 ; RV32XTHEADBS-NEXT: or a6, a0, a1
2545 ; RV32XTHEADBS-NEXT: mv a1, a3
2546 ; RV32XTHEADBS-NEXT: mv a0, a2
2547 ; RV32XTHEADBS-NEXT: beqz a6, .LBB85_2
2548 ; RV32XTHEADBS-NEXT: # %bb.1:
2549 ; RV32XTHEADBS-NEXT: mv a0, a4
2550 ; RV32XTHEADBS-NEXT: mv a1, a5
2551 ; RV32XTHEADBS-NEXT: .LBB85_2:
2552 ; RV32XTHEADBS-NEXT: ret
2553 %1 = and i64 %a, 9223372036854775807
2554 %2 = icmp eq i64 %1, 0
2555 %3 = select i1 %2, i64 %b, i64 %c
2559 define i64 @bit_63_1_nz_select_i64(i64 %a, i64 %b, i64 %c) {
2560 ; RV32I-LABEL: bit_63_1_nz_select_i64:
2562 ; RV32I-NEXT: slli a1, a1, 1
2563 ; RV32I-NEXT: srli a1, a1, 1
2564 ; RV32I-NEXT: or a6, a0, a1
2565 ; RV32I-NEXT: mv a1, a3
2566 ; RV32I-NEXT: mv a0, a2
2567 ; RV32I-NEXT: bnez a6, .LBB86_2
2568 ; RV32I-NEXT: # %bb.1:
2569 ; RV32I-NEXT: mv a0, a4
2570 ; RV32I-NEXT: mv a1, a5
2571 ; RV32I-NEXT: .LBB86_2:
2574 ; RV64-LABEL: bit_63_1_nz_select_i64:
2576 ; RV64-NEXT: slli a3, a0, 1
2577 ; RV64-NEXT: mv a0, a1
2578 ; RV64-NEXT: bnez a3, .LBB86_2
2579 ; RV64-NEXT: # %bb.1:
2580 ; RV64-NEXT: mv a0, a2
2581 ; RV64-NEXT: .LBB86_2:
2584 ; RV32ZBS-LABEL: bit_63_1_nz_select_i64:
2586 ; RV32ZBS-NEXT: bclri a1, a1, 31
2587 ; RV32ZBS-NEXT: or a6, a0, a1
2588 ; RV32ZBS-NEXT: mv a1, a3
2589 ; RV32ZBS-NEXT: mv a0, a2
2590 ; RV32ZBS-NEXT: bnez a6, .LBB86_2
2591 ; RV32ZBS-NEXT: # %bb.1:
2592 ; RV32ZBS-NEXT: mv a0, a4
2593 ; RV32ZBS-NEXT: mv a1, a5
2594 ; RV32ZBS-NEXT: .LBB86_2:
2597 ; RV32XTHEADBS-LABEL: bit_63_1_nz_select_i64:
2598 ; RV32XTHEADBS: # %bb.0:
2599 ; RV32XTHEADBS-NEXT: slli a1, a1, 1
2600 ; RV32XTHEADBS-NEXT: srli a1, a1, 1
2601 ; RV32XTHEADBS-NEXT: or a6, a0, a1
2602 ; RV32XTHEADBS-NEXT: mv a1, a3
2603 ; RV32XTHEADBS-NEXT: mv a0, a2
2604 ; RV32XTHEADBS-NEXT: bnez a6, .LBB86_2
2605 ; RV32XTHEADBS-NEXT: # %bb.1:
2606 ; RV32XTHEADBS-NEXT: mv a0, a4
2607 ; RV32XTHEADBS-NEXT: mv a1, a5
2608 ; RV32XTHEADBS-NEXT: .LBB86_2:
2609 ; RV32XTHEADBS-NEXT: ret
2610 %1 = and i64 %a, 9223372036854775807
2611 %2 = icmp ne i64 %1, 0
2612 %3 = select i1 %2, i64 %b, i64 %c
2616 define i64 @bit_64_1_z_select_i64(i64 %a, i64 %b, i64 %c) {
2617 ; RV32-LABEL: bit_64_1_z_select_i64:
2619 ; RV32-NEXT: or a6, a0, a1
2620 ; RV32-NEXT: mv a1, a3
2621 ; RV32-NEXT: mv a0, a2
2622 ; RV32-NEXT: beqz a6, .LBB87_2
2623 ; RV32-NEXT: # %bb.1:
2624 ; RV32-NEXT: mv a0, a4
2625 ; RV32-NEXT: mv a1, a5
2626 ; RV32-NEXT: .LBB87_2:
2629 ; RV64-LABEL: bit_64_1_z_select_i64:
2631 ; RV64-NEXT: beqz a0, .LBB87_2
2632 ; RV64-NEXT: # %bb.1:
2633 ; RV64-NEXT: mv a1, a2
2634 ; RV64-NEXT: .LBB87_2:
2635 ; RV64-NEXT: mv a0, a1
2637 %1 = and i64 %a, 18446744073709551615
2638 %2 = icmp eq i64 %1, 0
2639 %3 = select i1 %2, i64 %b, i64 %c
2643 define i64 @bit_64_1_nz_select_i64(i64 %a, i64 %b, i64 %c) {
2644 ; RV32-LABEL: bit_64_1_nz_select_i64:
2646 ; RV32-NEXT: or a6, a0, a1
2647 ; RV32-NEXT: mv a1, a3
2648 ; RV32-NEXT: mv a0, a2
2649 ; RV32-NEXT: bnez a6, .LBB88_2
2650 ; RV32-NEXT: # %bb.1:
2651 ; RV32-NEXT: mv a0, a4
2652 ; RV32-NEXT: mv a1, a5
2653 ; RV32-NEXT: .LBB88_2:
2656 ; RV64-LABEL: bit_64_1_nz_select_i64:
2658 ; RV64-NEXT: bnez a0, .LBB88_2
2659 ; RV64-NEXT: # %bb.1:
2660 ; RV64-NEXT: mv a1, a2
2661 ; RV64-NEXT: .LBB88_2:
2662 ; RV64-NEXT: mv a0, a1
2664 %1 = and i64 %a, 18446744073709551615
2665 %2 = icmp ne i64 %1, 0
2666 %3 = select i1 %2, i64 %b, i64 %c
2670 define void @bit_10_1_z_branch_i32(i32 signext %0) {
2671 ; CHECK-LABEL: bit_10_1_z_branch_i32:
2673 ; CHECK-NEXT: andi a0, a0, 1023
2674 ; CHECK-NEXT: beqz a0, .LBB89_2
2675 ; CHECK-NEXT: # %bb.1:
2677 ; CHECK-NEXT: .LBB89_2:
2678 ; CHECK-NEXT: tail bar
2679 %2 = and i32 %0, 1023
2680 %3 = icmp eq i32 %2, 0
2681 br i1 %3, label %4, label %5
2684 tail call void @bar()
2691 define void @bit_10_1_nz_branch_i32(i32 signext %0) {
2692 ; CHECK-LABEL: bit_10_1_nz_branch_i32:
2694 ; CHECK-NEXT: andi a0, a0, 1023
2695 ; CHECK-NEXT: beqz a0, .LBB90_2
2696 ; CHECK-NEXT: # %bb.1:
2697 ; CHECK-NEXT: tail bar
2698 ; CHECK-NEXT: .LBB90_2:
2700 %2 = and i32 %0, 1023
2701 %3 = icmp ne i32 %2, 0
2702 br i1 %3, label %4, label %5
2705 tail call void @bar()
2712 define void @bit_11_1_z_branch_i32(i32 signext %0) {
2713 ; CHECK-LABEL: bit_11_1_z_branch_i32:
2715 ; CHECK-NEXT: andi a0, a0, 2047
2716 ; CHECK-NEXT: beqz a0, .LBB91_2
2717 ; CHECK-NEXT: # %bb.1:
2719 ; CHECK-NEXT: .LBB91_2:
2720 ; CHECK-NEXT: tail bar
2721 %2 = and i32 %0, 2047
2722 %3 = icmp eq i32 %2, 0
2723 br i1 %3, label %4, label %5
2726 tail call void @bar()
2733 define void @bit_11_1_nz_branch_i32(i32 signext %0) {
2734 ; CHECK-LABEL: bit_11_1_nz_branch_i32:
2736 ; CHECK-NEXT: andi a0, a0, 2047
2737 ; CHECK-NEXT: beqz a0, .LBB92_2
2738 ; CHECK-NEXT: # %bb.1:
2739 ; CHECK-NEXT: tail bar
2740 ; CHECK-NEXT: .LBB92_2:
2742 %2 = and i32 %0, 2047
2743 %3 = icmp ne i32 %2, 0
2744 br i1 %3, label %4, label %5
2747 tail call void @bar()
2754 define void @bit_16_1_z_branch_i32(i32 signext %0) {
2755 ; RV32-LABEL: bit_16_1_z_branch_i32:
2757 ; RV32-NEXT: slli a0, a0, 16
2758 ; RV32-NEXT: beqz a0, .LBB93_2
2759 ; RV32-NEXT: # %bb.1:
2761 ; RV32-NEXT: .LBB93_2:
2762 ; RV32-NEXT: tail bar
2764 ; RV64-LABEL: bit_16_1_z_branch_i32:
2766 ; RV64-NEXT: slli a0, a0, 48
2767 ; RV64-NEXT: beqz a0, .LBB93_2
2768 ; RV64-NEXT: # %bb.1:
2770 ; RV64-NEXT: .LBB93_2:
2771 ; RV64-NEXT: tail bar
2772 %2 = and i32 %0, 65535
2773 %3 = icmp eq i32 %2, 0
2774 br i1 %3, label %4, label %5
2777 tail call void @bar()
2784 define void @bit_16_1_nz_branch_i32(i32 signext %0) {
2785 ; RV32-LABEL: bit_16_1_nz_branch_i32:
2787 ; RV32-NEXT: slli a0, a0, 16
2788 ; RV32-NEXT: beqz a0, .LBB94_2
2789 ; RV32-NEXT: # %bb.1:
2790 ; RV32-NEXT: tail bar
2791 ; RV32-NEXT: .LBB94_2:
2794 ; RV64-LABEL: bit_16_1_nz_branch_i32:
2796 ; RV64-NEXT: slli a0, a0, 48
2797 ; RV64-NEXT: beqz a0, .LBB94_2
2798 ; RV64-NEXT: # %bb.1:
2799 ; RV64-NEXT: tail bar
2800 ; RV64-NEXT: .LBB94_2:
2802 %2 = and i32 %0, 65535
2803 %3 = icmp ne i32 %2, 0
2804 br i1 %3, label %4, label %5
2807 tail call void @bar()
2814 define void @bit_24_1_z_branch_i32(i32 signext %0) {
2815 ; RV32-LABEL: bit_24_1_z_branch_i32:
2817 ; RV32-NEXT: slli a0, a0, 8
2818 ; RV32-NEXT: beqz a0, .LBB95_2
2819 ; RV32-NEXT: # %bb.1:
2821 ; RV32-NEXT: .LBB95_2:
2822 ; RV32-NEXT: tail bar
2824 ; RV64-LABEL: bit_24_1_z_branch_i32:
2826 ; RV64-NEXT: slli a0, a0, 40
2827 ; RV64-NEXT: beqz a0, .LBB95_2
2828 ; RV64-NEXT: # %bb.1:
2830 ; RV64-NEXT: .LBB95_2:
2831 ; RV64-NEXT: tail bar
2832 %2 = and i32 %0, 16777215
2833 %3 = icmp eq i32 %2, 0
2834 br i1 %3, label %4, label %5
2837 tail call void @bar()
2844 define void @bit_24_1_nz_branch_i32(i32 signext %0) {
2845 ; RV32-LABEL: bit_24_1_nz_branch_i32:
2847 ; RV32-NEXT: slli a0, a0, 8
2848 ; RV32-NEXT: beqz a0, .LBB96_2
2849 ; RV32-NEXT: # %bb.1:
2850 ; RV32-NEXT: tail bar
2851 ; RV32-NEXT: .LBB96_2:
2854 ; RV64-LABEL: bit_24_1_nz_branch_i32:
2856 ; RV64-NEXT: slli a0, a0, 40
2857 ; RV64-NEXT: beqz a0, .LBB96_2
2858 ; RV64-NEXT: # %bb.1:
2859 ; RV64-NEXT: tail bar
2860 ; RV64-NEXT: .LBB96_2:
2862 %2 = and i32 %0, 16777215
2863 %3 = icmp ne i32 %2, 0
2864 br i1 %3, label %4, label %5
2867 tail call void @bar()
2874 define void @bit_31_1_z_branch_i32(i32 signext %0) {
2875 ; RV32-LABEL: bit_31_1_z_branch_i32:
2877 ; RV32-NEXT: slli a0, a0, 1
2878 ; RV32-NEXT: beqz a0, .LBB97_2
2879 ; RV32-NEXT: # %bb.1:
2881 ; RV32-NEXT: .LBB97_2:
2882 ; RV32-NEXT: tail bar
2884 ; RV64-LABEL: bit_31_1_z_branch_i32:
2886 ; RV64-NEXT: slli a0, a0, 33
2887 ; RV64-NEXT: beqz a0, .LBB97_2
2888 ; RV64-NEXT: # %bb.1:
2890 ; RV64-NEXT: .LBB97_2:
2891 ; RV64-NEXT: tail bar
2892 %2 = and i32 %0, 2147483647
2893 %3 = icmp eq i32 %2, 0
2894 br i1 %3, label %4, label %5
2897 tail call void @bar()
2904 define void @bit_31_1_nz_branch_i32(i32 signext %0) {
2905 ; RV32-LABEL: bit_31_1_nz_branch_i32:
2907 ; RV32-NEXT: slli a0, a0, 1
2908 ; RV32-NEXT: beqz a0, .LBB98_2
2909 ; RV32-NEXT: # %bb.1:
2910 ; RV32-NEXT: tail bar
2911 ; RV32-NEXT: .LBB98_2:
2914 ; RV64-LABEL: bit_31_1_nz_branch_i32:
2916 ; RV64-NEXT: slli a0, a0, 33
2917 ; RV64-NEXT: beqz a0, .LBB98_2
2918 ; RV64-NEXT: # %bb.1:
2919 ; RV64-NEXT: tail bar
2920 ; RV64-NEXT: .LBB98_2:
2922 %2 = and i32 %0, 2147483647
2923 %3 = icmp ne i32 %2, 0
2924 br i1 %3, label %4, label %5
2927 tail call void @bar()
2934 define void @bit_32_1_z_branch_i32(i32 signext %0) {
2935 ; CHECK-LABEL: bit_32_1_z_branch_i32:
2937 ; CHECK-NEXT: beqz a0, .LBB99_2
2938 ; CHECK-NEXT: # %bb.1:
2940 ; CHECK-NEXT: .LBB99_2:
2941 ; CHECK-NEXT: tail bar
2942 %2 = and i32 %0, 4294967295
2943 %3 = icmp eq i32 %2, 0
2944 br i1 %3, label %4, label %5
2947 tail call void @bar()
2954 define void @bit_32_1_nz_branch_i32(i32 signext %0) {
2955 ; CHECK-LABEL: bit_32_1_nz_branch_i32:
2957 ; CHECK-NEXT: beqz a0, .LBB100_2
2958 ; CHECK-NEXT: # %bb.1:
2959 ; CHECK-NEXT: tail bar
2960 ; CHECK-NEXT: .LBB100_2:
2962 %2 = and i32 %0, 4294967295
2963 %3 = icmp ne i32 %2, 0
2964 br i1 %3, label %4, label %5
2967 tail call void @bar()
2975 define void @bit_10_1_z_branch_i64(i64 %0) {
2976 ; CHECK-LABEL: bit_10_1_z_branch_i64:
2978 ; CHECK-NEXT: andi a0, a0, 1023
2979 ; CHECK-NEXT: beqz a0, .LBB101_2
2980 ; CHECK-NEXT: # %bb.1:
2982 ; CHECK-NEXT: .LBB101_2:
2983 ; CHECK-NEXT: tail bar
2984 %2 = and i64 %0, 1023
2985 %3 = icmp eq i64 %2, 0
2986 br i1 %3, label %4, label %5
2989 tail call void @bar()
2996 define void @bit_10_1_nz_branch_i64(i64 %0) {
2997 ; CHECK-LABEL: bit_10_1_nz_branch_i64:
2999 ; CHECK-NEXT: andi a0, a0, 1023
3000 ; CHECK-NEXT: beqz a0, .LBB102_2
3001 ; CHECK-NEXT: # %bb.1:
3002 ; CHECK-NEXT: tail bar
3003 ; CHECK-NEXT: .LBB102_2:
3005 %2 = and i64 %0, 1023
3006 %3 = icmp ne i64 %2, 0
3007 br i1 %3, label %4, label %5
3010 tail call void @bar()
3017 define void @bit_11_1_z_branch_i64(i64 %0) {
3018 ; CHECK-LABEL: bit_11_1_z_branch_i64:
3020 ; CHECK-NEXT: andi a0, a0, 2047
3021 ; CHECK-NEXT: beqz a0, .LBB103_2
3022 ; CHECK-NEXT: # %bb.1:
3024 ; CHECK-NEXT: .LBB103_2:
3025 ; CHECK-NEXT: tail bar
3026 %2 = and i64 %0, 2047
3027 %3 = icmp eq i64 %2, 0
3028 br i1 %3, label %4, label %5
3031 tail call void @bar()
3038 define void @bit_11_1_nz_branch_i64(i64 %0) {
3039 ; CHECK-LABEL: bit_11_1_nz_branch_i64:
3041 ; CHECK-NEXT: andi a0, a0, 2047
3042 ; CHECK-NEXT: beqz a0, .LBB104_2
3043 ; CHECK-NEXT: # %bb.1:
3044 ; CHECK-NEXT: tail bar
3045 ; CHECK-NEXT: .LBB104_2:
3047 %2 = and i64 %0, 2047
3048 %3 = icmp ne i64 %2, 0
3049 br i1 %3, label %4, label %5
3052 tail call void @bar()
3059 define void @bit_16_1_z_branch_i64(i64 %0) {
3060 ; RV32-LABEL: bit_16_1_z_branch_i64:
3062 ; RV32-NEXT: slli a0, a0, 16
3063 ; RV32-NEXT: beqz a0, .LBB105_2
3064 ; RV32-NEXT: # %bb.1:
3066 ; RV32-NEXT: .LBB105_2:
3067 ; RV32-NEXT: tail bar
3069 ; RV64-LABEL: bit_16_1_z_branch_i64:
3071 ; RV64-NEXT: slli a0, a0, 48
3072 ; RV64-NEXT: beqz a0, .LBB105_2
3073 ; RV64-NEXT: # %bb.1:
3075 ; RV64-NEXT: .LBB105_2:
3076 ; RV64-NEXT: tail bar
3077 %2 = and i64 %0, 65535
3078 %3 = icmp eq i64 %2, 0
3079 br i1 %3, label %4, label %5
3082 tail call void @bar()
3089 define void @bit_16_1_nz_branch_i64(i64 %0) {
3090 ; RV32-LABEL: bit_16_1_nz_branch_i64:
3092 ; RV32-NEXT: slli a0, a0, 16
3093 ; RV32-NEXT: beqz a0, .LBB106_2
3094 ; RV32-NEXT: # %bb.1:
3095 ; RV32-NEXT: tail bar
3096 ; RV32-NEXT: .LBB106_2:
3099 ; RV64-LABEL: bit_16_1_nz_branch_i64:
3101 ; RV64-NEXT: slli a0, a0, 48
3102 ; RV64-NEXT: beqz a0, .LBB106_2
3103 ; RV64-NEXT: # %bb.1:
3104 ; RV64-NEXT: tail bar
3105 ; RV64-NEXT: .LBB106_2:
3107 %2 = and i64 %0, 65535
3108 %3 = icmp ne i64 %2, 0
3109 br i1 %3, label %4, label %5
3112 tail call void @bar()
3119 define void @bit_24_1_z_branch_i64(i64 %0) {
3120 ; RV32-LABEL: bit_24_1_z_branch_i64:
3122 ; RV32-NEXT: slli a0, a0, 8
3123 ; RV32-NEXT: beqz a0, .LBB107_2
3124 ; RV32-NEXT: # %bb.1:
3126 ; RV32-NEXT: .LBB107_2:
3127 ; RV32-NEXT: tail bar
3129 ; RV64-LABEL: bit_24_1_z_branch_i64:
3131 ; RV64-NEXT: slli a0, a0, 40
3132 ; RV64-NEXT: beqz a0, .LBB107_2
3133 ; RV64-NEXT: # %bb.1:
3135 ; RV64-NEXT: .LBB107_2:
3136 ; RV64-NEXT: tail bar
3137 %2 = and i64 %0, 16777215
3138 %3 = icmp eq i64 %2, 0
3139 br i1 %3, label %4, label %5
3142 tail call void @bar()
3149 define void @bit_24_1_nz_branch_i64(i64 %0) {
3150 ; RV32-LABEL: bit_24_1_nz_branch_i64:
3152 ; RV32-NEXT: slli a0, a0, 8
3153 ; RV32-NEXT: beqz a0, .LBB108_2
3154 ; RV32-NEXT: # %bb.1:
3155 ; RV32-NEXT: tail bar
3156 ; RV32-NEXT: .LBB108_2:
3159 ; RV64-LABEL: bit_24_1_nz_branch_i64:
3161 ; RV64-NEXT: slli a0, a0, 40
3162 ; RV64-NEXT: beqz a0, .LBB108_2
3163 ; RV64-NEXT: # %bb.1:
3164 ; RV64-NEXT: tail bar
3165 ; RV64-NEXT: .LBB108_2:
3167 %2 = and i64 %0, 16777215
3168 %3 = icmp ne i64 %2, 0
3169 br i1 %3, label %4, label %5
3172 tail call void @bar()
3179 define void @bit_31_1_z_branch_i64(i64 %0) {
3180 ; RV32-LABEL: bit_31_1_z_branch_i64:
3182 ; RV32-NEXT: slli a0, a0, 1
3183 ; RV32-NEXT: beqz a0, .LBB109_2
3184 ; RV32-NEXT: # %bb.1:
3186 ; RV32-NEXT: .LBB109_2:
3187 ; RV32-NEXT: tail bar
3189 ; RV64-LABEL: bit_31_1_z_branch_i64:
3191 ; RV64-NEXT: slli a0, a0, 33
3192 ; RV64-NEXT: beqz a0, .LBB109_2
3193 ; RV64-NEXT: # %bb.1:
3195 ; RV64-NEXT: .LBB109_2:
3196 ; RV64-NEXT: tail bar
3197 %2 = and i64 %0, 2147483647
3198 %3 = icmp eq i64 %2, 0
3199 br i1 %3, label %4, label %5
3202 tail call void @bar()
3209 define void @bit_31_1_nz_branch_i64(i64 %0) {
3210 ; RV32-LABEL: bit_31_1_nz_branch_i64:
3212 ; RV32-NEXT: slli a0, a0, 1
3213 ; RV32-NEXT: beqz a0, .LBB110_2
3214 ; RV32-NEXT: # %bb.1:
3215 ; RV32-NEXT: tail bar
3216 ; RV32-NEXT: .LBB110_2:
3219 ; RV64-LABEL: bit_31_1_nz_branch_i64:
3221 ; RV64-NEXT: slli a0, a0, 33
3222 ; RV64-NEXT: beqz a0, .LBB110_2
3223 ; RV64-NEXT: # %bb.1:
3224 ; RV64-NEXT: tail bar
3225 ; RV64-NEXT: .LBB110_2:
3227 %2 = and i64 %0, 2147483647
3228 %3 = icmp ne i64 %2, 0
3229 br i1 %3, label %4, label %5
3232 tail call void @bar()
3239 define void @bit_32_1_z_branch_i64(i64 %0) {
3240 ; RV32-LABEL: bit_32_1_z_branch_i64:
3242 ; RV32-NEXT: beqz a0, .LBB111_2
3243 ; RV32-NEXT: # %bb.1:
3245 ; RV32-NEXT: .LBB111_2:
3246 ; RV32-NEXT: tail bar
3248 ; RV64-LABEL: bit_32_1_z_branch_i64:
3250 ; RV64-NEXT: sext.w a0, a0
3251 ; RV64-NEXT: beqz a0, .LBB111_2
3252 ; RV64-NEXT: # %bb.1:
3254 ; RV64-NEXT: .LBB111_2:
3255 ; RV64-NEXT: tail bar
3256 %2 = and i64 %0, 4294967295
3257 %3 = icmp eq i64 %2, 0
3258 br i1 %3, label %4, label %5
3261 tail call void @bar()
3268 define void @bit_32_1_nz_branch_i64(i64 %0) {
3269 ; RV32-LABEL: bit_32_1_nz_branch_i64:
3271 ; RV32-NEXT: beqz a0, .LBB112_2
3272 ; RV32-NEXT: # %bb.1:
3273 ; RV32-NEXT: tail bar
3274 ; RV32-NEXT: .LBB112_2:
3277 ; RV64-LABEL: bit_32_1_nz_branch_i64:
3279 ; RV64-NEXT: sext.w a0, a0
3280 ; RV64-NEXT: beqz a0, .LBB112_2
3281 ; RV64-NEXT: # %bb.1:
3282 ; RV64-NEXT: tail bar
3283 ; RV64-NEXT: .LBB112_2:
3285 %2 = and i64 %0, 4294967295
3286 %3 = icmp ne i64 %2, 0
3287 br i1 %3, label %4, label %5
3290 tail call void @bar()
3297 define void @bit_62_1_z_branch_i64(i64 %0) {
3298 ; RV32-LABEL: bit_62_1_z_branch_i64:
3300 ; RV32-NEXT: slli a1, a1, 2
3301 ; RV32-NEXT: srli a1, a1, 2
3302 ; RV32-NEXT: or a0, a0, a1
3303 ; RV32-NEXT: beqz a0, .LBB113_2
3304 ; RV32-NEXT: # %bb.1:
3306 ; RV32-NEXT: .LBB113_2:
3307 ; RV32-NEXT: tail bar
3309 ; RV64-LABEL: bit_62_1_z_branch_i64:
3311 ; RV64-NEXT: slli a0, a0, 2
3312 ; RV64-NEXT: beqz a0, .LBB113_2
3313 ; RV64-NEXT: # %bb.1:
3315 ; RV64-NEXT: .LBB113_2:
3316 ; RV64-NEXT: tail bar
3317 %2 = and i64 %0, 4611686018427387903
3318 %3 = icmp eq i64 %2, 0
3319 br i1 %3, label %4, label %5
3322 tail call void @bar()
3329 define void @bit_62_1_nz_branch_i64(i64 %0) {
3330 ; RV32-LABEL: bit_62_1_nz_branch_i64:
3332 ; RV32-NEXT: slli a1, a1, 2
3333 ; RV32-NEXT: srli a1, a1, 2
3334 ; RV32-NEXT: or a0, a0, a1
3335 ; RV32-NEXT: beqz a0, .LBB114_2
3336 ; RV32-NEXT: # %bb.1:
3337 ; RV32-NEXT: tail bar
3338 ; RV32-NEXT: .LBB114_2:
3341 ; RV64-LABEL: bit_62_1_nz_branch_i64:
3343 ; RV64-NEXT: slli a0, a0, 2
3344 ; RV64-NEXT: beqz a0, .LBB114_2
3345 ; RV64-NEXT: # %bb.1:
3346 ; RV64-NEXT: tail bar
3347 ; RV64-NEXT: .LBB114_2:
3349 %2 = and i64 %0, 4611686018427387903
3350 %3 = icmp ne i64 %2, 0
3351 br i1 %3, label %4, label %5
3354 tail call void @bar()
3361 define void @bit_63_1_z_branch_i64(i64 %0) {
3362 ; RV32I-LABEL: bit_63_1_z_branch_i64:
3364 ; RV32I-NEXT: slli a1, a1, 1
3365 ; RV32I-NEXT: srli a1, a1, 1
3366 ; RV32I-NEXT: or a0, a0, a1
3367 ; RV32I-NEXT: beqz a0, .LBB115_2
3368 ; RV32I-NEXT: # %bb.1:
3370 ; RV32I-NEXT: .LBB115_2:
3371 ; RV32I-NEXT: tail bar
3373 ; RV64-LABEL: bit_63_1_z_branch_i64:
3375 ; RV64-NEXT: slli a0, a0, 1
3376 ; RV64-NEXT: beqz a0, .LBB115_2
3377 ; RV64-NEXT: # %bb.1:
3379 ; RV64-NEXT: .LBB115_2:
3380 ; RV64-NEXT: tail bar
3382 ; RV32ZBS-LABEL: bit_63_1_z_branch_i64:
3384 ; RV32ZBS-NEXT: bclri a1, a1, 31
3385 ; RV32ZBS-NEXT: or a0, a0, a1
3386 ; RV32ZBS-NEXT: beqz a0, .LBB115_2
3387 ; RV32ZBS-NEXT: # %bb.1:
3389 ; RV32ZBS-NEXT: .LBB115_2:
3390 ; RV32ZBS-NEXT: tail bar
3392 ; RV32XTHEADBS-LABEL: bit_63_1_z_branch_i64:
3393 ; RV32XTHEADBS: # %bb.0:
3394 ; RV32XTHEADBS-NEXT: slli a1, a1, 1
3395 ; RV32XTHEADBS-NEXT: srli a1, a1, 1
3396 ; RV32XTHEADBS-NEXT: or a0, a0, a1
3397 ; RV32XTHEADBS-NEXT: beqz a0, .LBB115_2
3398 ; RV32XTHEADBS-NEXT: # %bb.1:
3399 ; RV32XTHEADBS-NEXT: ret
3400 ; RV32XTHEADBS-NEXT: .LBB115_2:
3401 ; RV32XTHEADBS-NEXT: tail bar
3402 %2 = and i64 %0, 9223372036854775807
3403 %3 = icmp eq i64 %2, 0
3404 br i1 %3, label %4, label %5
3407 tail call void @bar()
3414 define void @bit_63_1_nz_branch_i64(i64 %0) {
3415 ; RV32I-LABEL: bit_63_1_nz_branch_i64:
3417 ; RV32I-NEXT: slli a1, a1, 1
3418 ; RV32I-NEXT: srli a1, a1, 1
3419 ; RV32I-NEXT: or a0, a0, a1
3420 ; RV32I-NEXT: beqz a0, .LBB116_2
3421 ; RV32I-NEXT: # %bb.1:
3422 ; RV32I-NEXT: tail bar
3423 ; RV32I-NEXT: .LBB116_2:
3426 ; RV64-LABEL: bit_63_1_nz_branch_i64:
3428 ; RV64-NEXT: slli a0, a0, 1
3429 ; RV64-NEXT: beqz a0, .LBB116_2
3430 ; RV64-NEXT: # %bb.1:
3431 ; RV64-NEXT: tail bar
3432 ; RV64-NEXT: .LBB116_2:
3435 ; RV32ZBS-LABEL: bit_63_1_nz_branch_i64:
3437 ; RV32ZBS-NEXT: bclri a1, a1, 31
3438 ; RV32ZBS-NEXT: or a0, a0, a1
3439 ; RV32ZBS-NEXT: beqz a0, .LBB116_2
3440 ; RV32ZBS-NEXT: # %bb.1:
3441 ; RV32ZBS-NEXT: tail bar
3442 ; RV32ZBS-NEXT: .LBB116_2:
3445 ; RV32XTHEADBS-LABEL: bit_63_1_nz_branch_i64:
3446 ; RV32XTHEADBS: # %bb.0:
3447 ; RV32XTHEADBS-NEXT: slli a1, a1, 1
3448 ; RV32XTHEADBS-NEXT: srli a1, a1, 1
3449 ; RV32XTHEADBS-NEXT: or a0, a0, a1
3450 ; RV32XTHEADBS-NEXT: beqz a0, .LBB116_2
3451 ; RV32XTHEADBS-NEXT: # %bb.1:
3452 ; RV32XTHEADBS-NEXT: tail bar
3453 ; RV32XTHEADBS-NEXT: .LBB116_2:
3454 ; RV32XTHEADBS-NEXT: ret
3455 %2 = and i64 %0, 9223372036854775807
3456 %3 = icmp ne i64 %2, 0
3457 br i1 %3, label %4, label %5
3460 tail call void @bar()
3467 define void @bit_64_1_z_branch_i64(i64 %0) {
3468 ; RV32-LABEL: bit_64_1_z_branch_i64:
3470 ; RV32-NEXT: or a0, a0, a1
3471 ; RV32-NEXT: beqz a0, .LBB117_2
3472 ; RV32-NEXT: # %bb.1:
3474 ; RV32-NEXT: .LBB117_2:
3475 ; RV32-NEXT: tail bar
3477 ; RV64-LABEL: bit_64_1_z_branch_i64:
3479 ; RV64-NEXT: beqz a0, .LBB117_2
3480 ; RV64-NEXT: # %bb.1:
3482 ; RV64-NEXT: .LBB117_2:
3483 ; RV64-NEXT: tail bar
3484 %2 = and i64 %0, 18446744073709551615
3485 %3 = icmp eq i64 %2, 0
3486 br i1 %3, label %4, label %5
3489 tail call void @bar()
3496 define void @bit_64_1_nz_branch_i64(i64 %0) {
3497 ; RV32-LABEL: bit_64_1_nz_branch_i64:
3499 ; RV32-NEXT: or a0, a0, a1
3500 ; RV32-NEXT: beqz a0, .LBB118_2
3501 ; RV32-NEXT: # %bb.1:
3502 ; RV32-NEXT: tail bar
3503 ; RV32-NEXT: .LBB118_2:
3506 ; RV64-LABEL: bit_64_1_nz_branch_i64:
3508 ; RV64-NEXT: beqz a0, .LBB118_2
3509 ; RV64-NEXT: # %bb.1:
3510 ; RV64-NEXT: tail bar
3511 ; RV64-NEXT: .LBB118_2:
3513 %2 = and i64 %0, 18446744073709551615
3514 %3 = icmp ne i64 %2, 0
3515 br i1 %3, label %4, label %5
3518 tail call void @bar()