1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686 -mattr=cmov | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefix=X64
5 declare i4 @llvm.uadd.sat.i4(i4, i4)
6 declare i8 @llvm.uadd.sat.i8(i8, i8)
7 declare i16 @llvm.uadd.sat.i16(i16, i16)
8 declare i32 @llvm.uadd.sat.i32(i32, i32)
9 declare i64 @llvm.uadd.sat.i64(i64, i64)
11 define i32 @func32(i32 %x, i32 %y, i32 %z) nounwind {
14 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
15 ; X86-NEXT: imull {{[0-9]+}}(%esp), %ecx
16 ; X86-NEXT: addl {{[0-9]+}}(%esp), %ecx
17 ; X86-NEXT: movl $-1, %eax
18 ; X86-NEXT: cmovael %ecx, %eax
23 ; X64-NEXT: imull %edx, %esi
24 ; X64-NEXT: addl %edi, %esi
25 ; X64-NEXT: movl $-1, %eax
26 ; X64-NEXT: cmovael %esi, %eax
29 %tmp = call i32 @llvm.uadd.sat.i32(i32 %x, i32 %a)
33 define i64 @func64(i64 %x, i64 %y, i64 %z) nounwind {
36 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
37 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
38 ; X86-NEXT: addl {{[0-9]+}}(%esp), %eax
39 ; X86-NEXT: adcl {{[0-9]+}}(%esp), %edx
40 ; X86-NEXT: movl $-1, %ecx
41 ; X86-NEXT: cmovbl %ecx, %edx
42 ; X86-NEXT: cmovbl %ecx, %eax
47 ; X64-NEXT: addq %rdx, %rdi
48 ; X64-NEXT: movq $-1, %rax
49 ; X64-NEXT: cmovaeq %rdi, %rax
52 %tmp = call i64 @llvm.uadd.sat.i64(i64 %x, i64 %z)
56 define zeroext i16 @func16(i16 zeroext %x, i16 zeroext %y, i16 zeroext %z) nounwind {
59 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
60 ; X86-NEXT: imulw {{[0-9]+}}(%esp), %cx
61 ; X86-NEXT: addw {{[0-9]+}}(%esp), %cx
62 ; X86-NEXT: movl $65535, %eax # imm = 0xFFFF
63 ; X86-NEXT: cmovael %ecx, %eax
64 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
69 ; X64-NEXT: imull %edx, %esi
70 ; X64-NEXT: addw %di, %si
71 ; X64-NEXT: movl $65535, %eax # imm = 0xFFFF
72 ; X64-NEXT: cmovael %esi, %eax
73 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
76 %tmp = call i16 @llvm.uadd.sat.i16(i16 %x, i16 %a)
80 define zeroext i8 @func8(i8 zeroext %x, i8 zeroext %y, i8 zeroext %z) nounwind {
83 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
84 ; X86-NEXT: mulb {{[0-9]+}}(%esp)
85 ; X86-NEXT: addb {{[0-9]+}}(%esp), %al
86 ; X86-NEXT: movzbl %al, %ecx
87 ; X86-NEXT: movl $255, %eax
88 ; X86-NEXT: cmovael %ecx, %eax
89 ; X86-NEXT: # kill: def $al killed $al killed $eax
94 ; X64-NEXT: movl %esi, %eax
95 ; X64-NEXT: # kill: def $al killed $al killed $eax
97 ; X64-NEXT: addb %dil, %al
98 ; X64-NEXT: movzbl %al, %ecx
99 ; X64-NEXT: movl $255, %eax
100 ; X64-NEXT: cmovael %ecx, %eax
101 ; X64-NEXT: # kill: def $al killed $al killed $eax
104 %tmp = call i8 @llvm.uadd.sat.i8(i8 %x, i8 %a)
108 define zeroext i4 @func4(i4 zeroext %x, i4 zeroext %y, i4 zeroext %z) nounwind {
111 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
112 ; X86-NEXT: mulb {{[0-9]+}}(%esp)
113 ; X86-NEXT: andb $15, %al
114 ; X86-NEXT: addb {{[0-9]+}}(%esp), %al
115 ; X86-NEXT: movzbl %al, %ecx
116 ; X86-NEXT: cmpb $15, %al
117 ; X86-NEXT: movl $15, %eax
118 ; X86-NEXT: cmovbl %ecx, %eax
119 ; X86-NEXT: movzbl %al, %eax
124 ; X64-NEXT: movl %esi, %eax
125 ; X64-NEXT: # kill: def $al killed $al killed $eax
127 ; X64-NEXT: andb $15, %al
128 ; X64-NEXT: addb %dil, %al
129 ; X64-NEXT: movzbl %al, %eax
130 ; X64-NEXT: cmpb $15, %al
131 ; X64-NEXT: movl $15, %ecx
132 ; X64-NEXT: cmovbl %eax, %ecx
133 ; X64-NEXT: movzbl %cl, %eax
136 %tmp = call i4 @llvm.uadd.sat.i4(i4 %x, i4 %a)