Eric Christopher | 83eb13c | 2015-03-21 03:36:02 +0000 | [diff] [blame] | 1 | ; RUN: llc -mcpu=pwr7 < %s | FileCheck %s |
| 2 | target datalayout = "E-m:e-i64:64-n32:64" |
| 3 | target triple = "powerpc64-unknown-linux-gnu" |
| 4 | |
| 5 | ; Function Attrs: nounwind readnone |
| 6 | define signext i32 @crbitsoff(i32 signext %v1, i32 signext %v2) #0 { |
| 7 | entry: |
| 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 Finkel | 8acae52 | 2015-07-14 20:02:02 +0000 | [diff] [blame] | 18 | ; CHECK: isel [[REG4:[0-9]+]], 0, [[REG2]] |
| 19 | ; CHECK: and 3, [[REG4]], [[REG3]] |
Eric Christopher | 83eb13c | 2015-03-21 03:36:02 +0000 | [diff] [blame] | 20 | ; CHECK: blr |
| 21 | } |
| 22 | |
| 23 | define signext i32 @crbitson(i32 signext %v1, i32 signext %v2) #1 { |
| 24 | entry: |
| 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 | |
| 41 | attributes #0 = { nounwind readnone "target-features"="-crbits" } |
| 42 | attributes #1 = { nounwind readnone } |
| 43 | |