1; RUN: llc < %s -mtriple=powerpc64-apple-darwin | FileCheck %s
2
3; TODO: These could use 'andc'.
4
5define i1 @and_cmp1(i32 %x, i32 %y) {
6; CHECK-LABEL: and_cmp1:
7; CHECK:       ; BB#0:
8; CHECK-NEXT:    and r2, r3, r4
9; CHECK-NEXT:    li r3, 1
10; CHECK-NEXT:    cmpw cr0, r2, r4
11; CHECK-NEXT:    bclr 12, 2, 0
12; CHECK-NEXT:  ; BB#1:
13; CHECK-NEXT:    li r3, 0
14; CHECK-NEXT:    blr
15;
16  %and = and i32 %x, %y
17  %cmp = icmp eq i32 %and, %y
18  ret i1 %cmp
19}
20
21define i1 @and_cmp_const(i32 %x) {
22; CHECK-LABEL: and_cmp_const:
23; CHECK:       ; BB#0:
24; CHECK-NEXT:    andi. r2, r3, 43
25; CHECK-NEXT:    li r3, 1
26; CHECK-NEXT:    cmpwi r2, 43
27; CHECK-NEXT:    bclr 12, 2, 0
28; CHECK-NEXT:  ; BB#1:
29; CHECK-NEXT:    li r3, 0
30; CHECK-NEXT:    blr
31;
32  %and = and i32 %x, 43
33  %cmp = icmp eq i32 %and, 43
34  ret i1 %cmp
35}
36
37