1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+cmov | FileCheck %s --check-prefix=X64
6 ; PR48768 - 'or' clears the overflow flag, so we don't need a separate 'test'.
9 define i8 @or_i8_ri(i8 zeroext %0, i8 zeroext %1) {
10 ; X86-LABEL: or_i8_ri:
12 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
13 ; X86-NEXT: movl %eax, %ecx
14 ; X86-NEXT: orb $-17, %cl
15 ; X86-NEXT: je .LBB0_2
17 ; X86-NEXT: movl %ecx, %eax
21 ; X64-LABEL: or_i8_ri:
23 ; X64-NEXT: movl %edi, %eax
24 ; X64-NEXT: orb $-17, %al
25 ; X64-NEXT: movzbl %al, %eax
26 ; X64-NEXT: cmovel %edi, %eax
27 ; X64-NEXT: # kill: def $al killed $al killed $eax
31 %5 = select i1 %4, i8 %0, i8 %3
35 define i8 @or_i8_rr(i8 zeroext %0, i8 zeroext %1) {
36 ; X86-LABEL: or_i8_rr:
38 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
39 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
40 ; X86-NEXT: orb %al, %cl
41 ; X86-NEXT: je .LBB1_2
43 ; X86-NEXT: movl %ecx, %eax
47 ; X64-LABEL: or_i8_rr:
49 ; X64-NEXT: movl %esi, %eax
50 ; X64-NEXT: orl %edi, %eax
51 ; X64-NEXT: cmovel %edi, %eax
52 ; X64-NEXT: # kill: def $al killed $al killed $eax
56 %5 = select i1 %4, i8 %0, i8 %3
60 define i16 @or_i16_ri(i16 zeroext %0, i16 zeroext %1) {
61 ; X86-LABEL: or_i16_ri:
63 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
64 ; X86-NEXT: movl %eax, %ecx
65 ; X86-NEXT: orl $65519, %ecx # imm = 0xFFEF
66 ; X86-NEXT: testw %cx, %cx
67 ; X86-NEXT: je .LBB2_2
69 ; X86-NEXT: movl %ecx, %eax
71 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
74 ; X64-LABEL: or_i16_ri:
76 ; X64-NEXT: movl %edi, %eax
77 ; X64-NEXT: orl $65519, %eax # imm = 0xFFEF
78 ; X64-NEXT: cmovel %edi, %eax
79 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
82 %4 = icmp eq i16 %3, 0
83 %5 = select i1 %4, i16 %0, i16 %3
87 define i16 @or_i16_rr(i16 zeroext %0, i16 zeroext %1) {
88 ; X86-LABEL: or_i16_rr:
90 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
91 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
92 ; X86-NEXT: orw %ax, %cx
93 ; X86-NEXT: je .LBB3_2
95 ; X86-NEXT: movl %ecx, %eax
97 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
100 ; X64-LABEL: or_i16_rr:
102 ; X64-NEXT: movl %esi, %eax
103 ; X64-NEXT: orl %edi, %eax
104 ; X64-NEXT: cmovel %edi, %eax
105 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
108 %4 = icmp eq i16 %3, 0
109 %5 = select i1 %4, i16 %0, i16 %3
113 define i32 @or_i32_ri(i32 %0, i32 %1) {
114 ; X86-LABEL: or_i32_ri:
116 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
117 ; X86-NEXT: movl %eax, %ecx
118 ; X86-NEXT: orl $-17, %ecx
119 ; X86-NEXT: jle .LBB4_2
121 ; X86-NEXT: movl %ecx, %eax
125 ; X64-LABEL: or_i32_ri:
127 ; X64-NEXT: movl %edi, %eax
128 ; X64-NEXT: orl $-17, %eax
129 ; X64-NEXT: cmovlel %edi, %eax
132 %4 = icmp slt i32 %3, 1
133 %5 = select i1 %4, i32 %0, i32 %3
137 define i32 @or_i32_rr(i32 %0, i32 %1) {
138 ; X86-LABEL: or_i32_rr:
140 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
141 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
142 ; X86-NEXT: orl %eax, %ecx
143 ; X86-NEXT: jle .LBB5_2
145 ; X86-NEXT: movl %ecx, %eax
149 ; X64-LABEL: or_i32_rr:
151 ; X64-NEXT: movl %esi, %eax
152 ; X64-NEXT: orl %edi, %eax
153 ; X64-NEXT: cmovlel %edi, %eax
156 %4 = icmp slt i32 %3, 1
157 %5 = select i1 %4, i32 %0, i32 %3
161 define i64 @or_i64_ri(i64 %0, i64 %1) nounwind {
162 ; X86-LABEL: or_i64_ri:
164 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
165 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
166 ; X86-NEXT: testl %edx, %edx
167 ; X86-NEXT: js .LBB6_2
169 ; X86-NEXT: orl $17, %eax
173 ; X64-LABEL: or_i64_ri:
175 ; X64-NEXT: movq %rdi, %rax
176 ; X64-NEXT: orq $17, %rax
177 ; X64-NEXT: cmovleq %rdi, %rax
180 %4 = icmp slt i64 %3, 1
181 %5 = select i1 %4, i64 %0, i64 %3
185 define i64 @or_i64_rr(i64 %0, i64 %1) nounwind {
186 ; X86-LABEL: or_i64_rr:
188 ; X86-NEXT: pushl %edi
189 ; X86-NEXT: pushl %esi
190 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
191 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
192 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
193 ; X86-NEXT: orl %edx, %ecx
194 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
195 ; X86-NEXT: orl %eax, %esi
196 ; X86-NEXT: cmpl $1, %esi
197 ; X86-NEXT: movl %ecx, %edi
198 ; X86-NEXT: sbbl $0, %edi
199 ; X86-NEXT: jl .LBB7_2
201 ; X86-NEXT: movl %esi, %eax
202 ; X86-NEXT: movl %ecx, %edx
204 ; X86-NEXT: popl %esi
205 ; X86-NEXT: popl %edi
208 ; X64-LABEL: or_i64_rr:
210 ; X64-NEXT: movq %rsi, %rax
211 ; X64-NEXT: orq %rdi, %rax
212 ; X64-NEXT: cmovleq %rdi, %rax
215 %4 = icmp slt i64 %3, 1
216 %5 = select i1 %4, i64 %0, i64 %3