blob: 1c0c0793d3690244407c873a71c566bd75da0be6 [file] [log] [blame]
Sanjay Patel09c56302016-11-29 19:15:27 +00001; RUN: llc < %s -mtriple=aarch64-unknown-unknown | FileCheck %s
2
3define i1 @andn_cmp(i32 %x, i32 %y) {
4; CHECK-LABEL: andn_cmp:
5; CHECK: // BB#0:
6; CHECK-NEXT: bics wzr, w1, w0
7; CHECK-NEXT: cset w0, eq
8; CHECK-NEXT: ret
9;
10 %notx = xor i32 %x, -1
11 %and = and i32 %notx, %y
12 %cmp = icmp eq i32 %and, 0
13 ret i1 %cmp
14}
15
16; FIXME: Recognize a disguised bics.
17
18define i1 @and_cmp(i32 %x, i32 %y) {
19; CHECK-LABEL: and_cmp:
20; CHECK: // BB#0:
21; CHECK-NEXT: and w8, w0, w1
22; CHECK-NEXT: cmp w8, w1
23; CHECK-NEXT: cset w0, eq
24; CHECK-NEXT: ret
25;
26 %and = and i32 %x, %y
27 %cmp = icmp eq i32 %and, %y
28 ret i1 %cmp
29}
30
31define i1 @and_cmp_const(i32 %x) {
32; CHECK-LABEL: and_cmp_const:
33; CHECK: // BB#0:
34; CHECK-NEXT: mov w8, #43
35; CHECK-NEXT: and w8, w0, w8
36; CHECK-NEXT: cmp w8, #43
37; CHECK-NEXT: cset w0, eq
38; CHECK-NEXT: ret
39;
40 %and = and i32 %x, 43
41 %cmp = icmp eq i32 %and, 43
42 ret i1 %cmp
43}
44