• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=x86-64 -mattr=+popcnt < %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-LABEL: cnt8:
7; CHECK: popcntw
8; CHECK: ret
9}
10
11define 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
19define 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
27define 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
35declare i8 @llvm.ctpop.i8(i8) nounwind readnone
36declare i16 @llvm.ctpop.i16(i16) nounwind readnone
37declare i32 @llvm.ctpop.i32(i32) nounwind readnone
38declare i64 @llvm.ctpop.i64(i64) nounwind readnone
39