Merging r261039:
[oota-llvm.git] / test / CodeGen / X86 / popcnt.ll
1 ; RUN: llc -march=x86-64 -mattr=+popcnt < %s | FileCheck %s
2
3 define i8 @cnt8(i8 %x) nounwind readnone {
4   %cnt = tail call i8 @llvm.ctpop.i8(i8 %x)
5   ret i8 %cnt
6 ; CHECK-LABEL: cnt8:
7 ; CHECK: popcntw
8 ; CHECK: ret
9 }
10
11 define i16 @cnt16(i16 %x) nounwind readnone {
12   %cnt = tail call i16 @llvm.ctpop.i16(i16 %x)
13   ret i16 %cnt
14 ; CHECK-LABEL: cnt16:
15 ; CHECK: popcntw
16 ; CHECK: ret
17 }
18
19 define i32 @cnt32(i32 %x) nounwind readnone {
20   %cnt = tail call i32 @llvm.ctpop.i32(i32 %x)
21   ret i32 %cnt
22 ; CHECK-LABEL: cnt32:
23 ; CHECK: popcntl
24 ; CHECK: ret
25 }
26
27 define i64 @cnt64(i64 %x) nounwind readnone {
28   %cnt = tail call i64 @llvm.ctpop.i64(i64 %x)
29   ret i64 %cnt
30 ; CHECK-LABEL: cnt64:
31 ; CHECK: popcntq
32 ; CHECK: ret
33 }
34
35 declare i8 @llvm.ctpop.i8(i8) nounwind readnone
36 declare i16 @llvm.ctpop.i16(i16) nounwind readnone
37 declare i32 @llvm.ctpop.i32(i32) nounwind readnone
38 declare i64 @llvm.ctpop.i64(i64) nounwind readnone