blob: c69f30017d881a24485cac7a6db11c115b13c736 [file] [log] [blame]
Eric Christopher83eb13c2015-03-21 03:36:02 +00001; RUN: llc -mcpu=pwr7 < %s | FileCheck %s
2target datalayout = "E-m:e-i64:64-n32:64"
3target triple = "powerpc64-unknown-linux-gnu"
4
5; Function Attrs: nounwind readnone
6define signext i32 @crbitsoff(i32 signext %v1, i32 signext %v2) #0 {
7entry:
8 %tobool = icmp ne i32 %v1, 0
9 %lnot = icmp eq i32 %v2, 0
10 %and3 = and i1 %tobool, %lnot
11 %and = zext i1 %and3 to i32
12 ret i32 %and
13
14; CHECK-LABEL: @crbitsoff
15; CHECK-DAG: cmplwi {{[0-9]+}}, 3, 0
16; CHECK-DAG: li [[REG2:[0-9]+]], 1
17; CHECK-DAG: cntlzw [[REG3:[0-9]+]],
Hal Finkel8acae522015-07-14 20:02:02 +000018; CHECK: isel [[REG4:[0-9]+]], 0, [[REG2]]
19; CHECK: and 3, [[REG4]], [[REG3]]
Eric Christopher83eb13c2015-03-21 03:36:02 +000020; CHECK: blr
21}
22
23define signext i32 @crbitson(i32 signext %v1, i32 signext %v2) #1 {
24entry:
25 %tobool = icmp ne i32 %v1, 0
26 %lnot = icmp eq i32 %v2, 0
27 %and3 = and i1 %tobool, %lnot
28 %and = zext i1 %and3 to i32
29 ret i32 %and
30
31; CHECK-LABEL: @crbitson
32; CHECK-DAG: cmpwi {{[0-9]+}}, 3, 0
33; CHECK-DAG: cmpwi {{[0-9]+}}, 4, 0
34; CHECK-DAG: li [[REG2:[0-9]+]], 1
35; CHECK-DAG: crorc [[REG3:[0-9]+]],
36; CHECK: isel 3, 0, [[REG2]], [[REG3]]
37; CHECK: blr
38}
39
40
41attributes #0 = { nounwind readnone "target-features"="-crbits" }
42attributes #1 = { nounwind readnone }
43