xref: /aosp_15_r20/external/llvm/test/CodeGen/PowerPC/popcnt.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=ppc64 -mattr=+popcntd < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=ppc64 -mattr=+slow-popcntd < %s | FileCheck %s --check-prefix=SLOWPC
3*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=ppc64 -mcpu=pwr7 < %s | FileCheck %s
4*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=ppc64 -mcpu=a2q < %s | FileCheck %s --check-prefix=SLOWPC
5*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=ppc64 -mcpu=a2q -mattr=+popcntd < %s | FileCheck %s
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdefine i8 @cnt8(i8 %x) nounwind readnone {
8*9880d681SAndroid Build Coastguard Worker  %cnt = tail call i8 @llvm.ctpop.i8(i8 %x)
9*9880d681SAndroid Build Coastguard Worker  ret i8 %cnt
10*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @cnt8
11*9880d681SAndroid Build Coastguard Worker; CHECK: rlwinm
12*9880d681SAndroid Build Coastguard Worker; CHECK: popcntw
13*9880d681SAndroid Build Coastguard Worker; CHECK: blr
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Worker; SLOWPC-LABEL: @cnt8
16*9880d681SAndroid Build Coastguard Worker; SLOWPC-NOT: popcnt
17*9880d681SAndroid Build Coastguard Worker}
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Workerdefine i16 @cnt16(i16 %x) nounwind readnone {
20*9880d681SAndroid Build Coastguard Worker  %cnt = tail call i16 @llvm.ctpop.i16(i16 %x)
21*9880d681SAndroid Build Coastguard Worker  ret i16 %cnt
22*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @cnt16
23*9880d681SAndroid Build Coastguard Worker; CHECK: rlwinm
24*9880d681SAndroid Build Coastguard Worker; CHECK: popcntw
25*9880d681SAndroid Build Coastguard Worker; CHECK: blr
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Worker; SLOWPC-LABEL: @cnt16
28*9880d681SAndroid Build Coastguard Worker; SLOWPC-NOT: popcnt
29*9880d681SAndroid Build Coastguard Worker}
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Workerdefine i32 @cnt32(i32 %x) nounwind readnone {
32*9880d681SAndroid Build Coastguard Worker  %cnt = tail call i32 @llvm.ctpop.i32(i32 %x)
33*9880d681SAndroid Build Coastguard Worker  ret i32 %cnt
34*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @cnt32
35*9880d681SAndroid Build Coastguard Worker; CHECK: popcntw
36*9880d681SAndroid Build Coastguard Worker; CHECK: blr
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Worker; SLOWPC-LABEL: @cnt32
39*9880d681SAndroid Build Coastguard Worker; SLOWPC-NOT: popcnt
40*9880d681SAndroid Build Coastguard Worker}
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Workerdefine i64 @cnt64(i64 %x) nounwind readnone {
43*9880d681SAndroid Build Coastguard Worker  %cnt = tail call i64 @llvm.ctpop.i64(i64 %x)
44*9880d681SAndroid Build Coastguard Worker  ret i64 %cnt
45*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @cnt64
46*9880d681SAndroid Build Coastguard Worker; CHECK: popcntd
47*9880d681SAndroid Build Coastguard Worker; CHECK: blr
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard Worker; SLOWPC-LABEL: @cnt64
50*9880d681SAndroid Build Coastguard Worker; SLOWPC-NOT: popcnt
51*9880d681SAndroid Build Coastguard Worker}
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard Workerdeclare i8 @llvm.ctpop.i8(i8) nounwind readnone
54*9880d681SAndroid Build Coastguard Workerdeclare i16 @llvm.ctpop.i16(i16) nounwind readnone
55*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.ctpop.i32(i32) nounwind readnone
56*9880d681SAndroid Build Coastguard Workerdeclare i64 @llvm.ctpop.i64(i64) nounwind readnone
57