1 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 < %s | FileCheck %s
2 ; RUN: llc -verify-machineinstrs -O1 -mcpu=pwr7 < %s | FileCheck %s
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
6 target datalayout = "E-m:e-i64:64-n32:64"
7 target triple = "powerpc64-unknown-linux-gnu"
9 define zeroext i1 @testi1(i1 zeroext %b1, i1 zeroext %b2) #0 {
11 %0 = tail call i8 asm "crand $0, $1, $2", "=^wc,^wc,^wc"(i1 %b1, i1 %b2) #0
13 %tobool3 = icmp ne i8 %1, 0
16 ; CHECK-LABEL: @testi1
17 ; CHECK-DAG: andi. {{[0-9]+}}, 3, 1
18 ; CHECK-DAG: li [[REG1:[0-9]+]], 0
19 ; CHECK-DAG: crmove [[REG2:[0-9]+]], 1
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]]
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
31 define signext i32 @testi32(i32 signext %b1, i32 signext %b2) #0 {
33 %0 = tail call i32 asm "crand $0, $1, $2", "=^wc,^wc,^wc"(i32 %b1, i32 %b2) #0
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
39 ; CHECK-LABEL: @testi32
40 ; CHECK-DAG: andi. {{[0-9]+}}, 3, 1
41 ; CHECK-DAG: li [[REG1:[0-9]+]], 0
42 ; CHECK-DAG: crmove [[REG2:[0-9]+]], 1
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]]
50 define zeroext i8 @testi8(i8 zeroext %b1, i8 zeroext %b2) #0 {
52 %0 = tail call i8 asm "crand $0, $1, $2", "=^wc,^wc,^wc"(i8 %b1, i8 %b2) #0
55 ; CHECK-LABEL: @testi8
56 ; CHECK-DAG: andi. {{[0-9]+}}, 3, 1
57 ; CHECK-DAG: li [[REG1:[0-9]+]], 0
58 ; CHECK-DAG: crmove [[REG2:[0-9]+]], 1
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]]
66 attributes #0 = { nounwind "target-features"="+crbits" }