1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=riscv64 -mattr=+m | FileCheck %s
4 declare i15 @llvm.ctlz.i15(i15, i1)
6 define i15 @foo(i15 %x) nounwind {
9 ; CHECK-NEXT: slli a1, a0, 49
10 ; CHECK-NEXT: beqz a1, .LBB0_2
11 ; CHECK-NEXT: # %bb.1: # %cond.false
12 ; CHECK-NEXT: srli a1, a1, 50
13 ; CHECK-NEXT: or a0, a0, a1
14 ; CHECK-NEXT: slli a1, a0, 49
15 ; CHECK-NEXT: srli a1, a1, 51
16 ; CHECK-NEXT: or a0, a0, a1
17 ; CHECK-NEXT: slli a1, a0, 49
18 ; CHECK-NEXT: srli a1, a1, 53
19 ; CHECK-NEXT: or a0, a0, a1
20 ; CHECK-NEXT: slli a1, a0, 49
21 ; CHECK-NEXT: srli a1, a1, 57
22 ; CHECK-NEXT: or a0, a0, a1
23 ; CHECK-NEXT: not a0, a0
24 ; CHECK-NEXT: srli a1, a0, 1
25 ; CHECK-NEXT: lui a2, 1
26 ; CHECK-NEXT: addiw a2, a2, 1365
27 ; CHECK-NEXT: and a1, a1, a2
28 ; CHECK-NEXT: slli a0, a0, 49
29 ; CHECK-NEXT: srli a0, a0, 49
30 ; CHECK-NEXT: sub a0, a0, a1
31 ; CHECK-NEXT: lui a1, 209715
32 ; CHECK-NEXT: addiw a1, a1, 819
33 ; CHECK-NEXT: slli a2, a1, 32
34 ; CHECK-NEXT: add a1, a1, a2
35 ; CHECK-NEXT: and a2, a0, a1
36 ; CHECK-NEXT: srli a0, a0, 2
37 ; CHECK-NEXT: and a0, a0, a1
38 ; CHECK-NEXT: add a0, a2, a0
39 ; CHECK-NEXT: srli a1, a0, 4
40 ; CHECK-NEXT: add a0, a0, a1
41 ; CHECK-NEXT: lui a1, 61681
42 ; CHECK-NEXT: addiw a1, a1, -241
43 ; CHECK-NEXT: slli a2, a1, 32
44 ; CHECK-NEXT: add a1, a1, a2
45 ; CHECK-NEXT: and a0, a0, a1
46 ; CHECK-NEXT: lui a1, 4112
47 ; CHECK-NEXT: addiw a1, a1, 257
48 ; CHECK-NEXT: slli a2, a1, 32
49 ; CHECK-NEXT: add a1, a1, a2
50 ; CHECK-NEXT: mul a0, a0, a1
51 ; CHECK-NEXT: srli a0, a0, 56
53 ; CHECK-NEXT: .LBB0_2:
54 ; CHECK-NEXT: li a0, 15
56 %a = call i15 @llvm.ctlz.i15(i15 %x, i1 false)