Ehsan Amiri | a538b0f | 2016-08-03 18:17:35 +0000 | [diff] [blame] | 1 | ; RUN: llc -verify-machineinstrs -mcpu=pwr7 < %s | FileCheck %s |
| 2 | ; RUN: llc -verify-machineinstrs -O1 -mcpu=pwr7 < %s | FileCheck %s |
Tony Jiang | 8e8c444 | 2017-01-16 20:12:26 +0000 | [diff] [blame^] | 3 | ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -ppc-gen-isel=false < %s | FileCheck --check-prefix=CHECK-NO-ISEL %s |
| 4 | ; RUN: llc -verify-machineinstrs -O1 -mcpu=pwr7 -ppc-gen-isel=false < %s | FileCheck --check-prefix=CHECK-NO-ISEL %s |
| 5 | |
Hal Finkel | 6aca237 | 2014-03-02 18:23:39 +0000 | [diff] [blame] | 6 | target datalayout = "E-m:e-i64:64-n32:64" |
| 7 | target triple = "powerpc64-unknown-linux-gnu" |
| 8 | |
| 9 | define zeroext i1 @testi1(i1 zeroext %b1, i1 zeroext %b2) #0 { |
| 10 | entry: |
| 11 | %0 = tail call i8 asm "crand $0, $1, $2", "=^wc,^wc,^wc"(i1 %b1, i1 %b2) #0 |
| 12 | %1 = and i8 %0, 1 |
| 13 | %tobool3 = icmp ne i8 %1, 0 |
| 14 | ret i1 %tobool3 |
| 15 | |
| 16 | ; CHECK-LABEL: @testi1 |
| 17 | ; CHECK-DAG: andi. {{[0-9]+}}, 3, 1 |
| 18 | ; CHECK-DAG: li [[REG1:[0-9]+]], 0 |
Hal Finkel | 7c5cb06 | 2015-04-23 18:30:38 +0000 | [diff] [blame] | 19 | ; CHECK-DAG: crmove [[REG2:[0-9]+]], 1 |
Hal Finkel | 6aca237 | 2014-03-02 18:23:39 +0000 | [diff] [blame] | 20 | ; CHECK-DAG: andi. {{[0-9]+}}, 4, 1 |
| 21 | ; CHECK-DAG: crand [[REG3:[0-9]+]], [[REG2]], 1 |
| 22 | ; CHECK-DAG: li [[REG4:[0-9]+]], 1 |
| 23 | ; CHECK: isel 3, [[REG4]], [[REG1]], [[REG3]] |
Tony Jiang | 8e8c444 | 2017-01-16 20:12:26 +0000 | [diff] [blame^] | 24 | ; CHECK-NO-ISEL-LABEL: @testi1 |
| 25 | ; CHECK-NO-ISEL: bclr 12, 20, 0 |
| 26 | ; CHECK-NO-ISEL: ori 3, 5, 0 |
| 27 | ; CHECK-NO-ISEL-NEXT: blr |
Hal Finkel | 6aca237 | 2014-03-02 18:23:39 +0000 | [diff] [blame] | 28 | ; CHECK: blr |
| 29 | } |
| 30 | |
| 31 | define signext i32 @testi32(i32 signext %b1, i32 signext %b2) #0 { |
| 32 | entry: |
| 33 | %0 = tail call i32 asm "crand $0, $1, $2", "=^wc,^wc,^wc"(i32 %b1, i32 %b2) #0 |
| 34 | ret i32 %0 |
| 35 | |
| 36 | ; The ABI sign_extend should combine with the any_extend from the asm result, |
| 37 | ; and the result will be 0 or -1. This highlights the fact that only the first |
| 38 | ; bit is meaningful. |
| 39 | ; CHECK-LABEL: @testi32 |
| 40 | ; CHECK-DAG: andi. {{[0-9]+}}, 3, 1 |
| 41 | ; CHECK-DAG: li [[REG1:[0-9]+]], 0 |
Hal Finkel | 7c5cb06 | 2015-04-23 18:30:38 +0000 | [diff] [blame] | 42 | ; CHECK-DAG: crmove [[REG2:[0-9]+]], 1 |
Hal Finkel | 6aca237 | 2014-03-02 18:23:39 +0000 | [diff] [blame] | 43 | ; CHECK-DAG: andi. {{[0-9]+}}, 4, 1 |
| 44 | ; CHECK-DAG: crand [[REG3:[0-9]+]], [[REG2]], 1 |
| 45 | ; CHECK-DAG: li [[REG4:[0-9]+]], -1 |
| 46 | ; CHECK: isel 3, [[REG4]], [[REG1]], [[REG3]] |
| 47 | ; CHECK: blr |
| 48 | } |
| 49 | |
| 50 | define zeroext i8 @testi8(i8 zeroext %b1, i8 zeroext %b2) #0 { |
| 51 | entry: |
| 52 | %0 = tail call i8 asm "crand $0, $1, $2", "=^wc,^wc,^wc"(i8 %b1, i8 %b2) #0 |
| 53 | ret i8 %0 |
| 54 | |
| 55 | ; CHECK-LABEL: @testi8 |
| 56 | ; CHECK-DAG: andi. {{[0-9]+}}, 3, 1 |
| 57 | ; CHECK-DAG: li [[REG1:[0-9]+]], 0 |
Hal Finkel | 7c5cb06 | 2015-04-23 18:30:38 +0000 | [diff] [blame] | 58 | ; CHECK-DAG: crmove [[REG2:[0-9]+]], 1 |
Hal Finkel | 6aca237 | 2014-03-02 18:23:39 +0000 | [diff] [blame] | 59 | ; CHECK-DAG: andi. {{[0-9]+}}, 4, 1 |
| 60 | ; CHECK-DAG: crand [[REG3:[0-9]+]], [[REG2]], 1 |
| 61 | ; CHECK-DAG: li [[REG4:[0-9]+]], 1 |
| 62 | ; CHECK: isel 3, [[REG4]], [[REG1]], [[REG3]] |
| 63 | ; CHECK: blr |
| 64 | } |
| 65 | |
Hal Finkel | 0f0d298 | 2015-10-28 19:58:02 +0000 | [diff] [blame] | 66 | attributes #0 = { nounwind "target-features"="+crbits" } |
Hal Finkel | 6aca237 | 2014-03-02 18:23:39 +0000 | [diff] [blame] | 67 | |