1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-- | FileCheck %s --check-prefixes=X86,SDAG-X86
3 ; RUN: llc < %s -mtriple=i686-- -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes=X86,FASTISEL-X86
4 ; RUN: llc < %s -mtriple=i686-- -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X86,GISEL-X86
5 ; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s --check-prefixes=X64,SDAG-X64
6 ; RUN: llc < %s -mtriple=x86_64-- -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes=X64,FASTISEL-X64
7 ; RUN: llc < %s -mtriple=x86_64-- -global-isel -global-isel-abort=1 | FileCheck %s --check-prefixes=X64,GISEL-X64
9 define i8 @or_i8(i8 %a, i8 %b) {
10 ; SDAG-X86-LABEL: or_i8:
12 ; SDAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
13 ; SDAG-X86-NEXT: orb {{[0-9]+}}(%esp), %al
16 ; FASTISEL-X86-LABEL: or_i8:
17 ; FASTISEL-X86: # %bb.0:
18 ; FASTISEL-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
19 ; FASTISEL-X86-NEXT: orb {{[0-9]+}}(%esp), %al
20 ; FASTISEL-X86-NEXT: retl
22 ; GISEL-X86-LABEL: or_i8:
24 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
25 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
26 ; GISEL-X86-NEXT: orb %cl, %al
27 ; GISEL-X86-NEXT: # kill: def $al killed $al killed $eax
28 ; GISEL-X86-NEXT: retl
30 ; SDAG-X64-LABEL: or_i8:
32 ; SDAG-X64-NEXT: movl %edi, %eax
33 ; SDAG-X64-NEXT: orl %esi, %eax
34 ; SDAG-X64-NEXT: # kill: def $al killed $al killed $eax
37 ; FASTISEL-X64-LABEL: or_i8:
38 ; FASTISEL-X64: # %bb.0:
39 ; FASTISEL-X64-NEXT: movl %edi, %eax
40 ; FASTISEL-X64-NEXT: orb %sil, %al
41 ; FASTISEL-X64-NEXT: # kill: def $al killed $al killed $eax
42 ; FASTISEL-X64-NEXT: retq
44 ; GISEL-X64-LABEL: or_i8:
46 ; GISEL-X64-NEXT: movl %esi, %eax
47 ; GISEL-X64-NEXT: orb %dil, %al
48 ; GISEL-X64-NEXT: # kill: def $al killed $al killed $eax
49 ; GISEL-X64-NEXT: retq
54 define i16 @or_i16(i16 %a, i16 %b) {
55 ; SDAG-X86-LABEL: or_i16:
57 ; SDAG-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
58 ; SDAG-X86-NEXT: orw {{[0-9]+}}(%esp), %ax
61 ; FASTISEL-X86-LABEL: or_i16:
62 ; FASTISEL-X86: # %bb.0:
63 ; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
64 ; FASTISEL-X86-NEXT: orw {{[0-9]+}}(%esp), %ax
65 ; FASTISEL-X86-NEXT: retl
67 ; GISEL-X86-LABEL: or_i16:
69 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
70 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
71 ; GISEL-X86-NEXT: orw %cx, %ax
72 ; GISEL-X86-NEXT: # kill: def $ax killed $ax killed $eax
73 ; GISEL-X86-NEXT: retl
75 ; SDAG-X64-LABEL: or_i16:
77 ; SDAG-X64-NEXT: movl %edi, %eax
78 ; SDAG-X64-NEXT: orl %esi, %eax
79 ; SDAG-X64-NEXT: # kill: def $ax killed $ax killed $eax
82 ; FASTISEL-X64-LABEL: or_i16:
83 ; FASTISEL-X64: # %bb.0:
84 ; FASTISEL-X64-NEXT: movl %edi, %eax
85 ; FASTISEL-X64-NEXT: orw %si, %ax
86 ; FASTISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
87 ; FASTISEL-X64-NEXT: retq
89 ; GISEL-X64-LABEL: or_i16:
91 ; GISEL-X64-NEXT: movl %esi, %eax
92 ; GISEL-X64-NEXT: orw %di, %ax
93 ; GISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
94 ; GISEL-X64-NEXT: retq
99 define i32 @or_i32(i32 %a, i32 %b) {
102 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
103 ; X86-NEXT: orl {{[0-9]+}}(%esp), %eax
106 ; SDAG-X64-LABEL: or_i32:
108 ; SDAG-X64-NEXT: movl %edi, %eax
109 ; SDAG-X64-NEXT: orl %esi, %eax
110 ; SDAG-X64-NEXT: retq
112 ; FASTISEL-X64-LABEL: or_i32:
113 ; FASTISEL-X64: # %bb.0:
114 ; FASTISEL-X64-NEXT: movl %edi, %eax
115 ; FASTISEL-X64-NEXT: orl %esi, %eax
116 ; FASTISEL-X64-NEXT: retq
118 ; GISEL-X64-LABEL: or_i32:
119 ; GISEL-X64: # %bb.0:
120 ; GISEL-X64-NEXT: movl %esi, %eax
121 ; GISEL-X64-NEXT: orl %edi, %eax
122 ; GISEL-X64-NEXT: retq
127 define i64 @or_i64(i64 %a, i64 %b) nounwind {
128 ; SDAG-X86-LABEL: or_i64:
130 ; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
131 ; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
132 ; SDAG-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
133 ; SDAG-X86-NEXT: orl {{[0-9]+}}(%esp), %edx
134 ; SDAG-X86-NEXT: retl
136 ; FASTISEL-X86-LABEL: or_i64:
137 ; FASTISEL-X86: # %bb.0:
138 ; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
139 ; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
140 ; FASTISEL-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
141 ; FASTISEL-X86-NEXT: orl {{[0-9]+}}(%esp), %edx
142 ; FASTISEL-X86-NEXT: retl
144 ; GISEL-X86-LABEL: or_i64:
145 ; GISEL-X86: # %bb.0:
146 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
147 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
148 ; GISEL-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
149 ; GISEL-X86-NEXT: orl {{[0-9]+}}(%esp), %edx
150 ; GISEL-X86-NEXT: retl
152 ; SDAG-X64-LABEL: or_i64:
154 ; SDAG-X64-NEXT: movq %rdi, %rax
155 ; SDAG-X64-NEXT: orq %rsi, %rax
156 ; SDAG-X64-NEXT: retq
158 ; FASTISEL-X64-LABEL: or_i64:
159 ; FASTISEL-X64: # %bb.0:
160 ; FASTISEL-X64-NEXT: movq %rdi, %rax
161 ; FASTISEL-X64-NEXT: orq %rsi, %rax
162 ; FASTISEL-X64-NEXT: retq
164 ; GISEL-X64-LABEL: or_i64:
165 ; GISEL-X64: # %bb.0:
166 ; GISEL-X64-NEXT: movq %rsi, %rax
167 ; GISEL-X64-NEXT: orq %rdi, %rax
168 ; GISEL-X64-NEXT: retq
173 define i8 @or_imm8_i8(i8 %a) {
174 ; SDAG-X86-LABEL: or_imm8_i8:
176 ; SDAG-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
177 ; SDAG-X86-NEXT: orb $1, %al
178 ; SDAG-X86-NEXT: retl
180 ; FASTISEL-X86-LABEL: or_imm8_i8:
181 ; FASTISEL-X86: # %bb.0:
182 ; FASTISEL-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
183 ; FASTISEL-X86-NEXT: orb $1, %al
184 ; FASTISEL-X86-NEXT: retl
186 ; GISEL-X86-LABEL: or_imm8_i8:
187 ; GISEL-X86: # %bb.0:
188 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
189 ; GISEL-X86-NEXT: orb $1, %al
190 ; GISEL-X86-NEXT: # kill: def $al killed $al killed $eax
191 ; GISEL-X86-NEXT: retl
193 ; X64-LABEL: or_imm8_i8:
195 ; X64-NEXT: movl %edi, %eax
196 ; X64-NEXT: orb $1, %al
197 ; X64-NEXT: # kill: def $al killed $al killed $eax
203 define i16 @or_imm8_i16(i16 %a) {
204 ; SDAG-X86-LABEL: or_imm8_i16:
206 ; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
207 ; SDAG-X86-NEXT: orl $6, %eax
208 ; SDAG-X86-NEXT: # kill: def $ax killed $ax killed $eax
209 ; SDAG-X86-NEXT: retl
211 ; FASTISEL-X86-LABEL: or_imm8_i16:
212 ; FASTISEL-X86: # %bb.0:
213 ; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
214 ; FASTISEL-X86-NEXT: orw $6, %ax
215 ; FASTISEL-X86-NEXT: retl
217 ; GISEL-X86-LABEL: or_imm8_i16:
218 ; GISEL-X86: # %bb.0:
219 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
220 ; GISEL-X86-NEXT: orw $6, %ax
221 ; GISEL-X86-NEXT: # kill: def $ax killed $ax killed $eax
222 ; GISEL-X86-NEXT: retl
224 ; SDAG-X64-LABEL: or_imm8_i16:
226 ; SDAG-X64-NEXT: movl %edi, %eax
227 ; SDAG-X64-NEXT: orl $6, %eax
228 ; SDAG-X64-NEXT: # kill: def $ax killed $ax killed $eax
229 ; SDAG-X64-NEXT: retq
231 ; FASTISEL-X64-LABEL: or_imm8_i16:
232 ; FASTISEL-X64: # %bb.0:
233 ; FASTISEL-X64-NEXT: movl %edi, %eax
234 ; FASTISEL-X64-NEXT: orw $6, %ax
235 ; FASTISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
236 ; FASTISEL-X64-NEXT: retq
238 ; GISEL-X64-LABEL: or_imm8_i16:
239 ; GISEL-X64: # %bb.0:
240 ; GISEL-X64-NEXT: movl %edi, %eax
241 ; GISEL-X64-NEXT: orw $6, %ax
242 ; GISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
243 ; GISEL-X64-NEXT: retq
248 define i32 @or_imm8_i32(i32 %a) {
249 ; X86-LABEL: or_imm8_i32:
251 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
252 ; X86-NEXT: orl $-5, %eax
255 ; X64-LABEL: or_imm8_i32:
257 ; X64-NEXT: movl %edi, %eax
258 ; X64-NEXT: orl $-5, %eax
264 define i64 @or_imm8_i64(i64 %a) {
265 ; SDAG-X86-LABEL: or_imm8_i64:
267 ; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
268 ; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
269 ; SDAG-X86-NEXT: orl $1, %eax
270 ; SDAG-X86-NEXT: retl
272 ; FASTISEL-X86-LABEL: or_imm8_i64:
273 ; FASTISEL-X86: # %bb.0:
274 ; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
275 ; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
276 ; FASTISEL-X86-NEXT: orl $1, %eax
277 ; FASTISEL-X86-NEXT: retl
279 ; GISEL-X86-LABEL: or_imm8_i64:
280 ; GISEL-X86: # %bb.0:
281 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
282 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
283 ; GISEL-X86-NEXT: orl $1, %eax
284 ; GISEL-X86-NEXT: orl $0, %edx
285 ; GISEL-X86-NEXT: retl
287 ; X64-LABEL: or_imm8_i64:
289 ; X64-NEXT: movq %rdi, %rax
290 ; X64-NEXT: orq $1, %rax
296 define i16 @or_imm16_i16(i16 %a) {
297 ; SDAG-X86-LABEL: or_imm16_i16:
299 ; SDAG-X86-NEXT: movl $1023, %eax # imm = 0x3FF
300 ; SDAG-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
301 ; SDAG-X86-NEXT: # kill: def $ax killed $ax killed $eax
302 ; SDAG-X86-NEXT: retl
304 ; FASTISEL-X86-LABEL: or_imm16_i16:
305 ; FASTISEL-X86: # %bb.0:
306 ; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
307 ; FASTISEL-X86-NEXT: orw $1023, %ax # imm = 0x3FF
308 ; FASTISEL-X86-NEXT: retl
310 ; GISEL-X86-LABEL: or_imm16_i16:
311 ; GISEL-X86: # %bb.0:
312 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
313 ; GISEL-X86-NEXT: orw $1023, %ax # imm = 0x3FF
314 ; GISEL-X86-NEXT: # kill: def $ax killed $ax killed $eax
315 ; GISEL-X86-NEXT: retl
317 ; SDAG-X64-LABEL: or_imm16_i16:
319 ; SDAG-X64-NEXT: movl %edi, %eax
320 ; SDAG-X64-NEXT: orl $1023, %eax # imm = 0x3FF
321 ; SDAG-X64-NEXT: # kill: def $ax killed $ax killed $eax
322 ; SDAG-X64-NEXT: retq
324 ; FASTISEL-X64-LABEL: or_imm16_i16:
325 ; FASTISEL-X64: # %bb.0:
326 ; FASTISEL-X64-NEXT: movl %edi, %eax
327 ; FASTISEL-X64-NEXT: orw $1023, %ax # imm = 0x3FF
328 ; FASTISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
329 ; FASTISEL-X64-NEXT: retq
331 ; GISEL-X64-LABEL: or_imm16_i16:
332 ; GISEL-X64: # %bb.0:
333 ; GISEL-X64-NEXT: movl %edi, %eax
334 ; GISEL-X64-NEXT: orw $1023, %ax # imm = 0x3FF
335 ; GISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
336 ; GISEL-X64-NEXT: retq
341 define i32 @or_imm16_i32(i32 %a) {
342 ; SDAG-X86-LABEL: or_imm16_i32:
344 ; SDAG-X86-NEXT: movl $2044, %eax # imm = 0x7FC
345 ; SDAG-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
346 ; SDAG-X86-NEXT: retl
348 ; FASTISEL-X86-LABEL: or_imm16_i32:
349 ; FASTISEL-X86: # %bb.0:
350 ; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
351 ; FASTISEL-X86-NEXT: orl $2044, %eax # imm = 0x7FC
352 ; FASTISEL-X86-NEXT: retl
354 ; GISEL-X86-LABEL: or_imm16_i32:
355 ; GISEL-X86: # %bb.0:
356 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
357 ; GISEL-X86-NEXT: orl $2044, %eax # imm = 0x7FC
358 ; GISEL-X86-NEXT: retl
360 ; X64-LABEL: or_imm16_i32:
362 ; X64-NEXT: movl %edi, %eax
363 ; X64-NEXT: orl $2044, %eax # imm = 0x7FC
369 define i64 @or_imm16_i64(i64 %a) {
370 ; SDAG-X86-LABEL: or_imm16_i64:
372 ; SDAG-X86-NEXT: movl $-5022, %eax # imm = 0xEC62
373 ; SDAG-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
374 ; SDAG-X86-NEXT: movl $-1, %edx
375 ; SDAG-X86-NEXT: retl
377 ; FASTISEL-X86-LABEL: or_imm16_i64:
378 ; FASTISEL-X86: # %bb.0:
379 ; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
380 ; FASTISEL-X86-NEXT: orl $-5022, %eax # imm = 0xEC62
381 ; FASTISEL-X86-NEXT: movl $-1, %edx
382 ; FASTISEL-X86-NEXT: retl
384 ; GISEL-X86-LABEL: or_imm16_i64:
385 ; GISEL-X86: # %bb.0:
386 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
387 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
388 ; GISEL-X86-NEXT: orl $-5022, %eax # imm = 0xEC62
389 ; GISEL-X86-NEXT: orl $-1, %edx
390 ; GISEL-X86-NEXT: retl
392 ; X64-LABEL: or_imm16_i64:
394 ; X64-NEXT: movq %rdi, %rax
395 ; X64-NEXT: orq $-5022, %rax # imm = 0xEC62
397 %c = or i64 %a, -5022
401 define i32 @or_imm32_i32(i32 %a) {
402 ; SDAG-X86-LABEL: or_imm32_i32:
404 ; SDAG-X86-NEXT: movl $85538, %eax # imm = 0x14E22
405 ; SDAG-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
406 ; SDAG-X86-NEXT: retl
408 ; FASTISEL-X86-LABEL: or_imm32_i32:
409 ; FASTISEL-X86: # %bb.0:
410 ; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
411 ; FASTISEL-X86-NEXT: orl $85538, %eax # imm = 0x14E22
412 ; FASTISEL-X86-NEXT: retl
414 ; GISEL-X86-LABEL: or_imm32_i32:
415 ; GISEL-X86: # %bb.0:
416 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
417 ; GISEL-X86-NEXT: orl $85538, %eax # imm = 0x14E22
418 ; GISEL-X86-NEXT: retl
420 ; X64-LABEL: or_imm32_i32:
422 ; X64-NEXT: movl %edi, %eax
423 ; X64-NEXT: orl $85538, %eax # imm = 0x14E22
425 %c = or i32 %a, 85538
429 define i64 @or_imm32_i64(i64 %a) {
430 ; SDAG-X86-LABEL: or_imm32_i64:
432 ; SDAG-X86-NEXT: movl $-125778, %eax # imm = 0xFFFE14AE
433 ; SDAG-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
434 ; SDAG-X86-NEXT: movl $-1, %edx
435 ; SDAG-X86-NEXT: retl
437 ; FASTISEL-X86-LABEL: or_imm32_i64:
438 ; FASTISEL-X86: # %bb.0:
439 ; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
440 ; FASTISEL-X86-NEXT: orl $-125778, %eax # imm = 0xFFFE14AE
441 ; FASTISEL-X86-NEXT: movl $-1, %edx
442 ; FASTISEL-X86-NEXT: retl
444 ; GISEL-X86-LABEL: or_imm32_i64:
445 ; GISEL-X86: # %bb.0:
446 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
447 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
448 ; GISEL-X86-NEXT: orl $-125778, %eax # imm = 0xFFFE14AE
449 ; GISEL-X86-NEXT: orl $-1, %edx
450 ; GISEL-X86-NEXT: retl
452 ; X64-LABEL: or_imm32_i64:
454 ; X64-NEXT: movq %rdi, %rax
455 ; X64-NEXT: orq $-125778, %rax # imm = 0xFFFE14AE
457 %c = or i64 %a, -125778
461 define i64 @or_imm64_i64(i64 %a) {
462 ; SDAG-X86-LABEL: or_imm64_i64:
464 ; SDAG-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
465 ; SDAG-X86-NEXT: movl $-1850691612, %eax # imm = 0x91B0AFE4
466 ; SDAG-X86-NEXT: orl {{[0-9]+}}(%esp), %eax
467 ; SDAG-X86-NEXT: orl $-2, %edx
468 ; SDAG-X86-NEXT: retl
470 ; FASTISEL-X86-LABEL: or_imm64_i64:
471 ; FASTISEL-X86: # %bb.0:
472 ; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
473 ; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
474 ; FASTISEL-X86-NEXT: orl $-1850691612, %eax # imm = 0x91B0AFE4
475 ; FASTISEL-X86-NEXT: orl $-2, %edx
476 ; FASTISEL-X86-NEXT: retl
478 ; GISEL-X86-LABEL: or_imm64_i64:
479 ; GISEL-X86: # %bb.0:
480 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
481 ; GISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
482 ; GISEL-X86-NEXT: orl $-1850691612, %eax # imm = 0x91B0AFE4
483 ; GISEL-X86-NEXT: orl $-2, %edx
484 ; GISEL-X86-NEXT: retl
486 ; X64-LABEL: or_imm64_i64:
488 ; X64-NEXT: movabsq $-6145658908, %rax # imm = 0xFFFFFFFE91B0AFE4
489 ; X64-NEXT: orq %rdi, %rax
491 %c = or i64 %a, -6145658908