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