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"
6 ; Function Attrs: nounwind readnone
7 define signext i32 @crbitsoff(i32 signext %v1, i32 signext %v2) #0 {
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
15 ; CHECK-LABEL: @crbitsoff
16 ; CHECK-NO-ISEL-LABEL: @crbitsoff
17 ; CHECK-DAG: cmplwi 3, 0
18 ; CHECK-DAG: li [[REG2:[0-9]+]], 1
19 ; CHECK-DAG: cntlzw [[REG3:[0-9]+]],
20 ; CHECK: iseleq [[REG4:[0-9]+]], 0, [[REG2]]
21 ; CHECK-NO-ISEL: bc 12, 2, [[TRUE:.LBB[0-9]+]]
22 ; CHECK-NO-ISEL-NEXT: b [[SUCCESSOR:.LBB[0-9]+]]
23 ; CHECK-NO-ISEL: [[TRUE]]
24 ; CHECK-NO-ISEL-NEXT: li 3, 0
25 ; CHECK: and 3, [[REG4]], [[REG3]]
29 define signext i32 @crbitson(i32 signext %v1, i32 signext %v2) #1 {
31 %tobool = icmp ne i32 %v1, 0
32 %lnot = icmp eq i32 %v2, 0
33 %and3 = and i1 %tobool, %lnot
34 %and = zext i1 %and3 to i32
37 ; CHECK-LABEL: @crbitson
38 ; CHECK-NO-ISEL-LABEL: @crbitson
39 ; CHECK-DAG: cntlzw [[REG1:[0-9]+]], 3
40 ; CHECK-DAG: cntlzw [[REG2:[0-9]+]], 4
41 ; CHECK: srwi [[REG3:[0-9]+]], [[REG1]], 5
42 ; CHECK: srwi [[REG4:[0-9]+]], [[REG2]], 5
43 ; CHECK: xori [[REG5:[0-9]+]], [[REG3]], 1
44 ; CHECK: and 3, [[REG5]], [[REG4]]
49 attributes #0 = { nounwind readnone "target-features"="-crbits" }
50 attributes #1 = { nounwind readnone }