1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=armv7 %s -o - | FileCheck %s --check-prefix=ARM
3 ; RUN: llc -mtriple=armv7eb %s -o - | FileCheck %s --check-prefix=ARMEB
4 ; RUN: llc -mtriple=armv6m %s -o - | FileCheck %s --check-prefix=THUMB1
5 ; RUN: llc -mtriple=thumbv8m.main %s -o - | FileCheck %s --check-prefix=THUMB2
7 define arm_aapcscc zeroext i1 @cmp_xor8_short_short(ptr nocapture readonly %a, ptr nocapture readonly %b) {
8 ; ARM-LABEL: cmp_xor8_short_short:
9 ; ARM: @ %bb.0: @ %entry
10 ; ARM-NEXT: ldrb r0, [r0]
11 ; ARM-NEXT: ldrb r1, [r1]
12 ; ARM-NEXT: eor r0, r1, r0
13 ; ARM-NEXT: clz r0, r0
14 ; ARM-NEXT: lsr r0, r0, #5
17 ; ARMEB-LABEL: cmp_xor8_short_short:
18 ; ARMEB: @ %bb.0: @ %entry
19 ; ARMEB-NEXT: ldrb r0, [r0, #1]
20 ; ARMEB-NEXT: ldrb r1, [r1, #1]
21 ; ARMEB-NEXT: eor r0, r1, r0
22 ; ARMEB-NEXT: clz r0, r0
23 ; ARMEB-NEXT: lsr r0, r0, #5
26 ; THUMB1-LABEL: cmp_xor8_short_short:
27 ; THUMB1: @ %bb.0: @ %entry
28 ; THUMB1-NEXT: ldrb r0, [r0]
29 ; THUMB1-NEXT: ldrb r1, [r1]
30 ; THUMB1-NEXT: eors r1, r0
31 ; THUMB1-NEXT: rsbs r0, r1, #0
32 ; THUMB1-NEXT: adcs r0, r1
35 ; THUMB2-LABEL: cmp_xor8_short_short:
36 ; THUMB2: @ %bb.0: @ %entry
37 ; THUMB2-NEXT: ldrb r0, [r0]
38 ; THUMB2-NEXT: ldrb r1, [r1]
39 ; THUMB2-NEXT: eors r0, r1
40 ; THUMB2-NEXT: clz r0, r0
41 ; THUMB2-NEXT: lsrs r0, r0, #5
44 %0 = load i16, ptr %a, align 2
45 %1 = load i16, ptr %b, align 2
46 %xor2 = xor i16 %1, %0
47 %2 = and i16 %xor2, 255
48 %cmp = icmp eq i16 %2, 0
52 define arm_aapcscc zeroext i1 @cmp_xor8_short_int(ptr nocapture readonly %a, ptr nocapture readonly %b) {
53 ; ARM-LABEL: cmp_xor8_short_int:
54 ; ARM: @ %bb.0: @ %entry
55 ; ARM-NEXT: ldrb r0, [r0]
56 ; ARM-NEXT: ldrb r1, [r1]
57 ; ARM-NEXT: eor r0, r1, r0
58 ; ARM-NEXT: clz r0, r0
59 ; ARM-NEXT: lsr r0, r0, #5
62 ; ARMEB-LABEL: cmp_xor8_short_int:
63 ; ARMEB: @ %bb.0: @ %entry
64 ; ARMEB-NEXT: ldrb r0, [r0, #1]
65 ; ARMEB-NEXT: ldrb r1, [r1, #3]
66 ; ARMEB-NEXT: eor r0, r1, r0
67 ; ARMEB-NEXT: clz r0, r0
68 ; ARMEB-NEXT: lsr r0, r0, #5
71 ; THUMB1-LABEL: cmp_xor8_short_int:
72 ; THUMB1: @ %bb.0: @ %entry
73 ; THUMB1-NEXT: ldrb r0, [r0]
74 ; THUMB1-NEXT: ldrb r1, [r1]
75 ; THUMB1-NEXT: eors r1, r0
76 ; THUMB1-NEXT: rsbs r0, r1, #0
77 ; THUMB1-NEXT: adcs r0, r1
80 ; THUMB2-LABEL: cmp_xor8_short_int:
81 ; THUMB2: @ %bb.0: @ %entry
82 ; THUMB2-NEXT: ldrb r0, [r0]
83 ; THUMB2-NEXT: ldrb r1, [r1]
84 ; THUMB2-NEXT: eors r0, r1
85 ; THUMB2-NEXT: clz r0, r0
86 ; THUMB2-NEXT: lsrs r0, r0, #5
89 %0 = load i16, ptr %a, align 2
90 %conv = zext i16 %0 to i32
91 %1 = load i32, ptr %b, align 4
92 %xor = xor i32 %1, %conv
93 %and = and i32 %xor, 255
94 %cmp = icmp eq i32 %and, 0
98 define arm_aapcscc zeroext i1 @cmp_xor8_int_int(ptr nocapture readonly %a, ptr nocapture readonly %b) {
99 ; ARM-LABEL: cmp_xor8_int_int:
100 ; ARM: @ %bb.0: @ %entry
101 ; ARM-NEXT: ldrb r0, [r0]
102 ; ARM-NEXT: ldrb r1, [r1]
103 ; ARM-NEXT: eor r0, r1, r0
104 ; ARM-NEXT: clz r0, r0
105 ; ARM-NEXT: lsr r0, r0, #5
108 ; ARMEB-LABEL: cmp_xor8_int_int:
109 ; ARMEB: @ %bb.0: @ %entry
110 ; ARMEB-NEXT: ldrb r0, [r0, #3]
111 ; ARMEB-NEXT: ldrb r1, [r1, #3]
112 ; ARMEB-NEXT: eor r0, r1, r0
113 ; ARMEB-NEXT: clz r0, r0
114 ; ARMEB-NEXT: lsr r0, r0, #5
117 ; THUMB1-LABEL: cmp_xor8_int_int:
118 ; THUMB1: @ %bb.0: @ %entry
119 ; THUMB1-NEXT: ldrb r0, [r0]
120 ; THUMB1-NEXT: ldrb r1, [r1]
121 ; THUMB1-NEXT: eors r1, r0
122 ; THUMB1-NEXT: rsbs r0, r1, #0
123 ; THUMB1-NEXT: adcs r0, r1
126 ; THUMB2-LABEL: cmp_xor8_int_int:
127 ; THUMB2: @ %bb.0: @ %entry
128 ; THUMB2-NEXT: ldrb r0, [r0]
129 ; THUMB2-NEXT: ldrb r1, [r1]
130 ; THUMB2-NEXT: eors r0, r1
131 ; THUMB2-NEXT: clz r0, r0
132 ; THUMB2-NEXT: lsrs r0, r0, #5
135 %0 = load i32, ptr %a, align 4
136 %1 = load i32, ptr %b, align 4
137 %xor = xor i32 %1, %0
138 %and = and i32 %xor, 255
139 %cmp = icmp eq i32 %and, 0
143 define arm_aapcscc zeroext i1 @cmp_xor16(ptr nocapture readonly %a, ptr nocapture readonly %b) {
144 ; ARM-LABEL: cmp_xor16:
145 ; ARM: @ %bb.0: @ %entry
146 ; ARM-NEXT: ldrh r0, [r0]
147 ; ARM-NEXT: ldrh r1, [r1]
148 ; ARM-NEXT: eor r0, r1, r0
149 ; ARM-NEXT: clz r0, r0
150 ; ARM-NEXT: lsr r0, r0, #5
153 ; ARMEB-LABEL: cmp_xor16:
154 ; ARMEB: @ %bb.0: @ %entry
155 ; ARMEB-NEXT: ldrh r0, [r0, #2]
156 ; ARMEB-NEXT: ldrh r1, [r1, #2]
157 ; ARMEB-NEXT: eor r0, r1, r0
158 ; ARMEB-NEXT: clz r0, r0
159 ; ARMEB-NEXT: lsr r0, r0, #5
162 ; THUMB1-LABEL: cmp_xor16:
163 ; THUMB1: @ %bb.0: @ %entry
164 ; THUMB1-NEXT: ldrh r0, [r0]
165 ; THUMB1-NEXT: ldrh r1, [r1]
166 ; THUMB1-NEXT: eors r1, r0
167 ; THUMB1-NEXT: rsbs r0, r1, #0
168 ; THUMB1-NEXT: adcs r0, r1
171 ; THUMB2-LABEL: cmp_xor16:
172 ; THUMB2: @ %bb.0: @ %entry
173 ; THUMB2-NEXT: ldrh r0, [r0]
174 ; THUMB2-NEXT: ldrh r1, [r1]
175 ; THUMB2-NEXT: eors r0, r1
176 ; THUMB2-NEXT: clz r0, r0
177 ; THUMB2-NEXT: lsrs r0, r0, #5
180 %0 = load i32, ptr %a, align 4
181 %1 = load i32, ptr %b, align 4
182 %xor = xor i32 %1, %0
183 %and = and i32 %xor, 65535
184 %cmp = icmp eq i32 %and, 0
188 define arm_aapcscc zeroext i1 @cmp_or8_short_short(ptr nocapture readonly %a, ptr nocapture readonly %b) {
189 ; ARM-LABEL: cmp_or8_short_short:
190 ; ARM: @ %bb.0: @ %entry
191 ; ARM-NEXT: ldrb r0, [r0]
192 ; ARM-NEXT: ldrb r1, [r1]
193 ; ARM-NEXT: orr r0, r1, r0
194 ; ARM-NEXT: clz r0, r0
195 ; ARM-NEXT: lsr r0, r0, #5
198 ; ARMEB-LABEL: cmp_or8_short_short:
199 ; ARMEB: @ %bb.0: @ %entry
200 ; ARMEB-NEXT: ldrb r0, [r0, #1]
201 ; ARMEB-NEXT: ldrb r1, [r1, #1]
202 ; ARMEB-NEXT: orr r0, r1, r0
203 ; ARMEB-NEXT: clz r0, r0
204 ; ARMEB-NEXT: lsr r0, r0, #5
207 ; THUMB1-LABEL: cmp_or8_short_short:
208 ; THUMB1: @ %bb.0: @ %entry
209 ; THUMB1-NEXT: ldrb r0, [r0]
210 ; THUMB1-NEXT: ldrb r1, [r1]
211 ; THUMB1-NEXT: orrs r1, r0
212 ; THUMB1-NEXT: rsbs r0, r1, #0
213 ; THUMB1-NEXT: adcs r0, r1
216 ; THUMB2-LABEL: cmp_or8_short_short:
217 ; THUMB2: @ %bb.0: @ %entry
218 ; THUMB2-NEXT: ldrb r0, [r0]
219 ; THUMB2-NEXT: ldrb r1, [r1]
220 ; THUMB2-NEXT: orrs r0, r1
221 ; THUMB2-NEXT: clz r0, r0
222 ; THUMB2-NEXT: lsrs r0, r0, #5
225 %0 = load i16, ptr %a, align 2
226 %1 = load i16, ptr %b, align 2
228 %2 = and i16 %or2, 255
229 %cmp = icmp eq i16 %2, 0
233 define arm_aapcscc zeroext i1 @cmp_or8_short_int(ptr nocapture readonly %a, ptr nocapture readonly %b) {
234 ; ARM-LABEL: cmp_or8_short_int:
235 ; ARM: @ %bb.0: @ %entry
236 ; ARM-NEXT: ldrb r0, [r0]
237 ; ARM-NEXT: ldrb r1, [r1]
238 ; ARM-NEXT: orr r0, r1, r0
239 ; ARM-NEXT: clz r0, r0
240 ; ARM-NEXT: lsr r0, r0, #5
243 ; ARMEB-LABEL: cmp_or8_short_int:
244 ; ARMEB: @ %bb.0: @ %entry
245 ; ARMEB-NEXT: ldrb r0, [r0, #1]
246 ; ARMEB-NEXT: ldrb r1, [r1, #3]
247 ; ARMEB-NEXT: orr r0, r1, r0
248 ; ARMEB-NEXT: clz r0, r0
249 ; ARMEB-NEXT: lsr r0, r0, #5
252 ; THUMB1-LABEL: cmp_or8_short_int:
253 ; THUMB1: @ %bb.0: @ %entry
254 ; THUMB1-NEXT: ldrb r0, [r0]
255 ; THUMB1-NEXT: ldrb r1, [r1]
256 ; THUMB1-NEXT: orrs r1, r0
257 ; THUMB1-NEXT: rsbs r0, r1, #0
258 ; THUMB1-NEXT: adcs r0, r1
261 ; THUMB2-LABEL: cmp_or8_short_int:
262 ; THUMB2: @ %bb.0: @ %entry
263 ; THUMB2-NEXT: ldrb r0, [r0]
264 ; THUMB2-NEXT: ldrb r1, [r1]
265 ; THUMB2-NEXT: orrs r0, r1
266 ; THUMB2-NEXT: clz r0, r0
267 ; THUMB2-NEXT: lsrs r0, r0, #5
270 %0 = load i16, ptr %a, align 2
271 %conv = zext i16 %0 to i32
272 %1 = load i32, ptr %b, align 4
273 %or = or i32 %1, %conv
274 %and = and i32 %or, 255
275 %cmp = icmp eq i32 %and, 0
279 define arm_aapcscc zeroext i1 @cmp_or8_int_int(ptr nocapture readonly %a, ptr nocapture readonly %b) {
280 ; ARM-LABEL: cmp_or8_int_int:
281 ; ARM: @ %bb.0: @ %entry
282 ; ARM-NEXT: ldrb r0, [r0]
283 ; ARM-NEXT: ldrb r1, [r1]
284 ; ARM-NEXT: orr r0, r1, r0
285 ; ARM-NEXT: clz r0, r0
286 ; ARM-NEXT: lsr r0, r0, #5
289 ; ARMEB-LABEL: cmp_or8_int_int:
290 ; ARMEB: @ %bb.0: @ %entry
291 ; ARMEB-NEXT: ldrb r0, [r0, #3]
292 ; ARMEB-NEXT: ldrb r1, [r1, #3]
293 ; ARMEB-NEXT: orr r0, r1, r0
294 ; ARMEB-NEXT: clz r0, r0
295 ; ARMEB-NEXT: lsr r0, r0, #5
298 ; THUMB1-LABEL: cmp_or8_int_int:
299 ; THUMB1: @ %bb.0: @ %entry
300 ; THUMB1-NEXT: ldrb r0, [r0]
301 ; THUMB1-NEXT: ldrb r1, [r1]
302 ; THUMB1-NEXT: orrs r1, r0
303 ; THUMB1-NEXT: rsbs r0, r1, #0
304 ; THUMB1-NEXT: adcs r0, r1
307 ; THUMB2-LABEL: cmp_or8_int_int:
308 ; THUMB2: @ %bb.0: @ %entry
309 ; THUMB2-NEXT: ldrb r0, [r0]
310 ; THUMB2-NEXT: ldrb r1, [r1]
311 ; THUMB2-NEXT: orrs r0, r1
312 ; THUMB2-NEXT: clz r0, r0
313 ; THUMB2-NEXT: lsrs r0, r0, #5
316 %0 = load i32, ptr %a, align 4
317 %1 = load i32, ptr %b, align 4
319 %and = and i32 %or, 255
320 %cmp = icmp eq i32 %and, 0
324 define arm_aapcscc zeroext i1 @cmp_or16(ptr nocapture readonly %a, ptr nocapture readonly %b) {
325 ; ARM-LABEL: cmp_or16:
326 ; ARM: @ %bb.0: @ %entry
327 ; ARM-NEXT: ldrh r0, [r0]
328 ; ARM-NEXT: ldrh r1, [r1]
329 ; ARM-NEXT: orr r0, r1, r0
330 ; ARM-NEXT: clz r0, r0
331 ; ARM-NEXT: lsr r0, r0, #5
334 ; ARMEB-LABEL: cmp_or16:
335 ; ARMEB: @ %bb.0: @ %entry
336 ; ARMEB-NEXT: ldrh r0, [r0, #2]
337 ; ARMEB-NEXT: ldrh r1, [r1, #2]
338 ; ARMEB-NEXT: orr r0, r1, r0
339 ; ARMEB-NEXT: clz r0, r0
340 ; ARMEB-NEXT: lsr r0, r0, #5
343 ; THUMB1-LABEL: cmp_or16:
344 ; THUMB1: @ %bb.0: @ %entry
345 ; THUMB1-NEXT: ldrh r0, [r0]
346 ; THUMB1-NEXT: ldrh r1, [r1]
347 ; THUMB1-NEXT: orrs r1, r0
348 ; THUMB1-NEXT: rsbs r0, r1, #0
349 ; THUMB1-NEXT: adcs r0, r1
352 ; THUMB2-LABEL: cmp_or16:
353 ; THUMB2: @ %bb.0: @ %entry
354 ; THUMB2-NEXT: ldrh r0, [r0]
355 ; THUMB2-NEXT: ldrh r1, [r1]
356 ; THUMB2-NEXT: orrs r0, r1
357 ; THUMB2-NEXT: clz r0, r0
358 ; THUMB2-NEXT: lsrs r0, r0, #5
361 %0 = load i32, ptr %a, align 4
362 %1 = load i32, ptr %b, align 4
364 %and = and i32 %or, 65535
365 %cmp = icmp eq i32 %and, 0
369 define arm_aapcscc zeroext i1 @cmp_and8_short_short(ptr nocapture readonly %a, ptr nocapture readonly %b) {
370 ; ARM-LABEL: cmp_and8_short_short:
371 ; ARM: @ %bb.0: @ %entry
372 ; ARM-NEXT: ldrb r1, [r1]
373 ; ARM-NEXT: ldrb r0, [r0]
374 ; ARM-NEXT: and r0, r0, r1
375 ; ARM-NEXT: clz r0, r0
376 ; ARM-NEXT: lsr r0, r0, #5
379 ; ARMEB-LABEL: cmp_and8_short_short:
380 ; ARMEB: @ %bb.0: @ %entry
381 ; ARMEB-NEXT: ldrb r1, [r1, #1]
382 ; ARMEB-NEXT: ldrb r0, [r0, #1]
383 ; ARMEB-NEXT: and r0, r0, r1
384 ; ARMEB-NEXT: clz r0, r0
385 ; ARMEB-NEXT: lsr r0, r0, #5
388 ; THUMB1-LABEL: cmp_and8_short_short:
389 ; THUMB1: @ %bb.0: @ %entry
390 ; THUMB1-NEXT: ldrb r1, [r1]
391 ; THUMB1-NEXT: ldrb r2, [r0]
392 ; THUMB1-NEXT: ands r2, r1
393 ; THUMB1-NEXT: rsbs r0, r2, #0
394 ; THUMB1-NEXT: adcs r0, r2
397 ; THUMB2-LABEL: cmp_and8_short_short:
398 ; THUMB2: @ %bb.0: @ %entry
399 ; THUMB2-NEXT: ldrb r1, [r1]
400 ; THUMB2-NEXT: ldrb r0, [r0]
401 ; THUMB2-NEXT: ands r0, r1
402 ; THUMB2-NEXT: clz r0, r0
403 ; THUMB2-NEXT: lsrs r0, r0, #5
406 %0 = load i16, ptr %a, align 2
407 %1 = load i16, ptr %b, align 2
408 %and3 = and i16 %0, 255
409 %2 = and i16 %and3, %1
410 %cmp = icmp eq i16 %2, 0
414 define arm_aapcscc zeroext i1 @cmp_and8_short_int(ptr nocapture readonly %a, ptr nocapture readonly %b) {
415 ; ARM-LABEL: cmp_and8_short_int:
416 ; ARM: @ %bb.0: @ %entry
417 ; ARM-NEXT: ldrb r0, [r0]
418 ; ARM-NEXT: ldr r1, [r1]
419 ; ARM-NEXT: and r0, r1, r0
420 ; ARM-NEXT: clz r0, r0
421 ; ARM-NEXT: lsr r0, r0, #5
424 ; ARMEB-LABEL: cmp_and8_short_int:
425 ; ARMEB: @ %bb.0: @ %entry
426 ; ARMEB-NEXT: ldrb r0, [r0, #1]
427 ; ARMEB-NEXT: ldr r1, [r1]
428 ; ARMEB-NEXT: and r0, r1, r0
429 ; ARMEB-NEXT: clz r0, r0
430 ; ARMEB-NEXT: lsr r0, r0, #5
433 ; THUMB1-LABEL: cmp_and8_short_int:
434 ; THUMB1: @ %bb.0: @ %entry
435 ; THUMB1-NEXT: ldrb r0, [r0]
436 ; THUMB1-NEXT: ldr r1, [r1]
437 ; THUMB1-NEXT: ands r1, r0
438 ; THUMB1-NEXT: rsbs r0, r1, #0
439 ; THUMB1-NEXT: adcs r0, r1
442 ; THUMB2-LABEL: cmp_and8_short_int:
443 ; THUMB2: @ %bb.0: @ %entry
444 ; THUMB2-NEXT: ldrb r0, [r0]
445 ; THUMB2-NEXT: ldr r1, [r1]
446 ; THUMB2-NEXT: ands r0, r1
447 ; THUMB2-NEXT: clz r0, r0
448 ; THUMB2-NEXT: lsrs r0, r0, #5
451 %0 = load i16, ptr %a, align 2
452 %1 = load i32, ptr %b, align 4
454 %and = zext i16 %2 to i32
455 %and1 = and i32 %1, %and
456 %cmp = icmp eq i32 %and1, 0
460 define arm_aapcscc zeroext i1 @cmp_and8_int_int(ptr nocapture readonly %a, ptr nocapture readonly %b) {
461 ; ARM-LABEL: cmp_and8_int_int:
462 ; ARM: @ %bb.0: @ %entry
463 ; ARM-NEXT: ldrb r1, [r1]
464 ; ARM-NEXT: ldrb r0, [r0]
465 ; ARM-NEXT: and r0, r0, r1
466 ; ARM-NEXT: clz r0, r0
467 ; ARM-NEXT: lsr r0, r0, #5
470 ; ARMEB-LABEL: cmp_and8_int_int:
471 ; ARMEB: @ %bb.0: @ %entry
472 ; ARMEB-NEXT: ldrb r1, [r1, #3]
473 ; ARMEB-NEXT: ldrb r0, [r0, #3]
474 ; ARMEB-NEXT: and r0, r0, r1
475 ; ARMEB-NEXT: clz r0, r0
476 ; ARMEB-NEXT: lsr r0, r0, #5
479 ; THUMB1-LABEL: cmp_and8_int_int:
480 ; THUMB1: @ %bb.0: @ %entry
481 ; THUMB1-NEXT: ldrb r1, [r1]
482 ; THUMB1-NEXT: ldrb r2, [r0]
483 ; THUMB1-NEXT: ands r2, r1
484 ; THUMB1-NEXT: rsbs r0, r2, #0
485 ; THUMB1-NEXT: adcs r0, r2
488 ; THUMB2-LABEL: cmp_and8_int_int:
489 ; THUMB2: @ %bb.0: @ %entry
490 ; THUMB2-NEXT: ldrb r1, [r1]
491 ; THUMB2-NEXT: ldrb r0, [r0]
492 ; THUMB2-NEXT: ands r0, r1
493 ; THUMB2-NEXT: clz r0, r0
494 ; THUMB2-NEXT: lsrs r0, r0, #5
497 %0 = load i32, ptr %a, align 4
498 %1 = load i32, ptr %b, align 4
499 %and = and i32 %0, 255
500 %and1 = and i32 %and, %1
501 %cmp = icmp eq i32 %and1, 0
505 define arm_aapcscc zeroext i1 @cmp_and16(ptr nocapture readonly %a, ptr nocapture readonly %b) {
506 ; ARM-LABEL: cmp_and16:
507 ; ARM: @ %bb.0: @ %entry
508 ; ARM-NEXT: ldrh r1, [r1]
509 ; ARM-NEXT: ldrh r0, [r0]
510 ; ARM-NEXT: and r0, r0, r1
511 ; ARM-NEXT: clz r0, r0
512 ; ARM-NEXT: lsr r0, r0, #5
515 ; ARMEB-LABEL: cmp_and16:
516 ; ARMEB: @ %bb.0: @ %entry
517 ; ARMEB-NEXT: ldrh r1, [r1, #2]
518 ; ARMEB-NEXT: ldrh r0, [r0, #2]
519 ; ARMEB-NEXT: and r0, r0, r1
520 ; ARMEB-NEXT: clz r0, r0
521 ; ARMEB-NEXT: lsr r0, r0, #5
524 ; THUMB1-LABEL: cmp_and16:
525 ; THUMB1: @ %bb.0: @ %entry
526 ; THUMB1-NEXT: ldrh r1, [r1]
527 ; THUMB1-NEXT: ldrh r2, [r0]
528 ; THUMB1-NEXT: ands r2, r1
529 ; THUMB1-NEXT: rsbs r0, r2, #0
530 ; THUMB1-NEXT: adcs r0, r2
533 ; THUMB2-LABEL: cmp_and16:
534 ; THUMB2: @ %bb.0: @ %entry
535 ; THUMB2-NEXT: ldrh r1, [r1]
536 ; THUMB2-NEXT: ldrh r0, [r0]
537 ; THUMB2-NEXT: ands r0, r1
538 ; THUMB2-NEXT: clz r0, r0
539 ; THUMB2-NEXT: lsrs r0, r0, #5
542 %0 = load i32, ptr %a, align 4
543 %1 = load i32, ptr %b, align 4
544 %and = and i32 %0, 65535
545 %and1 = and i32 %and, %1
546 %cmp = icmp eq i32 %and1, 0
550 define arm_aapcscc i32 @add_and16(ptr nocapture readonly %a, i32 %y, i32 %z) {
551 ; ARM-LABEL: add_and16:
552 ; ARM: @ %bb.0: @ %entry
553 ; ARM-NEXT: add r1, r1, r2
554 ; ARM-NEXT: ldrh r0, [r0]
555 ; ARM-NEXT: uxth r1, r1
556 ; ARM-NEXT: orr r0, r0, r1
559 ; ARMEB-LABEL: add_and16:
560 ; ARMEB: @ %bb.0: @ %entry
561 ; ARMEB-NEXT: add r1, r1, r2
562 ; ARMEB-NEXT: ldrh r0, [r0, #2]
563 ; ARMEB-NEXT: uxth r1, r1
564 ; ARMEB-NEXT: orr r0, r0, r1
567 ; THUMB1-LABEL: add_and16:
568 ; THUMB1: @ %bb.0: @ %entry
569 ; THUMB1-NEXT: adds r1, r1, r2
570 ; THUMB1-NEXT: uxth r1, r1
571 ; THUMB1-NEXT: ldrh r0, [r0]
572 ; THUMB1-NEXT: orrs r0, r1
575 ; THUMB2-LABEL: add_and16:
576 ; THUMB2: @ %bb.0: @ %entry
577 ; THUMB2-NEXT: add r1, r2
578 ; THUMB2-NEXT: ldrh r0, [r0]
579 ; THUMB2-NEXT: uxth r1, r1
580 ; THUMB2-NEXT: orrs r0, r1
583 %x = load i32, ptr %a, align 4
584 %add = add i32 %y, %z
585 %or = or i32 %x, %add
586 %and = and i32 %or, 65535
590 define arm_aapcscc i32 @test1(ptr %a, ptr %b, i32 %x, i32 %y) {
592 ; ARM: @ %bb.0: @ %entry
593 ; ARM-NEXT: mul r2, r2, r3
594 ; ARM-NEXT: ldrh r1, [r1]
595 ; ARM-NEXT: ldrh r0, [r0]
596 ; ARM-NEXT: eor r0, r0, r1
597 ; ARM-NEXT: uxth r1, r2
598 ; ARM-NEXT: orr r0, r0, r1
601 ; ARMEB-LABEL: test1:
602 ; ARMEB: @ %bb.0: @ %entry
603 ; ARMEB-NEXT: mul r2, r2, r3
604 ; ARMEB-NEXT: ldrh r1, [r1, #2]
605 ; ARMEB-NEXT: ldrh r0, [r0, #2]
606 ; ARMEB-NEXT: eor r0, r0, r1
607 ; ARMEB-NEXT: uxth r1, r2
608 ; ARMEB-NEXT: orr r0, r0, r1
611 ; THUMB1-LABEL: test1:
612 ; THUMB1: @ %bb.0: @ %entry
613 ; THUMB1-NEXT: push {r4, lr}
614 ; THUMB1-NEXT: ldrh r1, [r1]
615 ; THUMB1-NEXT: ldrh r4, [r0]
616 ; THUMB1-NEXT: eors r4, r1
617 ; THUMB1-NEXT: muls r2, r3, r2
618 ; THUMB1-NEXT: uxth r0, r2
619 ; THUMB1-NEXT: orrs r0, r4
620 ; THUMB1-NEXT: pop {r4, pc}
622 ; THUMB2-LABEL: test1:
623 ; THUMB2: @ %bb.0: @ %entry
624 ; THUMB2-NEXT: ldrh r1, [r1]
625 ; THUMB2-NEXT: ldrh r0, [r0]
626 ; THUMB2-NEXT: eors r0, r1
627 ; THUMB2-NEXT: mul r1, r2, r3
628 ; THUMB2-NEXT: uxth r1, r1
629 ; THUMB2-NEXT: orrs r0, r1
632 %0 = load i32, ptr %a, align 4
633 %1 = load i32, ptr %b, align 4
634 %mul = mul i32 %x, %y
635 %xor = xor i32 %0, %1
636 %or = or i32 %xor, %mul
637 %and = and i32 %or, 65535
641 define arm_aapcscc i32 @test2(ptr %a, ptr %b, i32 %x, i32 %y) {
643 ; ARM: @ %bb.0: @ %entry
644 ; ARM-NEXT: ldr r1, [r1]
645 ; ARM-NEXT: ldr r0, [r0]
646 ; ARM-NEXT: mul r1, r2, r1
647 ; ARM-NEXT: eor r0, r0, r3
648 ; ARM-NEXT: orr r0, r0, r1
649 ; ARM-NEXT: uxth r0, r0
652 ; ARMEB-LABEL: test2:
653 ; ARMEB: @ %bb.0: @ %entry
654 ; ARMEB-NEXT: ldr r1, [r1]
655 ; ARMEB-NEXT: ldr r0, [r0]
656 ; ARMEB-NEXT: mul r1, r2, r1
657 ; ARMEB-NEXT: eor r0, r0, r3
658 ; ARMEB-NEXT: orr r0, r0, r1
659 ; ARMEB-NEXT: uxth r0, r0
662 ; THUMB1-LABEL: test2:
663 ; THUMB1: @ %bb.0: @ %entry
664 ; THUMB1-NEXT: ldr r1, [r1]
665 ; THUMB1-NEXT: muls r1, r2, r1
666 ; THUMB1-NEXT: ldr r0, [r0]
667 ; THUMB1-NEXT: eors r0, r3
668 ; THUMB1-NEXT: orrs r0, r1
669 ; THUMB1-NEXT: uxth r0, r0
672 ; THUMB2-LABEL: test2:
673 ; THUMB2: @ %bb.0: @ %entry
674 ; THUMB2-NEXT: ldr r1, [r1]
675 ; THUMB2-NEXT: ldr r0, [r0]
676 ; THUMB2-NEXT: muls r1, r2, r1
677 ; THUMB2-NEXT: eors r0, r3
678 ; THUMB2-NEXT: orrs r0, r1
679 ; THUMB2-NEXT: uxth r0, r0
682 %0 = load i32, ptr %a, align 4
683 %1 = load i32, ptr %b, align 4
684 %mul = mul i32 %x, %1
685 %xor = xor i32 %0, %y
686 %or = or i32 %xor, %mul
687 %and = and i32 %or, 65535
691 define arm_aapcscc i32 @test3(ptr %a, ptr %b, i32 %x, ptr %y) {
693 ; ARM: @ %bb.0: @ %entry
694 ; ARM-NEXT: ldr r0, [r0]
695 ; ARM-NEXT: mul r1, r2, r0
696 ; ARM-NEXT: ldrh r2, [r3]
697 ; ARM-NEXT: eor r0, r0, r2
698 ; ARM-NEXT: orr r0, r0, r1
699 ; ARM-NEXT: uxth r0, r0
702 ; ARMEB-LABEL: test3:
703 ; ARMEB: @ %bb.0: @ %entry
704 ; ARMEB-NEXT: ldr r0, [r0]
705 ; ARMEB-NEXT: mul r1, r2, r0
706 ; ARMEB-NEXT: ldrh r2, [r3]
707 ; ARMEB-NEXT: eor r0, r0, r2
708 ; ARMEB-NEXT: orr r0, r0, r1
709 ; ARMEB-NEXT: uxth r0, r0
712 ; THUMB1-LABEL: test3:
713 ; THUMB1: @ %bb.0: @ %entry
714 ; THUMB1-NEXT: ldr r0, [r0]
715 ; THUMB1-NEXT: muls r2, r0, r2
716 ; THUMB1-NEXT: ldrh r1, [r3]
717 ; THUMB1-NEXT: eors r1, r0
718 ; THUMB1-NEXT: orrs r1, r2
719 ; THUMB1-NEXT: uxth r0, r1
722 ; THUMB2-LABEL: test3:
723 ; THUMB2: @ %bb.0: @ %entry
724 ; THUMB2-NEXT: ldr r0, [r0]
725 ; THUMB2-NEXT: mul r1, r2, r0
726 ; THUMB2-NEXT: ldrh r2, [r3]
727 ; THUMB2-NEXT: eors r0, r2
728 ; THUMB2-NEXT: orrs r0, r1
729 ; THUMB2-NEXT: uxth r0, r0
732 %0 = load i32, ptr %a, align 4
733 %1 = load i16, ptr %y, align 4
734 %2 = zext i16 %1 to i32
735 %mul = mul i32 %x, %0
736 %xor = xor i32 %0, %2
737 %or = or i32 %xor, %mul
738 %and = and i32 %or, 65535
742 define arm_aapcscc i32 @test4(ptr %a, ptr %b, i32 %x, i32 %y) {
744 ; ARM: @ %bb.0: @ %entry
745 ; ARM-NEXT: mul r2, r2, r3
746 ; ARM-NEXT: ldrh r1, [r1]
747 ; ARM-NEXT: ldrh r0, [r0]
748 ; ARM-NEXT: eor r0, r0, r1
749 ; ARM-NEXT: uxth r1, r2
750 ; ARM-NEXT: orr r0, r0, r1
753 ; ARMEB-LABEL: test4:
754 ; ARMEB: @ %bb.0: @ %entry
755 ; ARMEB-NEXT: mul r2, r2, r3
756 ; ARMEB-NEXT: ldrh r1, [r1, #2]
757 ; ARMEB-NEXT: ldrh r0, [r0, #2]
758 ; ARMEB-NEXT: eor r0, r0, r1
759 ; ARMEB-NEXT: uxth r1, r2
760 ; ARMEB-NEXT: orr r0, r0, r1
763 ; THUMB1-LABEL: test4:
764 ; THUMB1: @ %bb.0: @ %entry
765 ; THUMB1-NEXT: push {r4, lr}
766 ; THUMB1-NEXT: ldrh r1, [r1]
767 ; THUMB1-NEXT: ldrh r4, [r0]
768 ; THUMB1-NEXT: eors r4, r1
769 ; THUMB1-NEXT: muls r2, r3, r2
770 ; THUMB1-NEXT: uxth r0, r2
771 ; THUMB1-NEXT: orrs r0, r4
772 ; THUMB1-NEXT: pop {r4, pc}
774 ; THUMB2-LABEL: test4:
775 ; THUMB2: @ %bb.0: @ %entry
776 ; THUMB2-NEXT: ldrh r1, [r1]
777 ; THUMB2-NEXT: ldrh r0, [r0]
778 ; THUMB2-NEXT: eors r0, r1
779 ; THUMB2-NEXT: mul r1, r2, r3
780 ; THUMB2-NEXT: uxth r1, r1
781 ; THUMB2-NEXT: orrs r0, r1
784 %0 = load i32, ptr %a, align 4
785 %1 = load i32, ptr %b, align 4
786 %mul = mul i32 %x, %y
787 %xor = xor i32 %0, %1
788 %or = or i32 %xor, %mul
789 %and = and i32 %or, 65535
793 define arm_aapcscc i32 @test5(ptr %a, ptr %b, i32 %x, i16 zeroext %y) {
795 ; ARM: @ %bb.0: @ %entry
796 ; ARM-NEXT: ldr r1, [r1]
797 ; ARM-NEXT: ldrh r0, [r0]
798 ; ARM-NEXT: mul r1, r2, r1
799 ; ARM-NEXT: eor r0, r0, r3
800 ; ARM-NEXT: uxth r1, r1
801 ; ARM-NEXT: orr r0, r0, r1
804 ; ARMEB-LABEL: test5:
805 ; ARMEB: @ %bb.0: @ %entry
806 ; ARMEB-NEXT: ldr r1, [r1]
807 ; ARMEB-NEXT: ldrh r0, [r0, #2]
808 ; ARMEB-NEXT: mul r1, r2, r1
809 ; ARMEB-NEXT: eor r0, r0, r3
810 ; ARMEB-NEXT: uxth r1, r1
811 ; ARMEB-NEXT: orr r0, r0, r1
814 ; THUMB1-LABEL: test5:
815 ; THUMB1: @ %bb.0: @ %entry
816 ; THUMB1-NEXT: push {r4, lr}
817 ; THUMB1-NEXT: ldrh r4, [r0]
818 ; THUMB1-NEXT: eors r4, r3
819 ; THUMB1-NEXT: ldr r0, [r1]
820 ; THUMB1-NEXT: muls r0, r2, r0
821 ; THUMB1-NEXT: uxth r0, r0
822 ; THUMB1-NEXT: orrs r0, r4
823 ; THUMB1-NEXT: pop {r4, pc}
825 ; THUMB2-LABEL: test5:
826 ; THUMB2: @ %bb.0: @ %entry
827 ; THUMB2-NEXT: ldr r1, [r1]
828 ; THUMB2-NEXT: ldrh r0, [r0]
829 ; THUMB2-NEXT: muls r1, r2, r1
830 ; THUMB2-NEXT: eors r0, r3
831 ; THUMB2-NEXT: uxth r1, r1
832 ; THUMB2-NEXT: orrs r0, r1
835 %0 = load i32, ptr %a, align 4
836 %1 = load i32, ptr %b, align 4
837 %mul = mul i32 %x, %1
838 %ext = zext i16 %y to i32
839 %xor = xor i32 %0, %ext
840 %or = or i32 %xor, %mul
841 %and = and i32 %or, 65535
845 define arm_aapcscc i1 @test6(ptr %x, i8 %y, i8 %z) {
847 ; ARM: @ %bb.0: @ %entry
848 ; ARM-NEXT: ldrb r0, [r0]
849 ; ARM-NEXT: and r0, r1, r0
850 ; ARM-NEXT: uxtb r1, r2
851 ; ARM-NEXT: sub r0, r0, r1
852 ; ARM-NEXT: clz r0, r0
853 ; ARM-NEXT: lsr r0, r0, #5
856 ; ARMEB-LABEL: test6:
857 ; ARMEB: @ %bb.0: @ %entry
858 ; ARMEB-NEXT: ldrb r0, [r0]
859 ; ARMEB-NEXT: and r0, r1, r0
860 ; ARMEB-NEXT: uxtb r1, r2
861 ; ARMEB-NEXT: sub r0, r0, r1
862 ; ARMEB-NEXT: clz r0, r0
863 ; ARMEB-NEXT: lsr r0, r0, #5
866 ; THUMB1-LABEL: test6:
867 ; THUMB1: @ %bb.0: @ %entry
868 ; THUMB1-NEXT: ldrb r0, [r0]
869 ; THUMB1-NEXT: ands r0, r1
870 ; THUMB1-NEXT: uxtb r1, r2
871 ; THUMB1-NEXT: subs r1, r0, r1
872 ; THUMB1-NEXT: rsbs r0, r1, #0
873 ; THUMB1-NEXT: adcs r0, r1
876 ; THUMB2-LABEL: test6:
877 ; THUMB2: @ %bb.0: @ %entry
878 ; THUMB2-NEXT: ldrb r0, [r0]
879 ; THUMB2-NEXT: ands r0, r1
880 ; THUMB2-NEXT: uxtb r1, r2
881 ; THUMB2-NEXT: subs r0, r0, r1
882 ; THUMB2-NEXT: clz r0, r0
883 ; THUMB2-NEXT: lsrs r0, r0, #5
886 %0 = load i8, ptr %x, align 4
888 %2 = icmp eq i8 %1, %z
892 define arm_aapcscc i1 @test7(ptr %x, i16 %y, i8 %z) {
894 ; ARM: @ %bb.0: @ %entry
895 ; ARM-NEXT: ldrb r0, [r0]
896 ; ARM-NEXT: and r0, r1, r0
897 ; ARM-NEXT: uxtb r1, r2
898 ; ARM-NEXT: sub r0, r0, r1
899 ; ARM-NEXT: clz r0, r0
900 ; ARM-NEXT: lsr r0, r0, #5
903 ; ARMEB-LABEL: test7:
904 ; ARMEB: @ %bb.0: @ %entry
905 ; ARMEB-NEXT: ldrb r0, [r0, #1]
906 ; ARMEB-NEXT: and r0, r1, r0
907 ; ARMEB-NEXT: uxtb r1, r2
908 ; ARMEB-NEXT: sub r0, r0, r1
909 ; ARMEB-NEXT: clz r0, r0
910 ; ARMEB-NEXT: lsr r0, r0, #5
913 ; THUMB1-LABEL: test7:
914 ; THUMB1: @ %bb.0: @ %entry
915 ; THUMB1-NEXT: ldrb r0, [r0]
916 ; THUMB1-NEXT: ands r0, r1
917 ; THUMB1-NEXT: uxtb r1, r2
918 ; THUMB1-NEXT: subs r1, r0, r1
919 ; THUMB1-NEXT: rsbs r0, r1, #0
920 ; THUMB1-NEXT: adcs r0, r1
923 ; THUMB2-LABEL: test7:
924 ; THUMB2: @ %bb.0: @ %entry
925 ; THUMB2-NEXT: ldrb r0, [r0]
926 ; THUMB2-NEXT: ands r0, r1
927 ; THUMB2-NEXT: uxtb r1, r2
928 ; THUMB2-NEXT: subs r0, r0, r1
929 ; THUMB2-NEXT: clz r0, r0
930 ; THUMB2-NEXT: lsrs r0, r0, #5
933 %0 = load i16, ptr %x, align 4
935 %2 = trunc i16 %1 to i8
936 %3 = icmp eq i8 %2, %z
940 define arm_aapcscc void @test8(ptr nocapture %p) {
942 ; ARM: @ %bb.0: @ %entry
943 ; ARM-NEXT: ldrb r1, [r0]
944 ; ARM-NEXT: eor r1, r1, #255
945 ; ARM-NEXT: str r1, [r0]
948 ; ARMEB-LABEL: test8:
949 ; ARMEB: @ %bb.0: @ %entry
950 ; ARMEB-NEXT: ldrb r1, [r0, #3]
951 ; ARMEB-NEXT: eor r1, r1, #255
952 ; ARMEB-NEXT: str r1, [r0]
955 ; THUMB1-LABEL: test8:
956 ; THUMB1: @ %bb.0: @ %entry
957 ; THUMB1-NEXT: ldrb r1, [r0]
958 ; THUMB1-NEXT: movs r2, #255
959 ; THUMB1-NEXT: eors r2, r1
960 ; THUMB1-NEXT: str r2, [r0]
963 ; THUMB2-LABEL: test8:
964 ; THUMB2: @ %bb.0: @ %entry
965 ; THUMB2-NEXT: ldrb r1, [r0]
966 ; THUMB2-NEXT: eor r1, r1, #255
967 ; THUMB2-NEXT: str r1, [r0]
970 %0 = load i32, ptr %p, align 4
971 %neg = and i32 %0, 255
972 %and = xor i32 %neg, 255
973 store i32 %and, ptr %p, align 4
977 define arm_aapcscc void @test9(ptr nocapture %p) {
979 ; ARM: @ %bb.0: @ %entry
980 ; ARM-NEXT: ldrb r1, [r0]
981 ; ARM-NEXT: eor r1, r1, #255
982 ; ARM-NEXT: str r1, [r0]
985 ; ARMEB-LABEL: test9:
986 ; ARMEB: @ %bb.0: @ %entry
987 ; ARMEB-NEXT: ldrb r1, [r0, #3]
988 ; ARMEB-NEXT: eor r1, r1, #255
989 ; ARMEB-NEXT: str r1, [r0]
992 ; THUMB1-LABEL: test9:
993 ; THUMB1: @ %bb.0: @ %entry
994 ; THUMB1-NEXT: ldrb r1, [r0]
995 ; THUMB1-NEXT: movs r2, #255
996 ; THUMB1-NEXT: eors r2, r1
997 ; THUMB1-NEXT: str r2, [r0]
1000 ; THUMB2-LABEL: test9:
1001 ; THUMB2: @ %bb.0: @ %entry
1002 ; THUMB2-NEXT: ldrb r1, [r0]
1003 ; THUMB2-NEXT: eor r1, r1, #255
1004 ; THUMB2-NEXT: str r1, [r0]
1005 ; THUMB2-NEXT: bx lr
1007 %0 = load i32, ptr %p, align 4
1008 %neg = xor i32 %0, -1
1009 %and = and i32 %neg, 255
1010 store i32 %and, ptr %p, align 4
1014 define arm_aapcscc void @test10(ptr nocapture %p) {
1015 ; ARM-LABEL: test10:
1016 ; ARM: @ %bb.0: @ %entry
1017 ; ARM-NEXT: ldrb r1, [r0]
1018 ; ARM-NEXT: eor r1, r1, #255
1019 ; ARM-NEXT: str r1, [r0]
1022 ; ARMEB-LABEL: test10:
1023 ; ARMEB: @ %bb.0: @ %entry
1024 ; ARMEB-NEXT: ldrb r1, [r0, #3]
1025 ; ARMEB-NEXT: eor r1, r1, #255
1026 ; ARMEB-NEXT: str r1, [r0]
1029 ; THUMB1-LABEL: test10:
1030 ; THUMB1: @ %bb.0: @ %entry
1031 ; THUMB1-NEXT: ldrb r1, [r0]
1032 ; THUMB1-NEXT: movs r2, #255
1033 ; THUMB1-NEXT: eors r2, r1
1034 ; THUMB1-NEXT: str r2, [r0]
1035 ; THUMB1-NEXT: bx lr
1037 ; THUMB2-LABEL: test10:
1038 ; THUMB2: @ %bb.0: @ %entry
1039 ; THUMB2-NEXT: ldrb r1, [r0]
1040 ; THUMB2-NEXT: eor r1, r1, #255
1041 ; THUMB2-NEXT: str r1, [r0]
1042 ; THUMB2-NEXT: bx lr
1044 %0 = load i32, ptr %p, align 4
1045 %neg = and i32 %0, 255
1046 %and = xor i32 %neg, 255
1047 store i32 %and, ptr %p, align 4
1051 define arm_aapcscc i32 @test11(ptr nocapture %p) {
1052 ; ARM-LABEL: test11:
1054 ; ARM-NEXT: ldrb r0, [r0, #1]
1055 ; ARM-NEXT: lsl r0, r0, #8
1058 ; ARMEB-LABEL: test11:
1060 ; ARMEB-NEXT: ldrb r0, [r0, #2]
1061 ; ARMEB-NEXT: lsl r0, r0, #8
1064 ; THUMB1-LABEL: test11:
1066 ; THUMB1-NEXT: ldrb r0, [r0, #1]
1067 ; THUMB1-NEXT: lsls r0, r0, #8
1068 ; THUMB1-NEXT: bx lr
1070 ; THUMB2-LABEL: test11:
1072 ; THUMB2-NEXT: ldrb r0, [r0, #1]
1073 ; THUMB2-NEXT: lsls r0, r0, #8
1074 ; THUMB2-NEXT: bx lr
1075 %1 = load i32, ptr %p, align 4
1076 %and = and i32 %1, 65280
1080 define arm_aapcscc i32 @test12(ptr nocapture %p) {
1081 ; ARM-LABEL: test12:
1083 ; ARM-NEXT: ldrb r0, [r0, #2]
1084 ; ARM-NEXT: lsl r0, r0, #16
1087 ; ARMEB-LABEL: test12:
1089 ; ARMEB-NEXT: ldrb r0, [r0, #1]
1090 ; ARMEB-NEXT: lsl r0, r0, #16
1093 ; THUMB1-LABEL: test12:
1095 ; THUMB1-NEXT: ldrb r0, [r0, #2]
1096 ; THUMB1-NEXT: lsls r0, r0, #16
1097 ; THUMB1-NEXT: bx lr
1099 ; THUMB2-LABEL: test12:
1101 ; THUMB2-NEXT: ldrb r0, [r0, #2]
1102 ; THUMB2-NEXT: lsls r0, r0, #16
1103 ; THUMB2-NEXT: bx lr
1104 %1 = load i32, ptr %p, align 4
1105 %and = and i32 %1, 16711680
1109 define arm_aapcscc i32 @test13(ptr nocapture %p) {
1110 ; ARM-LABEL: test13:
1112 ; ARM-NEXT: ldrb r0, [r0, #3]
1113 ; ARM-NEXT: lsl r0, r0, #24
1116 ; ARMEB-LABEL: test13:
1118 ; ARMEB-NEXT: ldrb r0, [r0]
1119 ; ARMEB-NEXT: lsl r0, r0, #24
1122 ; THUMB1-LABEL: test13:
1124 ; THUMB1-NEXT: ldrb r0, [r0, #3]
1125 ; THUMB1-NEXT: lsls r0, r0, #24
1126 ; THUMB1-NEXT: bx lr
1128 ; THUMB2-LABEL: test13:
1130 ; THUMB2-NEXT: ldrb r0, [r0, #3]
1131 ; THUMB2-NEXT: lsls r0, r0, #24
1132 ; THUMB2-NEXT: bx lr
1133 %1 = load i32, ptr %p, align 4
1134 %and = and i32 %1, 4278190080
1138 define arm_aapcscc i32 @test14(ptr nocapture %p) {
1139 ; ARM-LABEL: test14:
1141 ; ARM-NEXT: ldrh r0, [r0, #1]
1142 ; ARM-NEXT: lsl r0, r0, #8
1145 ; ARMEB-LABEL: test14:
1147 ; ARMEB-NEXT: ldrh r0, [r0, #1]
1148 ; ARMEB-NEXT: lsl r0, r0, #8
1151 ; THUMB1-LABEL: test14:
1153 ; THUMB1-NEXT: ldr r1, [r0]
1154 ; THUMB1-NEXT: ldr r0, .LCPI26_0
1155 ; THUMB1-NEXT: ands r0, r1
1156 ; THUMB1-NEXT: bx lr
1157 ; THUMB1-NEXT: .p2align 2
1158 ; THUMB1-NEXT: @ %bb.1:
1159 ; THUMB1-NEXT: .LCPI26_0:
1160 ; THUMB1-NEXT: .long 16776960 @ 0xffff00
1162 ; THUMB2-LABEL: test14:
1164 ; THUMB2-NEXT: ldrh.w r0, [r0, #1]
1165 ; THUMB2-NEXT: lsls r0, r0, #8
1166 ; THUMB2-NEXT: bx lr
1167 %1 = load i32, ptr %p, align 4
1168 %and = and i32 %1, 16776960
1172 define arm_aapcscc i32 @test15(ptr nocapture %p) {
1173 ; ARM-LABEL: test15:
1175 ; ARM-NEXT: ldrh r0, [r0, #2]
1176 ; ARM-NEXT: lsl r0, r0, #16
1179 ; ARMEB-LABEL: test15:
1181 ; ARMEB-NEXT: ldrh r0, [r0]
1182 ; ARMEB-NEXT: lsl r0, r0, #16
1185 ; THUMB1-LABEL: test15:
1187 ; THUMB1-NEXT: ldrh r0, [r0, #2]
1188 ; THUMB1-NEXT: lsls r0, r0, #16
1189 ; THUMB1-NEXT: bx lr
1191 ; THUMB2-LABEL: test15:
1193 ; THUMB2-NEXT: ldrh r0, [r0, #2]
1194 ; THUMB2-NEXT: lsls r0, r0, #16
1195 ; THUMB2-NEXT: bx lr
1196 %1 = load i32, ptr %p, align 4
1197 %and = and i32 %1, 4294901760
1201 define arm_aapcscc i32 @test16(ptr nocapture %p) {
1202 ; ARM-LABEL: test16:
1204 ; ARM-NEXT: ldrb r0, [r0, #1]
1205 ; ARM-NEXT: lsl r0, r0, #8
1208 ; ARMEB-LABEL: test16:
1210 ; ARMEB-NEXT: ldrb r0, [r0, #6]
1211 ; ARMEB-NEXT: lsl r0, r0, #8
1214 ; THUMB1-LABEL: test16:
1216 ; THUMB1-NEXT: ldrb r0, [r0, #1]
1217 ; THUMB1-NEXT: lsls r0, r0, #8
1218 ; THUMB1-NEXT: bx lr
1220 ; THUMB2-LABEL: test16:
1222 ; THUMB2-NEXT: ldrb r0, [r0, #1]
1223 ; THUMB2-NEXT: lsls r0, r0, #8
1224 ; THUMB2-NEXT: bx lr
1225 %1 = load i64, ptr %p, align 8
1226 %and = and i64 %1, 65280
1227 %trunc = trunc i64 %and to i32
1231 define arm_aapcscc i32 @test17(ptr nocapture %p) {
1232 ; ARM-LABEL: test17:
1234 ; ARM-NEXT: ldrb r0, [r0, #2]
1235 ; ARM-NEXT: lsl r0, r0, #16
1238 ; ARMEB-LABEL: test17:
1240 ; ARMEB-NEXT: ldrb r0, [r0, #5]
1241 ; ARMEB-NEXT: lsl r0, r0, #16
1244 ; THUMB1-LABEL: test17:
1246 ; THUMB1-NEXT: ldrb r0, [r0, #2]
1247 ; THUMB1-NEXT: lsls r0, r0, #16
1248 ; THUMB1-NEXT: bx lr
1250 ; THUMB2-LABEL: test17:
1252 ; THUMB2-NEXT: ldrb r0, [r0, #2]
1253 ; THUMB2-NEXT: lsls r0, r0, #16
1254 ; THUMB2-NEXT: bx lr
1255 %1 = load i64, ptr %p, align 8
1256 %and = and i64 %1, 16711680
1257 %trunc = trunc i64 %and to i32
1261 define arm_aapcscc i32 @test18(ptr nocapture %p) {
1262 ; ARM-LABEL: test18:
1264 ; ARM-NEXT: ldrb r0, [r0, #3]
1265 ; ARM-NEXT: lsl r0, r0, #24
1268 ; ARMEB-LABEL: test18:
1270 ; ARMEB-NEXT: ldrb r0, [r0, #4]
1271 ; ARMEB-NEXT: lsl r0, r0, #24
1274 ; THUMB1-LABEL: test18:
1276 ; THUMB1-NEXT: ldrb r0, [r0, #3]
1277 ; THUMB1-NEXT: lsls r0, r0, #24
1278 ; THUMB1-NEXT: bx lr
1280 ; THUMB2-LABEL: test18:
1282 ; THUMB2-NEXT: ldrb r0, [r0, #3]
1283 ; THUMB2-NEXT: lsls r0, r0, #24
1284 ; THUMB2-NEXT: bx lr
1285 %1 = load i64, ptr %p, align 8
1286 %and = and i64 %1, 4278190080
1287 %trunc = trunc i64 %and to i32
1291 define arm_aapcscc i64 @test19(ptr nocapture %p) {
1292 ; ARM-LABEL: test19:
1294 ; ARM-NEXT: ldrb r1, [r0, #4]
1295 ; ARM-NEXT: mov r0, #0
1298 ; ARMEB-LABEL: test19:
1300 ; ARMEB-NEXT: ldrb r0, [r0, #3]
1301 ; ARMEB-NEXT: mov r1, #0
1304 ; THUMB1-LABEL: test19:
1306 ; THUMB1-NEXT: ldrb r1, [r0, #4]
1307 ; THUMB1-NEXT: movs r0, #0
1308 ; THUMB1-NEXT: bx lr
1310 ; THUMB2-LABEL: test19:
1312 ; THUMB2-NEXT: ldrb r1, [r0, #4]
1313 ; THUMB2-NEXT: movs r0, #0
1314 ; THUMB2-NEXT: bx lr
1315 %1 = load i64, ptr %p, align 8
1316 %and = and i64 %1, 1095216660480
1320 define arm_aapcscc i64 @test20(ptr nocapture %p) {
1321 ; ARM-LABEL: test20:
1323 ; ARM-NEXT: ldrb r0, [r0, #5]
1324 ; ARM-NEXT: lsl r1, r0, #8
1325 ; ARM-NEXT: mov r0, #0
1328 ; ARMEB-LABEL: test20:
1330 ; ARMEB-NEXT: ldrb r0, [r0, #2]
1331 ; ARMEB-NEXT: mov r1, #0
1332 ; ARMEB-NEXT: lsl r0, r0, #8
1335 ; THUMB1-LABEL: test20:
1337 ; THUMB1-NEXT: ldrb r0, [r0, #5]
1338 ; THUMB1-NEXT: lsls r1, r0, #8
1339 ; THUMB1-NEXT: movs r0, #0
1340 ; THUMB1-NEXT: bx lr
1342 ; THUMB2-LABEL: test20:
1344 ; THUMB2-NEXT: ldrb r0, [r0, #5]
1345 ; THUMB2-NEXT: lsls r1, r0, #8
1346 ; THUMB2-NEXT: movs r0, #0
1347 ; THUMB2-NEXT: bx lr
1348 %1 = load i64, ptr %p, align 8
1349 %and = and i64 %1, 280375465082880
1353 define arm_aapcscc i64 @test21(ptr nocapture %p) {
1354 ; ARM-LABEL: test21:
1356 ; ARM-NEXT: ldrb r0, [r0, #6]
1357 ; ARM-NEXT: lsl r1, r0, #16
1358 ; ARM-NEXT: mov r0, #0
1361 ; ARMEB-LABEL: test21:
1363 ; ARMEB-NEXT: ldrb r0, [r0, #1]
1364 ; ARMEB-NEXT: mov r1, #0
1365 ; ARMEB-NEXT: lsl r0, r0, #16
1368 ; THUMB1-LABEL: test21:
1370 ; THUMB1-NEXT: ldrb r0, [r0, #6]
1371 ; THUMB1-NEXT: lsls r1, r0, #16
1372 ; THUMB1-NEXT: movs r0, #0
1373 ; THUMB1-NEXT: bx lr
1375 ; THUMB2-LABEL: test21:
1377 ; THUMB2-NEXT: ldrb r0, [r0, #6]
1378 ; THUMB2-NEXT: lsls r1, r0, #16
1379 ; THUMB2-NEXT: movs r0, #0
1380 ; THUMB2-NEXT: bx lr
1381 %1 = load i64, ptr %p, align 8
1382 %and = and i64 %1, 71776119061217280
1386 define arm_aapcscc i64 @test22(ptr nocapture %p) {
1387 ; ARM-LABEL: test22:
1389 ; ARM-NEXT: ldrb r0, [r0, #7]
1390 ; ARM-NEXT: lsl r1, r0, #24
1391 ; ARM-NEXT: mov r0, #0
1394 ; ARMEB-LABEL: test22:
1396 ; ARMEB-NEXT: ldrb r0, [r0]
1397 ; ARMEB-NEXT: mov r1, #0
1398 ; ARMEB-NEXT: lsl r0, r0, #24
1401 ; THUMB1-LABEL: test22:
1403 ; THUMB1-NEXT: ldrb r0, [r0, #7]
1404 ; THUMB1-NEXT: lsls r1, r0, #24
1405 ; THUMB1-NEXT: movs r0, #0
1406 ; THUMB1-NEXT: bx lr
1408 ; THUMB2-LABEL: test22:
1410 ; THUMB2-NEXT: ldrb r0, [r0, #7]
1411 ; THUMB2-NEXT: lsls r1, r0, #24
1412 ; THUMB2-NEXT: movs r0, #0
1413 ; THUMB2-NEXT: bx lr
1414 %1 = load i64, ptr %p, align 8
1415 %and = and i64 %1, -72057594037927936
1419 define arm_aapcscc i64 @test23(ptr nocapture %p) {
1420 ; ARM-LABEL: test23:
1422 ; ARM-NEXT: ldrh r1, [r0, #3]
1423 ; ARM-NEXT: lsl r0, r1, #24
1424 ; ARM-NEXT: lsr r1, r1, #8
1427 ; ARMEB-LABEL: test23:
1429 ; ARMEB-NEXT: ldrh r1, [r0, #3]
1430 ; ARMEB-NEXT: lsr r0, r1, #8
1431 ; ARMEB-NEXT: lsl r1, r1, #24
1434 ; THUMB1-LABEL: test23:
1436 ; THUMB1-NEXT: ldrb r1, [r0, #4]
1437 ; THUMB1-NEXT: ldrb r0, [r0, #3]
1438 ; THUMB1-NEXT: lsls r0, r0, #24
1439 ; THUMB1-NEXT: bx lr
1441 ; THUMB2-LABEL: test23:
1443 ; THUMB2-NEXT: ldrh.w r1, [r0, #3]
1444 ; THUMB2-NEXT: lsls r0, r1, #24
1445 ; THUMB2-NEXT: lsrs r1, r1, #8
1446 ; THUMB2-NEXT: bx lr
1447 %1 = load i64, ptr %p, align 8
1448 %and = and i64 %1, 1099494850560
1452 define arm_aapcscc i64 @test24(ptr nocapture %p) {
1453 ; ARM-LABEL: test24:
1455 ; ARM-NEXT: ldrh r1, [r0, #4]
1456 ; ARM-NEXT: mov r0, #0
1459 ; ARMEB-LABEL: test24:
1461 ; ARMEB-NEXT: ldrh r0, [r0, #2]
1462 ; ARMEB-NEXT: mov r1, #0
1465 ; THUMB1-LABEL: test24:
1467 ; THUMB1-NEXT: ldrh r1, [r0, #4]
1468 ; THUMB1-NEXT: movs r0, #0
1469 ; THUMB1-NEXT: bx lr
1471 ; THUMB2-LABEL: test24:
1473 ; THUMB2-NEXT: ldrh r1, [r0, #4]
1474 ; THUMB2-NEXT: movs r0, #0
1475 ; THUMB2-NEXT: bx lr
1476 %1 = load i64, ptr %p, align 8
1477 %and = and i64 %1, 281470681743360
1481 define arm_aapcscc i64 @test25(ptr nocapture %p) {
1482 ; ARM-LABEL: test25:
1484 ; ARM-NEXT: ldrh r0, [r0, #5]
1485 ; ARM-NEXT: lsl r1, r0, #8
1486 ; ARM-NEXT: mov r0, #0
1489 ; ARMEB-LABEL: test25:
1491 ; ARMEB-NEXT: ldrh r0, [r0, #1]
1492 ; ARMEB-NEXT: mov r1, #0
1493 ; ARMEB-NEXT: lsl r0, r0, #8
1496 ; THUMB1-LABEL: test25:
1498 ; THUMB1-NEXT: ldr r0, [r0, #4]
1499 ; THUMB1-NEXT: ldr r1, .LCPI37_0
1500 ; THUMB1-NEXT: ands r1, r0
1501 ; THUMB1-NEXT: movs r0, #0
1502 ; THUMB1-NEXT: bx lr
1503 ; THUMB1-NEXT: .p2align 2
1504 ; THUMB1-NEXT: @ %bb.1:
1505 ; THUMB1-NEXT: .LCPI37_0:
1506 ; THUMB1-NEXT: .long 16776960 @ 0xffff00
1508 ; THUMB2-LABEL: test25:
1510 ; THUMB2-NEXT: ldrh.w r0, [r0, #5]
1511 ; THUMB2-NEXT: lsls r1, r0, #8
1512 ; THUMB2-NEXT: movs r0, #0
1513 ; THUMB2-NEXT: bx lr
1514 %1 = load i64, ptr %p, align 8
1515 %and = and i64 %1, 72056494526300160
1519 define arm_aapcscc i64 @test26(ptr nocapture %p) {
1520 ; ARM-LABEL: test26:
1522 ; ARM-NEXT: ldrh r0, [r0, #6]
1523 ; ARM-NEXT: lsl r1, r0, #16
1524 ; ARM-NEXT: mov r0, #0
1527 ; ARMEB-LABEL: test26:
1529 ; ARMEB-NEXT: ldrh r0, [r0]
1530 ; ARMEB-NEXT: mov r1, #0
1531 ; ARMEB-NEXT: lsl r0, r0, #16
1534 ; THUMB1-LABEL: test26:
1536 ; THUMB1-NEXT: ldrh r0, [r0, #6]
1537 ; THUMB1-NEXT: lsls r1, r0, #16
1538 ; THUMB1-NEXT: movs r0, #0
1539 ; THUMB1-NEXT: bx lr
1541 ; THUMB2-LABEL: test26:
1543 ; THUMB2-NEXT: ldrh r0, [r0, #6]
1544 ; THUMB2-NEXT: lsls r1, r0, #16
1545 ; THUMB2-NEXT: movs r0, #0
1546 ; THUMB2-NEXT: bx lr
1547 %1 = load i64, ptr %p, align 8
1548 %and = and i64 %1, -281474976710656
1552 define void @test27(ptr nocapture %ptr) {
1553 ; ARM-LABEL: test27:
1554 ; ARM: @ %bb.0: @ %entry
1555 ; ARM-NEXT: ldrb r1, [r0, #1]
1556 ; ARM-NEXT: lsl r1, r1, #16
1557 ; ARM-NEXT: str r1, [r0]
1560 ; ARMEB-LABEL: test27:
1561 ; ARMEB: @ %bb.0: @ %entry
1562 ; ARMEB-NEXT: ldrb r1, [r0, #2]
1563 ; ARMEB-NEXT: lsl r1, r1, #16
1564 ; ARMEB-NEXT: str r1, [r0]
1567 ; THUMB1-LABEL: test27:
1568 ; THUMB1: @ %bb.0: @ %entry
1569 ; THUMB1-NEXT: ldrb r1, [r0, #1]
1570 ; THUMB1-NEXT: lsls r1, r1, #16
1571 ; THUMB1-NEXT: str r1, [r0]
1572 ; THUMB1-NEXT: bx lr
1574 ; THUMB2-LABEL: test27:
1575 ; THUMB2: @ %bb.0: @ %entry
1576 ; THUMB2-NEXT: ldrb r1, [r0, #1]
1577 ; THUMB2-NEXT: lsls r1, r1, #16
1578 ; THUMB2-NEXT: str r1, [r0]
1579 ; THUMB2-NEXT: bx lr
1581 %0 = load i32, ptr %ptr, align 4
1582 %and = and i32 %0, 65280
1583 %shl = shl i32 %and, 8
1584 store i32 %shl, ptr %ptr, align 4