1; RUN: llc -march=hexagon < %s | FileCheck %s
2
3target triple = "hexagon"
4
5; Function Attrs: nounwind readnone
6define i32 @f0(i32 %a0) #0 {
7b0:
8; CHECK: cl0
9  %v0 = tail call i32 @llvm.ctlz.i32(i32 %a0, i1 true)
10  ret i32 %v0
11}
12
13; Function Attrs: nounwind readnone speculatable
14declare i32 @llvm.ctlz.i32(i32, i1) #1
15
16; Function Attrs: nounwind readnone speculatable
17declare i64 @llvm.ctlz.i64(i64, i1) #1
18
19; Function Attrs: nounwind readnone
20define i32 @f1(i32 %a0) #0 {
21b0:
22; CHECK: ct0
23  %v0 = tail call i32 @llvm.cttz.i32(i32 %a0, i1 true)
24  ret i32 %v0
25}
26
27; Function Attrs: nounwind readnone speculatable
28declare i32 @llvm.cttz.i32(i32, i1) #1
29
30; Function Attrs: nounwind readnone speculatable
31declare i64 @llvm.cttz.i64(i64, i1) #1
32
33; Function Attrs: nounwind readnone
34define i32 @f2(i64 %a0) #0 {
35b0:
36; CHECK: cl0
37  %v0 = tail call i64 @llvm.ctlz.i64(i64 %a0, i1 true)
38  %v1 = trunc i64 %v0 to i32
39  ret i32 %v1
40}
41
42; Function Attrs: nounwind readnone
43define i32 @f3(i64 %a0) #0 {
44b0:
45; CHECK: ct0
46  %v0 = tail call i64 @llvm.cttz.i64(i64 %a0, i1 true)
47  %v1 = trunc i64 %v0 to i32
48  ret i32 %v1
49}
50
51attributes #0 = { nounwind readnone }
52attributes #1 = { nounwind readnone speculatable }
53