1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
4 define i32 @ori32i32_eq(i32 %x, i32 %y) {
5 ; CHECK-LABEL: ori32i32_eq:
7 ; CHECK-NEXT: and w8, w0, #0x1
8 ; CHECK-NEXT: cmp w1, #0
9 ; CHECK-NEXT: csinc w0, w8, wzr, ne
12 %c = icmp eq i32 %y, 0
13 %cz = zext i1 %c to i32
18 define i32 @ori32_eq_c(i32 %x, i32 %y) {
19 ; CHECK-LABEL: ori32_eq_c:
21 ; CHECK-NEXT: and w8, w0, #0x1
22 ; CHECK-NEXT: cmp w1, #0
23 ; CHECK-NEXT: csinc w0, w8, wzr, ne
26 %c = icmp eq i32 %y, 0
27 %cz = zext i1 %c to i32
32 define i32 @ori32i64_eq(i32 %x, i64 %y) {
33 ; CHECK-LABEL: ori32i64_eq:
35 ; CHECK-NEXT: and w8, w0, #0x1
36 ; CHECK-NEXT: cmp x1, #0
37 ; CHECK-NEXT: csinc w0, w8, wzr, ne
40 %c = icmp eq i64 %y, 0
41 %cz = zext i1 %c to i32
46 define i32 @ori32_sgt(i32 %x, i32 %y) {
47 ; CHECK-LABEL: ori32_sgt:
49 ; CHECK-NEXT: and w8, w0, #0x1
50 ; CHECK-NEXT: cmp w1, #0
51 ; CHECK-NEXT: csinc w0, w8, wzr, le
54 %c = icmp sgt i32 %y, 0
55 %cz = zext i1 %c to i32
60 ; Negative test - too many demanded bits
61 define i32 @ori32_toomanybits(i32 %x, i32 %y) {
62 ; CHECK-LABEL: ori32_toomanybits:
64 ; CHECK-NEXT: cmp w1, #0
65 ; CHECK-NEXT: and w8, w0, #0x3
66 ; CHECK-NEXT: cset w9, eq
67 ; CHECK-NEXT: orr w0, w8, w9
70 %c = icmp eq i32 %y, 0
71 %cz = zext i1 %c to i32
76 define i32 @andi32_ne(i8 %x, i8 %y) {
77 ; CHECK-LABEL: andi32_ne:
79 ; CHECK-NEXT: tst w0, #0xff
80 ; CHECK-NEXT: cset w8, eq
81 ; CHECK-NEXT: tst w1, #0xff
82 ; CHECK-NEXT: csel w0, wzr, w8, eq
84 %xc = icmp eq i8 %x, 0
85 %xa = zext i1 %xc to i32
87 %cz = zext i1 %c to i32
92 define i32 @andi32_sgt(i8 %x, i8 %y) {
93 ; CHECK-LABEL: andi32_sgt:
95 ; CHECK-NEXT: sxtb w8, w1
96 ; CHECK-NEXT: tst w0, #0xff
97 ; CHECK-NEXT: ccmp w8, #0, #4, eq
98 ; CHECK-NEXT: cset w0, gt
100 %xc = icmp eq i8 %x, 0
101 %xa = zext i1 %xc to i32
102 %c = icmp sgt i8 %y, 0
103 %cz = zext i1 %c to i32
104 %a = and i32 %xa, %cz
108 define i64 @ori64i32_eq(i64 %x, i32 %y) {
109 ; CHECK-LABEL: ori64i32_eq:
111 ; CHECK-NEXT: and x8, x0, #0x1
112 ; CHECK-NEXT: cmp w1, #0
113 ; CHECK-NEXT: csinc x0, x8, xzr, ne
116 %c = icmp eq i32 %y, 0
117 %cz = zext i1 %c to i64
122 define i64 @ori64i64_eq(i64 %x, i64 %y) {
123 ; CHECK-LABEL: ori64i64_eq:
125 ; CHECK-NEXT: and x8, x0, #0x1
126 ; CHECK-NEXT: cmp x1, #0
127 ; CHECK-NEXT: csinc x0, x8, xzr, ne
130 %c = icmp eq i64 %y, 0
131 %cz = zext i1 %c to i64
136 define i64 @ori64_eq_c(i64 %x, i32 %y) {
137 ; CHECK-LABEL: ori64_eq_c:
139 ; CHECK-NEXT: and x8, x0, #0x1
140 ; CHECK-NEXT: cmp w1, #0
141 ; CHECK-NEXT: csinc x0, x8, xzr, ne
144 %c = icmp eq i32 %y, 0
145 %cz = zext i1 %c to i64
150 define i64 @andi64_ne(i8 %x, i8 %y) {
151 ; CHECK-LABEL: andi64_ne:
153 ; CHECK-NEXT: tst w0, #0xff
154 ; CHECK-NEXT: cset w8, eq
155 ; CHECK-NEXT: tst w1, #0xff
156 ; CHECK-NEXT: csel w0, wzr, w8, eq
158 %xc = icmp eq i8 %x, 0
159 %xa = zext i1 %xc to i64
160 %c = icmp ne i8 %y, 0
161 %cz = zext i1 %c to i64
162 %a = and i64 %xa, %cz