1; RUN: llc -march=ppc64 -mattr=+popcntd < %s | FileCheck %s
2
3define i8 @cnt8(i8 %x) nounwind readnone {
4  %cnt = tail call i8 @llvm.ctpop.i8(i8 %x)
5  ret i8 %cnt
6; CHECK: @cnt8
7; CHECK: rlwinm
8; CHECK: popcntw
9; CHECK: blr
10}
11
12define i16 @cnt16(i16 %x) nounwind readnone {
13  %cnt = tail call i16 @llvm.ctpop.i16(i16 %x)
14  ret i16 %cnt
15; CHECK: @cnt16
16; CHECK: rlwinm
17; CHECK: popcntw
18; CHECK: blr
19}
20
21define i32 @cnt32(i32 %x) nounwind readnone {
22  %cnt = tail call i32 @llvm.ctpop.i32(i32 %x)
23  ret i32 %cnt
24; CHECK: @cnt32
25; CHECK: popcntw
26; CHECK: blr
27}
28
29define i64 @cnt64(i64 %x) nounwind readnone {
30  %cnt = tail call i64 @llvm.ctpop.i64(i64 %x)
31  ret i64 %cnt
32; CHECK: @cnt64
33; CHECK: popcntd
34; CHECK: blr
35}
36
37declare i8 @llvm.ctpop.i8(i8) nounwind readnone
38declare i16 @llvm.ctpop.i16(i16) nounwind readnone
39declare i32 @llvm.ctpop.i32(i32) nounwind readnone
40declare i64 @llvm.ctpop.i64(i64) nounwind readnone
41