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