1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686 -mattr=cmov | FileCheck %s --check-prefixes=CHECK,X86
3 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefixes=CHECK,X64
5 declare i4 @llvm.uadd.sat.i4 (i4, i4)
6 declare i32 @llvm.uadd.sat.i32 (i32, i32)
7 declare i64 @llvm.uadd.sat.i64 (i64, i64)
8 declare <4 x i32> @llvm.uadd.sat.v4i32(<4 x i32>, <4 x i32>)
10 define i32 @func(i32 %x, i32 %y) nounwind {
13 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
14 ; X86-NEXT: addl {{[0-9]+}}(%esp), %ecx
15 ; X86-NEXT: movl $-1, %eax
16 ; X86-NEXT: cmovael %ecx, %eax
21 ; X64-NEXT: addl %esi, %edi
22 ; X64-NEXT: movl $-1, %eax
23 ; X64-NEXT: cmovael %edi, %eax
25 %tmp = call i32 @llvm.uadd.sat.i32(i32 %x, i32 %y);
29 define i64 @func2(i64 %x, i64 %y) nounwind {
32 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
33 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
34 ; X86-NEXT: addl {{[0-9]+}}(%esp), %eax
35 ; X86-NEXT: adcl {{[0-9]+}}(%esp), %edx
36 ; X86-NEXT: movl $-1, %ecx
37 ; X86-NEXT: cmovbl %ecx, %edx
38 ; X86-NEXT: cmovbl %ecx, %eax
43 ; X64-NEXT: addq %rsi, %rdi
44 ; X64-NEXT: movq $-1, %rax
45 ; X64-NEXT: cmovaeq %rdi, %rax
47 %tmp = call i64 @llvm.uadd.sat.i64(i64 %x, i64 %y);
51 define i4 @func3(i4 %x, i4 %y) nounwind {
54 ; X86-NEXT: movb {{[0-9]+}}(%esp), %al
55 ; X86-NEXT: movb {{[0-9]+}}(%esp), %cl
56 ; X86-NEXT: shlb $4, %cl
57 ; X86-NEXT: shlb $4, %al
58 ; X86-NEXT: addb %cl, %al
59 ; X86-NEXT: movzbl %al, %ecx
60 ; X86-NEXT: movl $255, %eax
61 ; X86-NEXT: cmovael %ecx, %eax
62 ; X86-NEXT: shrb $4, %al
63 ; X86-NEXT: # kill: def $al killed $al killed $eax
68 ; X64-NEXT: shlb $4, %sil
69 ; X64-NEXT: shlb $4, %dil
70 ; X64-NEXT: addb %sil, %dil
71 ; X64-NEXT: movzbl %dil, %ecx
72 ; X64-NEXT: movl $255, %eax
73 ; X64-NEXT: cmovael %ecx, %eax
74 ; X64-NEXT: shrb $4, %al
75 ; X64-NEXT: # kill: def $al killed $al killed $eax
77 %tmp = call i4 @llvm.uadd.sat.i4(i4 %x, i4 %y);
81 define <4 x i32> @vec(<4 x i32> %x, <4 x i32> %y) nounwind {
84 ; X86-NEXT: pushl %ebx
85 ; X86-NEXT: pushl %edi
86 ; X86-NEXT: pushl %esi
87 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
88 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
89 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
90 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
91 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
92 ; X86-NEXT: addl {{[0-9]+}}(%esp), %edi
93 ; X86-NEXT: movl $-1, %ebx
94 ; X86-NEXT: cmovbl %ebx, %edi
95 ; X86-NEXT: addl {{[0-9]+}}(%esp), %esi
96 ; X86-NEXT: cmovbl %ebx, %esi
97 ; X86-NEXT: addl {{[0-9]+}}(%esp), %edx
98 ; X86-NEXT: cmovbl %ebx, %edx
99 ; X86-NEXT: addl {{[0-9]+}}(%esp), %ecx
100 ; X86-NEXT: cmovbl %ebx, %ecx
101 ; X86-NEXT: movl %ecx, 12(%eax)
102 ; X86-NEXT: movl %edx, 8(%eax)
103 ; X86-NEXT: movl %esi, 4(%eax)
104 ; X86-NEXT: movl %edi, (%eax)
105 ; X86-NEXT: popl %esi
106 ; X86-NEXT: popl %edi
107 ; X86-NEXT: popl %ebx
112 ; X64-NEXT: movdqa {{.*#+}} xmm2 = [2147483648,2147483648,2147483648,2147483648]
113 ; X64-NEXT: paddd %xmm0, %xmm1
114 ; X64-NEXT: pxor %xmm2, %xmm0
115 ; X64-NEXT: pxor %xmm1, %xmm2
116 ; X64-NEXT: pcmpgtd %xmm2, %xmm0
117 ; X64-NEXT: por %xmm1, %xmm0
119 %tmp = call <4 x i32> @llvm.uadd.sat.v4i32(<4 x i32> %x, <4 x i32> %y);