• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Wrappers around the bit manipulation intrinsics, which use name mangling
2; for encoding the type in the name instead of plain "C" suffixes.
3; E.g., my_ctpop(unsigned long long) vs __builtin_popcountll(...)
4; Also, normalize the intrinsic to take a single parameter when there
5; can be two, as is the case for ctlz and cttz.
6
7declare i32 @llvm.ctlz.i32(i32, i1)
8declare i64 @llvm.ctlz.i64(i64, i1)
9
10declare i32 @llvm.cttz.i32(i32, i1)
11declare i64 @llvm.cttz.i64(i64, i1)
12
13declare i32 @llvm.ctpop.i32(i32)
14declare i64 @llvm.ctpop.i64(i64)
15
16define i32 @_Z7my_ctlzj(i32 %a) {
17  %x = call i32 @llvm.ctlz.i32(i32 %a, i1 0)
18  ret i32 %x
19}
20
21define i64 @_Z7my_ctlzy(i64 %a) {
22  %x = call i64 @llvm.ctlz.i64(i64 %a, i1 0)
23  ret i64 %x
24}
25
26define i32 @_Z7my_cttzj(i32 %a) {
27  %x = call i32 @llvm.cttz.i32(i32 %a, i1 0)
28  ret i32 %x
29}
30
31define i64 @_Z7my_cttzy(i64 %a) {
32  %x = call i64 @llvm.cttz.i64(i64 %a, i1 0)
33  ret i64 %x
34}
35
36define i32 @_Z8my_ctpopj(i32 %a) {
37  %x = call i32 @llvm.ctpop.i32(i32 %a)
38  ret i32 %x
39}
40
41define i64 @_Z8my_ctpopy(i64 %a) {
42  %x = call i64 @llvm.ctpop.i64(i64 %a)
43  ret i64 %x
44}
45