74 lines · plain
1; RUN: llc -verify-machineinstrs -mtriple=ppc64-- -mattr=+popcntd < %s | FileCheck %s2; RUN: llc -verify-machineinstrs -mtriple=ppc64-- -mattr=+slow-popcntd < %s | FileCheck %s --check-prefix=SLOWPC3; RUN: llc -verify-machineinstrs -mtriple=ppc64-- -mcpu=pwr7 < %s | FileCheck %s4 5define i64 @_cntb64(i64 %x) nounwind readnone {6 %cnt = tail call i64 @llvm.ppc.popcntb(i64 %x)7 ret i64 %cnt8; CHECK-LABEL: @_cntb649; CHECK: popcntb10; CHECK: blr11}12 13define i32 @_cntb32(i32 %x) nounwind readnone {14 %y = zext i32 %x to i6415 %cnt = tail call i64 @llvm.ppc.popcntb(i64 %y)16 %res = trunc i64 %cnt to i3217 ret i32 %res18; CHECK-LABEL: @_cntb3219; CHECK: popcntb20; CHECK: blr21}22 23define i8 @cnt8(i8 %x) nounwind readnone {24 %cnt = tail call i8 @llvm.ctpop.i8(i8 %x)25 ret i8 %cnt26; CHECK-LABEL: @cnt827; CHECK: clrldi28; CHECK: popcntd29; CHECK: blr30 31; SLOWPC-LABEL: @cnt832; SLOWPC-NOT: popcnt33}34 35define i16 @cnt16(i16 %x) nounwind readnone {36 %cnt = tail call i16 @llvm.ctpop.i16(i16 %x)37 ret i16 %cnt38; CHECK-LABEL: @cnt1639; CHECK: clrldi40; CHECK: popcntd41; CHECK: blr42 43; SLOWPC-LABEL: @cnt1644; SLOWPC-NOT: popcnt45}46 47define i32 @cnt32(i32 %x) nounwind readnone {48 %cnt = tail call i32 @llvm.ctpop.i32(i32 %x)49 ret i32 %cnt50; CHECK-LABEL: @cnt3251; CHECK: popcntw52; CHECK: blr53 54; SLOWPC-LABEL: @cnt3255; SLOWPC-NOT: popcnt56}57 58define i64 @cnt64(i64 %x) nounwind readnone {59 %cnt = tail call i64 @llvm.ctpop.i64(i64 %x)60 ret i64 %cnt61; CHECK-LABEL: @cnt6462; CHECK: popcntd63; CHECK: blr64 65; SLOWPC-LABEL: @cnt6466; SLOWPC-NOT: popcnt67}68 69declare i8 @llvm.ctpop.i8(i8) nounwind readnone70declare i16 @llvm.ctpop.i16(i16) nounwind readnone71declare i32 @llvm.ctpop.i32(i32) nounwind readnone72declare i64 @llvm.ctpop.i64(i64) nounwind readnone73declare i64 @llvm.ppc.popcntb(i64) nounwind readnone74