Home | History | Annotate | Download | only in PowerPC
      1 ; RUN: llc -ppc-gpr-icmps=all -verify-machineinstrs -mcpu=pwr7 < %s | FileCheck %s
      2 ; RUN: llc -ppc-gpr-icmps=all -verify-machineinstrs -mcpu=pwr7 -ppc-gen-isel=false < %s | FileCheck --check-prefix=CHECK-NO-ISEL %s
      3 target datalayout = "E-m:e-i64:64-n32:64"
      4 target triple = "powerpc64-unknown-linux-gnu"
      5 
      6 ; Function Attrs: nounwind readnone
      7 define signext i32 @crbitsoff(i32 signext %v1, i32 signext %v2) #0 {
      8 entry:
      9   %tobool = icmp ne i32 %v1, 0
     10   %lnot = icmp eq i32 %v2, 0
     11   %and3 = and i1 %tobool, %lnot
     12   %and = zext i1 %and3 to i32
     13   ret i32 %and
     14 
     15 ; CHECK-LABEL: @crbitsoff
     16 ; CHECK-NO-ISEL-LABEL: @crbitsoff
     17 ; CHECK-DAG: cmplwi {{[0-9]+}}, 3, 0
     18 ; CHECK-DAG: li [[REG2:[0-9]+]], 1
     19 ; CHECK-DAG: cntlzw [[REG3:[0-9]+]],
     20 ; CHECK: isel [[REG4:[0-9]+]], 0, [[REG2]]
     21 ; CHECK-NO-ISEL: bc 12, 2, [[TRUE:.LBB[0-9]+]]
     22 ; CHECK-NO-ISEL: ori 4, 5, 0
     23 ; CHECK-NO-ISEL-NEXT: b [[SUCCESSOR:.LBB[0-9]+]]
     24 ; CHECK-NO-ISEL: [[TRUE]]
     25 ; CHECK-NO-ISEL-NEXT: addi 4, 0, 0
     26 ; CHECK: and 3, [[REG4]], [[REG3]]
     27 ; CHECK: blr
     28 }
     29 
     30 define signext i32 @crbitson(i32 signext %v1, i32 signext %v2) #1 {
     31 entry:
     32   %tobool = icmp ne i32 %v1, 0
     33   %lnot = icmp eq i32 %v2, 0
     34   %and3 = and i1 %tobool, %lnot
     35   %and = zext i1 %and3 to i32
     36   ret i32 %and
     37 
     38 ; CHECK-LABEL: @crbitson
     39 ; CHECK-NO-ISEL-LABEL: @crbitson
     40 ; CHECK-DAG: cntlzw [[REG1:[0-9]+]], 3
     41 ; CHECK-DAG: cntlzw [[REG2:[0-9]+]], 4
     42 ; CHECK: srwi [[REG3:[0-9]+]], [[REG1]], 5
     43 ; CHECK: srwi [[REG4:[0-9]+]], [[REG2]], 5
     44 ; CHECK: xori [[REG5:[0-9]+]], [[REG3]], 1
     45 ; CHECK: and 3, [[REG5]], [[REG4]]
     46 ; CHECK-NEXT: blr
     47 }
     48 
     49 
     50 attributes #0 = { nounwind readnone "target-features"="-crbits" }
     51 attributes #1 = { nounwind readnone }
     52 
     53