1; RUN: llc -O1 -march=mips64 -mcpu=octeon < %s | FileCheck %s -check-prefix=OCTEON
2; RUN: llc -O1 -march=mips64 -mcpu=mips64 < %s | FileCheck %s -check-prefix=MIPS64
3
4define i8 @cnt8(i8 %x) nounwind readnone {
5  %cnt = tail call i8 @llvm.ctpop.i8(i8 %x)
6  ret i8 %cnt
7; OCTEON-LABEL: cnt8:
8; OCTEON: jr   $ra
9; OCTEON: pop  $2, [[R1:\$[0-9]+]]
10; MIPS64-LABEL: cnt8:
11; MIPS64-NOT: pop
12}
13
14define i16 @cnt16(i16 %x) nounwind readnone {
15  %cnt = tail call i16 @llvm.ctpop.i16(i16 %x)
16  ret i16 %cnt
17; OCTEON-LABEL: cnt16:
18; OCTEON: jr   $ra
19; OCTEON: pop  $2, [[R1:\$[0-9]+]]
20; MIPS64-LABEL: cnt16:
21; MIPS64-NOT: pop
22}
23
24define i32 @cnt32(i32 zeroext %x) nounwind readnone {
25  %cnt = tail call i32 @llvm.ctpop.i32(i32 %x)
26  ret i32 %cnt
27; OCTEON-LABEL: cnt32:
28; OCTEON: jr   $ra
29; OCTEON: pop  $2, $4
30; MIPS64-LABEL: cnt32:
31; MIPS64-NOT: pop
32}
33
34define i64 @cnt64(i64 %x) nounwind readnone {
35  %cnt = tail call i64 @llvm.ctpop.i64(i64 %x)
36  ret i64 %cnt
37; OCTEON-LABEL: cnt64:
38; OCTEON: jr   $ra
39; OCTEON: dpop $2, $4
40; MIPS64-LABEL: cnt64:
41; MIPS64-NOT: dpop
42}
43
44declare i8 @llvm.ctpop.i8(i8) nounwind readnone
45declare i16 @llvm.ctpop.i16(i16) nounwind readnone
46declare i32 @llvm.ctpop.i32(i32) nounwind readnone
47declare i64 @llvm.ctpop.i64(i64) nounwind readnone
48