1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown -mattr=+sse2 | FileCheck %s -check-prefixes=X32
3 ; RUN: llc < %s -mtriple=x86_64-linux -mattr=+sse2 | FileCheck %s -check-prefixes=X64,X64-LIN
4 ; RUN: llc < %s -mtriple=x86_64-win32 -mattr=+sse2 | FileCheck %s -check-prefixes=X64,X64-WIN
6 ; Though it is undefined, we want xor undef,undef to produce zero.
7 define <4 x i32> @test1() nounwind {
10 ; X32-NEXT: xorps %xmm0, %xmm0
15 ; X64-NEXT: xorps %xmm0, %xmm0
17 %tmp = xor <4 x i32> undef, undef
21 ; Though it is undefined, we want xor undef,undef to produce zero.
22 define i32 @test2() nounwind{
25 ; X32-NEXT: xorl %eax, %eax
30 ; X64-NEXT: xorl %eax, %eax
32 %tmp = xor i32 undef, undef
36 define i32 @test3(i32 %a, i32 %b) nounwind {
38 ; X32: # %bb.0: # %entry
39 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
41 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
45 ; X64-LIN-LABEL: test3:
46 ; X64-LIN: # %bb.0: # %entry
47 ; X64-LIN-NEXT: movl %esi, %eax
48 ; X64-LIN-NEXT: notl %eax
49 ; X64-LIN-NEXT: andl %edi, %eax
50 ; X64-LIN-NEXT: shrl %eax
53 ; X64-WIN-LABEL: test3:
54 ; X64-WIN: # %bb.0: # %entry
55 ; X64-WIN-NEXT: movl %edx, %eax
56 ; X64-WIN-NEXT: notl %eax
57 ; X64-WIN-NEXT: andl %ecx, %eax
58 ; X64-WIN-NEXT: shrl %eax
61 %tmp1not = xor i32 %b, -2
62 %tmp3 = and i32 %tmp1not, %a
63 %tmp4 = lshr i32 %tmp3, 1
67 define i32 @test4(i32 %a, i32 %b) nounwind {
69 ; X32: # %bb.0: # %entry
70 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
71 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
72 ; X32-NEXT: .p2align 4, 0x90
73 ; X32-NEXT: .LBB3_1: # %bb
74 ; X32-NEXT: # =>This Inner Loop Header: Depth=1
75 ; X32-NEXT: xorl %ecx, %eax
76 ; X32-NEXT: movl %eax, %edx
78 ; X32-NEXT: andl %ecx, %edx
79 ; X32-NEXT: addl %edx, %edx
80 ; X32-NEXT: movl %edx, %ecx
81 ; X32-NEXT: jne .LBB3_1
82 ; X32-NEXT: # %bb.2: # %bb12
85 ; X64-LIN-LABEL: test4:
86 ; X64-LIN: # %bb.0: # %entry
87 ; X64-LIN-NEXT: movl %edi, %eax
88 ; X64-LIN-NEXT: .p2align 4, 0x90
89 ; X64-LIN-NEXT: .LBB3_1: # %bb
90 ; X64-LIN-NEXT: # =>This Inner Loop Header: Depth=1
91 ; X64-LIN-NEXT: xorl %esi, %eax
92 ; X64-LIN-NEXT: movl %eax, %ecx
93 ; X64-LIN-NEXT: notl %ecx
94 ; X64-LIN-NEXT: andl %esi, %ecx
95 ; X64-LIN-NEXT: addl %ecx, %ecx
96 ; X64-LIN-NEXT: movl %ecx, %esi
97 ; X64-LIN-NEXT: jne .LBB3_1
98 ; X64-LIN-NEXT: # %bb.2: # %bb12
101 ; X64-WIN-LABEL: test4:
102 ; X64-WIN: # %bb.0: # %entry
103 ; X64-WIN-NEXT: movl %ecx, %eax
104 ; X64-WIN-NEXT: .p2align 4, 0x90
105 ; X64-WIN-NEXT: .LBB3_1: # %bb
106 ; X64-WIN-NEXT: # =>This Inner Loop Header: Depth=1
107 ; X64-WIN-NEXT: xorl %edx, %eax
108 ; X64-WIN-NEXT: movl %eax, %ecx
109 ; X64-WIN-NEXT: notl %ecx
110 ; X64-WIN-NEXT: andl %edx, %ecx
111 ; X64-WIN-NEXT: addl %ecx, %ecx
112 ; X64-WIN-NEXT: movl %ecx, %edx
113 ; X64-WIN-NEXT: jne .LBB3_1
114 ; X64-WIN-NEXT: # %bb.2: # %bb12
119 %b_addr.0 = phi i32 [ %b, %entry ], [ %tmp8, %bb ]
120 %a_addr.0 = phi i32 [ %a, %entry ], [ %tmp3, %bb ]
121 %tmp3 = xor i32 %a_addr.0, %b_addr.0
122 %tmp4not = xor i32 %tmp3, 2147483647
123 %tmp6 = and i32 %tmp4not, %b_addr.0
124 %tmp8 = shl i32 %tmp6, 1
125 %tmp10 = icmp eq i32 %tmp8, 0
126 br i1 %tmp10, label %bb12, label %bb
131 define i16 @test5(i16 %a, i16 %b) nounwind {
133 ; X32: # %bb.0: # %entry
134 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
135 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
136 ; X32-NEXT: .p2align 4, 0x90
137 ; X32-NEXT: .LBB4_1: # %bb
138 ; X32-NEXT: # =>This Inner Loop Header: Depth=1
139 ; X32-NEXT: xorl %ecx, %eax
140 ; X32-NEXT: movl %eax, %edx
141 ; X32-NEXT: notl %edx
142 ; X32-NEXT: andl %ecx, %edx
143 ; X32-NEXT: addl %edx, %edx
144 ; X32-NEXT: testw %dx, %dx
145 ; X32-NEXT: movl %edx, %ecx
146 ; X32-NEXT: jne .LBB4_1
147 ; X32-NEXT: # %bb.2: # %bb12
148 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
151 ; X64-LIN-LABEL: test5:
152 ; X64-LIN: # %bb.0: # %entry
153 ; X64-LIN-NEXT: movl %edi, %eax
154 ; X64-LIN-NEXT: .p2align 4, 0x90
155 ; X64-LIN-NEXT: .LBB4_1: # %bb
156 ; X64-LIN-NEXT: # =>This Inner Loop Header: Depth=1
157 ; X64-LIN-NEXT: xorl %esi, %eax
158 ; X64-LIN-NEXT: movl %eax, %ecx
159 ; X64-LIN-NEXT: notl %ecx
160 ; X64-LIN-NEXT: andl %esi, %ecx
161 ; X64-LIN-NEXT: addl %ecx, %ecx
162 ; X64-LIN-NEXT: testw %cx, %cx
163 ; X64-LIN-NEXT: movl %ecx, %esi
164 ; X64-LIN-NEXT: jne .LBB4_1
165 ; X64-LIN-NEXT: # %bb.2: # %bb12
166 ; X64-LIN-NEXT: # kill: def $ax killed $ax killed $eax
169 ; X64-WIN-LABEL: test5:
170 ; X64-WIN: # %bb.0: # %entry
171 ; X64-WIN-NEXT: # kill: def $dx killed $dx def $edx
172 ; X64-WIN-NEXT: movl %ecx, %eax
173 ; X64-WIN-NEXT: .p2align 4, 0x90
174 ; X64-WIN-NEXT: .LBB4_1: # %bb
175 ; X64-WIN-NEXT: # =>This Inner Loop Header: Depth=1
176 ; X64-WIN-NEXT: xorl %edx, %eax
177 ; X64-WIN-NEXT: movl %eax, %ecx
178 ; X64-WIN-NEXT: notl %ecx
179 ; X64-WIN-NEXT: andl %edx, %ecx
180 ; X64-WIN-NEXT: addl %ecx, %ecx
181 ; X64-WIN-NEXT: testw %cx, %cx
182 ; X64-WIN-NEXT: movl %ecx, %edx
183 ; X64-WIN-NEXT: jne .LBB4_1
184 ; X64-WIN-NEXT: # %bb.2: # %bb12
185 ; X64-WIN-NEXT: # kill: def $ax killed $ax killed $eax
190 %b_addr.0 = phi i16 [ %b, %entry ], [ %tmp8, %bb ]
191 %a_addr.0 = phi i16 [ %a, %entry ], [ %tmp3, %bb ]
192 %tmp3 = xor i16 %a_addr.0, %b_addr.0
193 %tmp4not = xor i16 %tmp3, 32767
194 %tmp6 = and i16 %tmp4not, %b_addr.0
195 %tmp8 = shl i16 %tmp6, 1
196 %tmp10 = icmp eq i16 %tmp8, 0
197 br i1 %tmp10, label %bb12, label %bb
202 define i8 @test6(i8 %a, i8 %b) nounwind {
204 ; X32: # %bb.0: # %entry
205 ; X32-NEXT: movb {{[0-9]+}}(%esp), %cl
206 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
207 ; X32-NEXT: .p2align 4, 0x90
208 ; X32-NEXT: .LBB5_1: # %bb
209 ; X32-NEXT: # =>This Inner Loop Header: Depth=1
210 ; X32-NEXT: xorb %cl, %al
211 ; X32-NEXT: movl %eax, %edx
213 ; X32-NEXT: andb %cl, %dl
214 ; X32-NEXT: addb %dl, %dl
215 ; X32-NEXT: movl %edx, %ecx
216 ; X32-NEXT: jne .LBB5_1
217 ; X32-NEXT: # %bb.2: # %bb12
220 ; X64-LIN-LABEL: test6:
221 ; X64-LIN: # %bb.0: # %entry
222 ; X64-LIN-NEXT: movl %edi, %eax
223 ; X64-LIN-NEXT: .p2align 4, 0x90
224 ; X64-LIN-NEXT: .LBB5_1: # %bb
225 ; X64-LIN-NEXT: # =>This Inner Loop Header: Depth=1
226 ; X64-LIN-NEXT: xorb %sil, %al
227 ; X64-LIN-NEXT: movl %eax, %ecx
228 ; X64-LIN-NEXT: notb %cl
229 ; X64-LIN-NEXT: andb %sil, %cl
230 ; X64-LIN-NEXT: addb %cl, %cl
231 ; X64-LIN-NEXT: movl %ecx, %esi
232 ; X64-LIN-NEXT: jne .LBB5_1
233 ; X64-LIN-NEXT: # %bb.2: # %bb12
234 ; X64-LIN-NEXT: # kill: def $al killed $al killed $eax
237 ; X64-WIN-LABEL: test6:
238 ; X64-WIN: # %bb.0: # %entry
239 ; X64-WIN-NEXT: movl %ecx, %eax
240 ; X64-WIN-NEXT: .p2align 4, 0x90
241 ; X64-WIN-NEXT: .LBB5_1: # %bb
242 ; X64-WIN-NEXT: # =>This Inner Loop Header: Depth=1
243 ; X64-WIN-NEXT: xorb %dl, %al
244 ; X64-WIN-NEXT: movl %eax, %ecx
245 ; X64-WIN-NEXT: notb %cl
246 ; X64-WIN-NEXT: andb %dl, %cl
247 ; X64-WIN-NEXT: addb %cl, %cl
248 ; X64-WIN-NEXT: movl %ecx, %edx
249 ; X64-WIN-NEXT: jne .LBB5_1
250 ; X64-WIN-NEXT: # %bb.2: # %bb12
255 %b_addr.0 = phi i8 [ %b, %entry ], [ %tmp8, %bb ]
256 %a_addr.0 = phi i8 [ %a, %entry ], [ %tmp3, %bb ]
257 %tmp3 = xor i8 %a_addr.0, %b_addr.0
258 %tmp4not = xor i8 %tmp3, 127
259 %tmp6 = and i8 %tmp4not, %b_addr.0
260 %tmp8 = shl i8 %tmp6, 1
261 %tmp10 = icmp eq i8 %tmp8, 0
262 br i1 %tmp10, label %bb12, label %bb
267 define i32 @test7(i32 %a, i32 %b) nounwind {
269 ; X32: # %bb.0: # %entry
270 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
271 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
272 ; X32-NEXT: .p2align 4, 0x90
273 ; X32-NEXT: .LBB6_1: # %bb
274 ; X32-NEXT: # =>This Inner Loop Header: Depth=1
275 ; X32-NEXT: xorl %ecx, %eax
276 ; X32-NEXT: movl %eax, %edx
277 ; X32-NEXT: xorl $2147483646, %edx # imm = 0x7FFFFFFE
278 ; X32-NEXT: andl %ecx, %edx
279 ; X32-NEXT: addl %edx, %edx
280 ; X32-NEXT: movl %edx, %ecx
281 ; X32-NEXT: jne .LBB6_1
282 ; X32-NEXT: # %bb.2: # %bb12
285 ; X64-LIN-LABEL: test7:
286 ; X64-LIN: # %bb.0: # %entry
287 ; X64-LIN-NEXT: movl %edi, %eax
288 ; X64-LIN-NEXT: .p2align 4, 0x90
289 ; X64-LIN-NEXT: .LBB6_1: # %bb
290 ; X64-LIN-NEXT: # =>This Inner Loop Header: Depth=1
291 ; X64-LIN-NEXT: xorl %esi, %eax
292 ; X64-LIN-NEXT: movl %eax, %ecx
293 ; X64-LIN-NEXT: xorl $2147483646, %ecx # imm = 0x7FFFFFFE
294 ; X64-LIN-NEXT: andl %esi, %ecx
295 ; X64-LIN-NEXT: addl %ecx, %ecx
296 ; X64-LIN-NEXT: movl %ecx, %esi
297 ; X64-LIN-NEXT: jne .LBB6_1
298 ; X64-LIN-NEXT: # %bb.2: # %bb12
301 ; X64-WIN-LABEL: test7:
302 ; X64-WIN: # %bb.0: # %entry
303 ; X64-WIN-NEXT: movl %ecx, %eax
304 ; X64-WIN-NEXT: .p2align 4, 0x90
305 ; X64-WIN-NEXT: .LBB6_1: # %bb
306 ; X64-WIN-NEXT: # =>This Inner Loop Header: Depth=1
307 ; X64-WIN-NEXT: xorl %edx, %eax
308 ; X64-WIN-NEXT: movl %eax, %ecx
309 ; X64-WIN-NEXT: xorl $2147483646, %ecx # imm = 0x7FFFFFFE
310 ; X64-WIN-NEXT: andl %edx, %ecx
311 ; X64-WIN-NEXT: addl %ecx, %ecx
312 ; X64-WIN-NEXT: movl %ecx, %edx
313 ; X64-WIN-NEXT: jne .LBB6_1
314 ; X64-WIN-NEXT: # %bb.2: # %bb12
319 %b_addr.0 = phi i32 [ %b, %entry ], [ %tmp8, %bb ]
320 %a_addr.0 = phi i32 [ %a, %entry ], [ %tmp3, %bb ]
321 %tmp3 = xor i32 %a_addr.0, %b_addr.0
322 %tmp4not = xor i32 %tmp3, 2147483646
323 %tmp6 = and i32 %tmp4not, %b_addr.0
324 %tmp8 = shl i32 %tmp6, 1
325 %tmp10 = icmp eq i32 %tmp8, 0
326 br i1 %tmp10, label %bb12, label %bb
332 define i32 @test8(i32 %a) nounwind {
334 ; X32: # %bb.0: # %entry
335 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
336 ; X32-NEXT: notl %eax
339 ; X64-LIN-LABEL: test8:
340 ; X64-LIN: # %bb.0: # %entry
341 ; X64-LIN-NEXT: movl %edi, %eax
342 ; X64-LIN-NEXT: notl %eax
345 ; X64-WIN-LABEL: test8:
346 ; X64-WIN: # %bb.0: # %entry
347 ; X64-WIN-NEXT: movl %ecx, %eax
348 ; X64-WIN-NEXT: notl %eax
352 %t2 = add i32 %t1, -1
356 define i32 @test9(i32 %a) nounwind {
359 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
360 ; X32-NEXT: notl %eax
361 ; X32-NEXT: andl $4096, %eax # imm = 0x1000
364 ; X64-LIN-LABEL: test9:
366 ; X64-LIN-NEXT: movl %edi, %eax
367 ; X64-LIN-NEXT: notl %eax
368 ; X64-LIN-NEXT: andl $4096, %eax # imm = 0x1000
371 ; X64-WIN-LABEL: test9:
373 ; X64-WIN-NEXT: movl %ecx, %eax
374 ; X64-WIN-NEXT: notl %eax
375 ; X64-WIN-NEXT: andl $4096, %eax # imm = 0x1000
377 %1 = and i32 %a, 4096
378 %2 = xor i32 %1, 4096
383 define <4 x i32> @test10(<4 x i32> %a) nounwind {
386 ; X32-NEXT: andnps {{\.LCPI.*}}, %xmm0
389 ; X64-LIN-LABEL: test10:
391 ; X64-LIN-NEXT: andnps {{.*}}(%rip), %xmm0
394 ; X64-WIN-LABEL: test10:
396 ; X64-WIN-NEXT: movaps (%rcx), %xmm0
397 ; X64-WIN-NEXT: andnps __xmm@{{.*}}(%rip), %xmm0
399 %1 = and <4 x i32> %a, <i32 4096, i32 4096, i32 4096, i32 4096>
400 %2 = xor <4 x i32> %1, <i32 4096, i32 4096, i32 4096, i32 4096>
404 define i32 @PR17487(i1 %tobool) {
405 ; X32-LABEL: PR17487:
407 ; X32-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
408 ; X32-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,0,1]
409 ; X32-NEXT: pandn {{\.LCPI.*}}, %xmm0
410 ; X32-NEXT: pshufd {{.*#+}} xmm1 = xmm0[3,1,2,3]
411 ; X32-NEXT: movd %xmm1, %ecx
412 ; X32-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
413 ; X32-NEXT: movd %xmm0, %edx
414 ; X32-NEXT: xorl $1, %edx
415 ; X32-NEXT: xorl %eax, %eax
416 ; X32-NEXT: orl %ecx, %edx
417 ; X32-NEXT: setne %al
420 ; X64-LIN-LABEL: PR17487:
422 ; X64-LIN-NEXT: movl %edi, %eax
423 ; X64-LIN-NEXT: andl $1, %eax
426 ; X64-WIN-LABEL: PR17487:
428 ; X64-WIN-NEXT: movzbl %cl, %eax
429 ; X64-WIN-NEXT: andl $1, %eax
431 %tmp = insertelement <2 x i1> undef, i1 %tobool, i32 1
432 %tmp1 = zext <2 x i1> %tmp to <2 x i64>
433 %tmp2 = xor <2 x i64> %tmp1, <i64 1, i64 1>
434 %tmp3 = extractelement <2 x i64> %tmp2, i32 1
435 %add = add nsw i64 0, %tmp3
436 %cmp6 = icmp ne i64 %add, 1
437 %conv7 = zext i1 %cmp6 to i32
441 define i32 @test11(i32 %b) {
444 ; X32-NEXT: movb {{[0-9]+}}(%esp), %cl
445 ; X32-NEXT: movl $-2, %eax
446 ; X32-NEXT: roll %cl, %eax
449 ; X64-LIN-LABEL: test11:
451 ; X64-LIN-NEXT: movl %edi, %ecx
452 ; X64-LIN-NEXT: movl $-2, %eax
453 ; X64-LIN-NEXT: # kill: def $cl killed $cl killed $ecx
454 ; X64-LIN-NEXT: roll %cl, %eax
457 ; X64-WIN-LABEL: test11:
459 ; X64-WIN-NEXT: movl $-2, %eax
460 ; X64-WIN-NEXT: # kill: def $cl killed $cl killed $ecx
461 ; X64-WIN-NEXT: roll %cl, %eax
464 %neg = xor i32 %shl, -1
468 %struct.ref_s = type { %union.v, i16, i16 }
469 %union.v = type { i64 }
471 define %struct.ref_s* @test12(%struct.ref_s* %op, i64 %osbot, i64 %intval) {
474 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
475 ; X32-NEXT: notl %eax
476 ; X32-NEXT: leal (%eax,%eax,2), %eax
477 ; X32-NEXT: shll $2, %eax
478 ; X32-NEXT: addl {{[0-9]+}}(%esp), %eax
481 ; X64-LIN-LABEL: test12:
483 ; X64-LIN-NEXT: movslq %edx, %rax
484 ; X64-LIN-NEXT: notq %rax
485 ; X64-LIN-NEXT: shlq $4, %rax
486 ; X64-LIN-NEXT: addq %rdi, %rax
489 ; X64-WIN-LABEL: test12:
491 ; X64-WIN-NEXT: movslq %r8d, %rax
492 ; X64-WIN-NEXT: notq %rax
493 ; X64-WIN-NEXT: shlq $4, %rax
494 ; X64-WIN-NEXT: addq %rcx, %rax
496 %neg = shl i64 %intval, 32
497 %sext = xor i64 %neg, -4294967296
498 %idx.ext = ashr exact i64 %sext, 32
499 %add.ptr = getelementptr inbounds %struct.ref_s, %struct.ref_s* %op, i64 %idx.ext
500 ret %struct.ref_s* %add.ptr
503 define i32 @PR39657(i8* %p, i64 %x) {
504 ; X32-LABEL: PR39657:
506 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
507 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
508 ; X32-NEXT: notl %ecx
509 ; X32-NEXT: movl (%eax,%ecx,4), %eax
512 ; X64-LIN-LABEL: PR39657:
514 ; X64-LIN-NEXT: notq %rsi
515 ; X64-LIN-NEXT: movl (%rdi,%rsi,4), %eax
518 ; X64-WIN-LABEL: PR39657:
520 ; X64-WIN-NEXT: notq %rdx
521 ; X64-WIN-NEXT: movl (%rcx,%rdx,4), %eax
524 %mul = xor i64 %sh, -4
525 %add.ptr = getelementptr inbounds i8, i8* %p, i64 %mul
526 %bc = bitcast i8* %add.ptr to i32*
527 %load = load i32, i32* %bc, align 4
531 define i32 @add_of_not(i32 %x, i32 %y) {
532 ; X32-LABEL: add_of_not:
534 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
535 ; X32-NEXT: notl %eax
536 ; X32-NEXT: addl {{[0-9]+}}(%esp), %eax
539 ; X64-LIN-LABEL: add_of_not:
541 ; X64-LIN-NEXT: # kill: def $esi killed $esi def $rsi
542 ; X64-LIN-NEXT: # kill: def $edi killed $edi def $rdi
543 ; X64-LIN-NEXT: notl %esi
544 ; X64-LIN-NEXT: leal (%rsi,%rdi), %eax
547 ; X64-WIN-LABEL: add_of_not:
549 ; X64-WIN-NEXT: # kill: def $edx killed $edx def $rdx
550 ; X64-WIN-NEXT: # kill: def $ecx killed $ecx def $rcx
551 ; X64-WIN-NEXT: notl %edx
552 ; X64-WIN-NEXT: leal (%rdx,%rcx), %eax
559 define i32 @add_of_not_decrement(i32 %x, i32 %y) {
560 ; X32-LABEL: add_of_not_decrement:
562 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
563 ; X32-NEXT: notl %eax
564 ; X32-NEXT: addl {{[0-9]+}}(%esp), %eax
567 ; X64-LIN-LABEL: add_of_not_decrement:
569 ; X64-LIN-NEXT: # kill: def $esi killed $esi def $rsi
570 ; X64-LIN-NEXT: # kill: def $edi killed $edi def $rdi
571 ; X64-LIN-NEXT: notl %esi
572 ; X64-LIN-NEXT: leal (%rsi,%rdi), %eax
575 ; X64-WIN-LABEL: add_of_not_decrement:
577 ; X64-WIN-NEXT: # kill: def $edx killed $edx def $rdx
578 ; X64-WIN-NEXT: # kill: def $ecx killed $ecx def $rcx
579 ; X64-WIN-NEXT: notl %edx
580 ; X64-WIN-NEXT: leal (%rdx,%rcx), %eax
587 define <4 x i32> @vec_add_of_not(<4 x i32> %x, <4 x i32> %y) {
588 ; X32-LABEL: vec_add_of_not:
590 ; X32-NEXT: pcmpeqd %xmm2, %xmm2
591 ; X32-NEXT: pxor %xmm1, %xmm2
592 ; X32-NEXT: paddd %xmm2, %xmm0
595 ; X64-LIN-LABEL: vec_add_of_not:
597 ; X64-LIN-NEXT: pcmpeqd %xmm2, %xmm2
598 ; X64-LIN-NEXT: pxor %xmm1, %xmm2
599 ; X64-LIN-NEXT: paddd %xmm2, %xmm0
602 ; X64-WIN-LABEL: vec_add_of_not:
604 ; X64-WIN-NEXT: pcmpeqd %xmm0, %xmm0
605 ; X64-WIN-NEXT: pxor (%rdx), %xmm0
606 ; X64-WIN-NEXT: paddd (%rcx), %xmm0
608 %t0 = sub <4 x i32> %x, %y
609 %r = add <4 x i32> %t0, <i32 -1, i32 -1, i32 -1, i32 -1>
613 define <4 x i32> @vec_add_of_not_decrement(<4 x i32> %x, <4 x i32> %y) {
614 ; X32-LABEL: vec_add_of_not_decrement:
616 ; X32-NEXT: pcmpeqd %xmm2, %xmm2
617 ; X32-NEXT: pxor %xmm1, %xmm2
618 ; X32-NEXT: paddd %xmm2, %xmm0
621 ; X64-LIN-LABEL: vec_add_of_not_decrement:
623 ; X64-LIN-NEXT: pcmpeqd %xmm2, %xmm2
624 ; X64-LIN-NEXT: pxor %xmm1, %xmm2
625 ; X64-LIN-NEXT: paddd %xmm2, %xmm0
628 ; X64-WIN-LABEL: vec_add_of_not_decrement:
630 ; X64-WIN-NEXT: pcmpeqd %xmm0, %xmm0
631 ; X64-WIN-NEXT: pxor (%rdx), %xmm0
632 ; X64-WIN-NEXT: paddd (%rcx), %xmm0
634 %t0 = sub <4 x i32> %x, %y
635 %r = sub <4 x i32> %t0, <i32 1, i32 1, i32 1, i32 1>
639 define <4 x i32> @vec_add_of_not_with_undef(<4 x i32> %x, <4 x i32> %y) {
640 ; X32-LABEL: vec_add_of_not_with_undef:
642 ; X32-NEXT: psubd %xmm1, %xmm0
643 ; X32-NEXT: pcmpeqd %xmm1, %xmm1
644 ; X32-NEXT: paddd %xmm1, %xmm0
647 ; X64-LIN-LABEL: vec_add_of_not_with_undef:
649 ; X64-LIN-NEXT: psubd %xmm1, %xmm0
650 ; X64-LIN-NEXT: pcmpeqd %xmm1, %xmm1
651 ; X64-LIN-NEXT: paddd %xmm1, %xmm0
654 ; X64-WIN-LABEL: vec_add_of_not_with_undef:
656 ; X64-WIN-NEXT: movdqa (%rcx), %xmm1
657 ; X64-WIN-NEXT: psubd (%rdx), %xmm1
658 ; X64-WIN-NEXT: pcmpeqd %xmm0, %xmm0
659 ; X64-WIN-NEXT: paddd %xmm1, %xmm0
661 %t0 = sub <4 x i32> %x, %y
662 %r = add <4 x i32> %t0, <i32 -1, i32 undef, i32 -1, i32 -1>
666 define <4 x i32> @vec_add_of_not_with_undef_decrement(<4 x i32> %x, <4 x i32> %y) {
667 ; X32-LABEL: vec_add_of_not_with_undef_decrement:
669 ; X32-NEXT: psubd %xmm1, %xmm0
670 ; X32-NEXT: pcmpeqd %xmm1, %xmm1
671 ; X32-NEXT: psubd %xmm1, %xmm0
674 ; X64-LIN-LABEL: vec_add_of_not_with_undef_decrement:
676 ; X64-LIN-NEXT: psubd %xmm1, %xmm0
677 ; X64-LIN-NEXT: pcmpeqd %xmm1, %xmm1
678 ; X64-LIN-NEXT: psubd %xmm1, %xmm0
681 ; X64-WIN-LABEL: vec_add_of_not_with_undef_decrement:
683 ; X64-WIN-NEXT: movdqa (%rcx), %xmm0
684 ; X64-WIN-NEXT: psubd (%rdx), %xmm0
685 ; X64-WIN-NEXT: pcmpeqd %xmm1, %xmm1
686 ; X64-WIN-NEXT: psubd %xmm1, %xmm0
688 %t0 = sub <4 x i32> %x, %y
689 %r = add <4 x i32> %t0, <i32 1, i32 undef, i32 1, i32 1>