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.usub.sat.i4(i4, i4)
6 declare i8 @llvm.usub.sat.i8(i8, i8)
7 declare i16 @llvm.usub.sat.i16(i16, i16)
8 declare i32 @llvm.usub.sat.i32(i32, i32)
9 declare i64 @llvm.usub.sat.i64(i64, i64)
11 define i32 @func32(i32 %x, i32 %y, i32 %z) nounwind {
14 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
15 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
16 ; X86-NEXT: imull {{[0-9]+}}(%esp), %ecx
17 ; X86-NEXT: xorl %edx, %edx
18 ; X86-NEXT: subl %ecx, %eax
19 ; X86-NEXT: cmovbl %edx, %eax
24 ; X64-NEXT: imull %edx, %esi
25 ; X64-NEXT: xorl %eax, %eax
26 ; X64-NEXT: subl %esi, %edi
27 ; X64-NEXT: cmovael %edi, %eax
30 %tmp = call i32 @llvm.usub.sat.i32(i32 %x, i32 %a)
34 define i64 @func64(i64 %x, i64 %y, i64 %z) nounwind {
37 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
38 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
39 ; X86-NEXT: xorl %ecx, %ecx
40 ; X86-NEXT: subl {{[0-9]+}}(%esp), %eax
41 ; X86-NEXT: sbbl {{[0-9]+}}(%esp), %edx
42 ; X86-NEXT: cmovbl %ecx, %edx
43 ; X86-NEXT: cmovbl %ecx, %eax
48 ; X64-NEXT: xorl %eax, %eax
49 ; X64-NEXT: subq %rdx, %rdi
50 ; X64-NEXT: cmovaeq %rdi, %rax
53 %tmp = call i64 @llvm.usub.sat.i64(i64 %x, i64 %z)
57 define zeroext i16 @func16(i16 zeroext %x, i16 zeroext %y, i16 zeroext %z) nounwind {
60 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
61 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
62 ; X86-NEXT: imulw {{[0-9]+}}(%esp), %cx
63 ; X86-NEXT: xorl %edx, %edx
64 ; X86-NEXT: subw %cx, %ax
65 ; X86-NEXT: cmovbl %edx, %eax
66 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
71 ; X64-NEXT: imull %edx, %esi
72 ; X64-NEXT: xorl %eax, %eax
73 ; X64-NEXT: subw %si, %di
74 ; X64-NEXT: cmovael %edi, %eax
75 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
78 %tmp = call i16 @llvm.usub.sat.i16(i16 %x, i16 %a)
82 define zeroext i8 @func8(i8 zeroext %x, i8 zeroext %y, i8 zeroext %z) nounwind {
85 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
86 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
87 ; X86-NEXT: mulb {{[0-9]+}}(%esp)
88 ; X86-NEXT: xorl %edx, %edx
89 ; X86-NEXT: subb %al, %cl
90 ; X86-NEXT: movzbl %cl, %eax
91 ; X86-NEXT: cmovbl %edx, %eax
92 ; X86-NEXT: # kill: def $al killed $al killed $eax
97 ; X64-NEXT: movl %esi, %eax
98 ; X64-NEXT: # kill: def $al killed $al killed $eax
100 ; X64-NEXT: xorl %ecx, %ecx
101 ; X64-NEXT: subb %al, %dil
102 ; X64-NEXT: movzbl %dil, %eax
103 ; X64-NEXT: cmovbl %ecx, %eax
104 ; X64-NEXT: # kill: def $al killed $al killed $eax
107 %tmp = call i8 @llvm.usub.sat.i8(i8 %x, i8 %a)
111 define zeroext i4 @func4(i4 zeroext %x, i4 zeroext %y, i4 zeroext %z) nounwind {
114 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
115 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
116 ; X86-NEXT: mulb {{[0-9]+}}(%esp)
117 ; X86-NEXT: andb $15, %al
118 ; X86-NEXT: xorl %edx, %edx
119 ; X86-NEXT: subb %al, %cl
120 ; X86-NEXT: movzbl %cl, %eax
121 ; X86-NEXT: cmovbl %edx, %eax
122 ; X86-NEXT: movzbl %al, %eax
127 ; X64-NEXT: movl %esi, %eax
128 ; X64-NEXT: # kill: def $al killed $al killed $eax
130 ; X64-NEXT: andb $15, %al
131 ; X64-NEXT: xorl %ecx, %ecx
132 ; X64-NEXT: subb %al, %dil
133 ; X64-NEXT: movzbl %dil, %eax
134 ; X64-NEXT: cmovbl %ecx, %eax
135 ; X64-NEXT: movzbl %al, %eax
138 %tmp = call i4 @llvm.usub.sat.i4(i4 %x, i4 %a)