1 ; RUN: llc -mtriple=aarch64-apple-darwin -fast-isel=0 -verify-machineinstrs < %s | FileCheck %s
2 ; RUN: llc -mtriple=aarch64-apple-darwin -fast-isel=1 -fast-isel-abort=1 -verify-machineinstrs < %s | FileCheck %s
5 define zeroext i1 @and_rr_i1(i1 signext %a, i1 signext %b) {
6 ; CHECK-LABEL: and_rr_i1
7 ; CHECK: and [[REG:w[0-9]+]], w0, w1
12 define zeroext i8 @and_rr_i8(i8 signext %a, i8 signext %b) {
13 ; CHECK-LABEL: and_rr_i8
14 ; CHECK: and [[REG:w[0-9]+]], w0, w1
15 ; CHECK-NEXT: and {{w[0-9]+}}, [[REG]], #0xff
20 define zeroext i16 @and_rr_i16(i16 signext %a, i16 signext %b) {
21 ; CHECK-LABEL: and_rr_i16
22 ; CHECK: and [[REG:w[0-9]+]], w0, w1
23 ; CHECK-NEXT: and {{w[0-9]+}}, [[REG]], #0xffff
28 define i32 @and_rr_i32(i32 %a, i32 %b) {
29 ; CHECK-LABEL: and_rr_i32
30 ; CHECK: and w0, w0, w1
35 define i64 @and_rr_i64(i64 %a, i64 %b) {
36 ; CHECK-LABEL: and_rr_i64
37 ; CHECK: and x0, x0, x1
42 define zeroext i1 @and_ri_i1(i1 signext %a) {
43 ; CHECK-LABEL: and_ri_i1
44 ; CHECK: and {{w[0-9]+}}, w0, #0x1
49 define zeroext i8 @and_ri_i8(i8 signext %a) {
50 ; CHECK-LABEL: and_ri_i8
51 ; CHECK: and {{w[0-9]+}}, w0, #0xf
56 define zeroext i16 @and_ri_i16(i16 signext %a) {
57 ; CHECK-LABEL: and_ri_i16
58 ; CHECK: and {{w[0-9]+}}, w0, #0xff
63 define i32 @and_ri_i32(i32 %a) {
64 ; CHECK-LABEL: and_ri_i32
65 ; CHECK: and w0, w0, #0xff
70 define i64 @and_ri_i64(i64 %a) {
71 ; CHECK-LABEL: and_ri_i64
72 ; CHECK: and x0, x0, #0xff
77 define zeroext i8 @and_rs_i8(i8 signext %a, i8 signext %b) {
78 ; CHECK-LABEL: and_rs_i8
79 ; CHECK: and [[REG:w[0-9]+]], w0, w1, lsl #4
80 ; CHECK-NEXT: and {{w[0-9]+}}, [[REG]], {{#0xff|#0xf0}}
86 define zeroext i16 @and_rs_i16(i16 signext %a, i16 signext %b) {
87 ; CHECK-LABEL: and_rs_i16
88 ; CHECK: and [[REG:w[0-9]+]], w0, w1, lsl #8
89 ; CHECK-NEXT: and {{w[0-9]+}}, [[REG]], {{#0xffff|#0xff00}}
95 define i32 @and_rs_i32(i32 %a, i32 %b) {
96 ; CHECK-LABEL: and_rs_i32
97 ; CHECK: and w0, w0, w1, lsl #8
103 define i64 @and_rs_i64(i64 %a, i64 %b) {
104 ; CHECK-LABEL: and_rs_i64
105 ; CHECK: and x0, x0, x1, lsl #8
111 define i32 @and_mul_i32(i32 %a, i32 %b) {
112 ; CHECK-LABEL: and_mul_i32
113 ; CHECK: and w0, w0, w1, lsl #2
119 define i64 @and_mul_i64(i64 %a, i64 %b) {
120 ; CHECK-LABEL: and_mul_i64
121 ; CHECK: and x0, x0, x1, lsl #2
128 define zeroext i1 @or_rr_i1(i1 signext %a, i1 signext %b) {
129 ; CHECK-LABEL: or_rr_i1
130 ; CHECK: orr [[REG:w[0-9]+]], w0, w1
135 define zeroext i8 @or_rr_i8(i8 signext %a, i8 signext %b) {
136 ; CHECK-LABEL: or_rr_i8
137 ; CHECK: orr [[REG:w[0-9]+]], w0, w1
138 ; CHECK-NEXT: and {{w[0-9]+}}, [[REG]], #0xff
143 define zeroext i16 @or_rr_i16(i16 signext %a, i16 signext %b) {
144 ; CHECK-LABEL: or_rr_i16
145 ; CHECK: orr [[REG:w[0-9]+]], w0, w1
146 ; CHECK-NEXT: and {{w[0-9]+}}, [[REG]], #0xffff
151 define i32 @or_rr_i32(i32 %a, i32 %b) {
152 ; CHECK-LABEL: or_rr_i32
153 ; CHECK: orr w0, w0, w1
158 define i64 @or_rr_i64(i64 %a, i64 %b) {
159 ; CHECK-LABEL: or_rr_i64
160 ; CHECK: orr x0, x0, x1
165 define zeroext i8 @or_ri_i8(i8 %a) {
166 ; CHECK-LABEL: or_ri_i8
167 ; CHECK: orr [[REG:w[0-9]+]], w0, #0xf
168 ; CHECK-NEXT: and {{w[0-9]+}}, [[REG]], #0xff
173 define zeroext i16 @or_ri_i16(i16 %a) {
174 ; CHECK-LABEL: or_ri_i16
175 ; CHECK: orr [[REG:w[0-9]+]], w0, #0xff
176 ; CHECK-NEXT: and {{w[0-9]+}}, [[REG]], #0xffff
181 define i32 @or_ri_i32(i32 %a) {
182 ; CHECK-LABEL: or_ri_i32
183 ; CHECK: orr w0, w0, #0xff
188 define i64 @or_ri_i64(i64 %a) {
189 ; CHECK-LABEL: or_ri_i64
190 ; CHECK: orr x0, x0, #0xff
195 define zeroext i8 @or_rs_i8(i8 signext %a, i8 signext %b) {
196 ; CHECK-LABEL: or_rs_i8
197 ; CHECK: orr [[REG:w[0-9]+]], w0, w1, lsl #4
198 ; CHECK-NEXT: and {{w[0-9]+}}, [[REG]], {{#0xff|#0xf0}}
204 define zeroext i16 @or_rs_i16(i16 signext %a, i16 signext %b) {
205 ; CHECK-LABEL: or_rs_i16
206 ; CHECK: orr [[REG:w[0-9]+]], w0, w1, lsl #8
207 ; CHECK-NEXT: and {{w[0-9]+}}, [[REG]], {{#0xffff|#0xff00}}
213 define i32 @or_rs_i32(i32 %a, i32 %b) {
214 ; CHECK-LABEL: or_rs_i32
215 ; CHECK: orr w0, w0, w1, lsl #8
221 define i64 @or_rs_i64(i64 %a, i64 %b) {
222 ; CHECK-LABEL: or_rs_i64
223 ; CHECK: orr x0, x0, x1, lsl #8
229 define i32 @or_mul_i32(i32 %a, i32 %b) {
230 ; CHECK-LABEL: or_mul_i32
231 ; CHECK: orr w0, w0, w1, lsl #2
237 define i64 @or_mul_i64(i64 %a, i64 %b) {
238 ; CHECK-LABEL: or_mul_i64
239 ; CHECK: orr x0, x0, x1, lsl #2
246 define zeroext i1 @xor_rr_i1(i1 signext %a, i1 signext %b) {
247 ; CHECK-LABEL: xor_rr_i1
248 ; CHECK: eor [[REG:w[0-9]+]], w0, w1
253 define zeroext i8 @xor_rr_i8(i8 signext %a, i8 signext %b) {
254 ; CHECK-LABEL: xor_rr_i8
255 ; CHECK: eor [[REG:w[0-9]+]], w0, w1
256 ; CHECK-NEXT: and {{w[0-9]+}}, [[REG]], #0xff
261 define zeroext i16 @xor_rr_i16(i16 signext %a, i16 signext %b) {
262 ; CHECK-LABEL: xor_rr_i16
263 ; CHECK: eor [[REG:w[0-9]+]], w0, w1
264 ; CHECK-NEXT: and {{w[0-9]+}}, [[REG]], #0xffff
269 define i32 @xor_rr_i32(i32 %a, i32 %b) {
270 ; CHECK-LABEL: xor_rr_i32
271 ; CHECK: eor w0, w0, w1
276 define i64 @xor_rr_i64(i64 %a, i64 %b) {
277 ; CHECK-LABEL: xor_rr_i64
278 ; CHECK: eor x0, x0, x1
283 define zeroext i8 @xor_ri_i8(i8 signext %a) {
284 ; CHECK-LABEL: xor_ri_i8
285 ; CHECK: eor [[REG:w[0-9]+]], w0, #0xf
286 ; CHECK-NEXT: and {{w[0-9]+}}, [[REG]], #0xff
291 define zeroext i16 @xor_ri_i16(i16 signext %a) {
292 ; CHECK-LABEL: xor_ri_i16
293 ; CHECK: eor [[REG:w[0-9]+]], w0, #0xff
294 ; CHECK-NEXT: and {{w[0-9]+}}, [[REG]], #0xffff
299 define i32 @xor_ri_i32(i32 %a) {
300 ; CHECK-LABEL: xor_ri_i32
301 ; CHECK: eor w0, w0, #0xff
306 define i64 @xor_ri_i64(i64 %a) {
307 ; CHECK-LABEL: xor_ri_i64
308 ; CHECK: eor x0, x0, #0xff
313 define zeroext i8 @xor_rs_i8(i8 %a, i8 %b) {
314 ; CHECK-LABEL: xor_rs_i8
315 ; CHECK: eor [[REG:w[0-9]+]], w0, w1, lsl #4
316 ; CHECK-NEXT: and {{w[0-9]+}}, [[REG]], {{#0xff|#0xf0}}
322 define zeroext i16 @xor_rs_i16(i16 %a, i16 %b) {
323 ; CHECK-LABEL: xor_rs_i16
324 ; CHECK: eor [[REG:w[0-9]+]], w0, w1, lsl #8
325 ; CHECK-NEXT: and {{w[0-9]+}}, [[REG]], {{#0xffff|#0xff00}}
331 define i32 @xor_rs_i32(i32 %a, i32 %b) {
332 ; CHECK-LABEL: xor_rs_i32
333 ; CHECK: eor w0, w0, w1, lsl #8
339 define i64 @xor_rs_i64(i64 %a, i64 %b) {
340 ; CHECK-LABEL: xor_rs_i64
341 ; CHECK: eor x0, x0, x1, lsl #8
347 define i32 @xor_mul_i32(i32 %a, i32 %b) {
348 ; CHECK-LABEL: xor_mul_i32
349 ; CHECK: eor w0, w0, w1, lsl #2
355 define i64 @xor_mul_i64(i64 %a, i64 %b) {
356 ; CHECK-LABEL: xor_mul_i64
357 ; CHECK: eor x0, x0, x1, lsl #2