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: srli a2, a1, 49
11 ; CHECK-NEXT: beqz a2, .LBB0_2
12 ; CHECK-NEXT: # %bb.1: # %cond.false
13 ; CHECK-NEXT: srli a1, a1, 50
14 ; CHECK-NEXT: or a0, a0, a1
15 ; CHECK-NEXT: slli a1, a0, 49
16 ; CHECK-NEXT: srli a1, a1, 51
17 ; CHECK-NEXT: or a0, a0, a1
18 ; CHECK-NEXT: slli a1, a0, 49
19 ; CHECK-NEXT: srli a1, a1, 53
20 ; CHECK-NEXT: or a0, a0, a1
21 ; CHECK-NEXT: slli a1, a0, 49
22 ; CHECK-NEXT: srli a1, a1, 57
23 ; CHECK-NEXT: or a0, a0, a1
24 ; CHECK-NEXT: not a0, a0
25 ; CHECK-NEXT: slli a0, a0, 49
26 ; CHECK-NEXT: srli a0, a0, 49
27 ; CHECK-NEXT: lui a1, %hi(.LCPI0_0)
28 ; CHECK-NEXT: ld a1, %lo(.LCPI0_0)(a1)
29 ; CHECK-NEXT: lui a2, %hi(.LCPI0_1)
30 ; CHECK-NEXT: ld a2, %lo(.LCPI0_1)(a2)
31 ; CHECK-NEXT: srli a3, a0, 1
32 ; CHECK-NEXT: and a1, a3, a1
33 ; CHECK-NEXT: sub a0, a0, a1
34 ; CHECK-NEXT: and a1, a0, a2
35 ; CHECK-NEXT: srli a0, a0, 2
36 ; CHECK-NEXT: and a0, a0, a2
37 ; CHECK-NEXT: add a0, a1, a0
38 ; CHECK-NEXT: lui a1, %hi(.LCPI0_2)
39 ; CHECK-NEXT: ld a1, %lo(.LCPI0_2)(a1)
40 ; CHECK-NEXT: lui a2, %hi(.LCPI0_3)
41 ; CHECK-NEXT: ld a2, %lo(.LCPI0_3)(a2)
42 ; CHECK-NEXT: srli a3, a0, 4
43 ; CHECK-NEXT: add a0, a0, a3
44 ; CHECK-NEXT: and a0, a0, a1
45 ; CHECK-NEXT: mul a0, a0, a2
46 ; CHECK-NEXT: srli a0, a0, 56
48 ; CHECK-NEXT: .LBB0_2:
49 ; CHECK-NEXT: li a0, 15
51 %a = call i15 @llvm.ctlz.i15(i15 %x, i1 false)