define i32 @func(i32 %x, i32 %y) nounwind {
; X86-LABEL: func:
; X86: # %bb.0:
-; X86-NEXT: pushl %esi
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-NEXT: xorl %ecx, %ecx
-; X86-NEXT: movl %eax, %esi
-; X86-NEXT: subl %edx, %esi
+; X86-NEXT: cmpl %edx, %eax
; X86-NEXT: setns %cl
; X86-NEXT: addl $2147483647, %ecx # imm = 0x7FFFFFFF
; X86-NEXT: subl %edx, %eax
; X86-NEXT: cmovol %ecx, %eax
-; X86-NEXT: popl %esi
; X86-NEXT: retl
;
; X64-LABEL: func:
; X64: # %bb.0:
; X64-NEXT: xorl %eax, %eax
-; X64-NEXT: movl %edi, %ecx
-; X64-NEXT: subl %esi, %ecx
+; X64-NEXT: cmpl %esi, %edi
; X64-NEXT: setns %al
; X64-NEXT: addl $2147483647, %eax # imm = 0x7FFFFFFF
; X64-NEXT: subl %esi, %edi
; X64-LABEL: func2:
; X64: # %bb.0:
; X64-NEXT: xorl %ecx, %ecx
-; X64-NEXT: movq %rdi, %rax
-; X64-NEXT: subq %rsi, %rax
+; X64-NEXT: cmpq %rsi, %rdi
; X64-NEXT: setns %cl
; X64-NEXT: movabsq $9223372036854775807, %rax # imm = 0x7FFFFFFFFFFFFFFF
; X64-NEXT: addq %rcx, %rax
define i16 @func16(i16 %x, i16 %y) nounwind {
; X86-LABEL: func16:
; X86: # %bb.0:
-; X86-NEXT: pushl %esi
; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movzwl {{[0-9]+}}(%esp), %edx
; X86-NEXT: xorl %ecx, %ecx
-; X86-NEXT: movl %eax, %esi
-; X86-NEXT: subw %dx, %si
+; X86-NEXT: cmpw %dx, %ax
; X86-NEXT: setns %cl
; X86-NEXT: addl $32767, %ecx # imm = 0x7FFF
; X86-NEXT: subw %dx, %ax
; X86-NEXT: cmovol %ecx, %eax
; X86-NEXT: # kill: def $ax killed $ax killed $eax
-; X86-NEXT: popl %esi
; X86-NEXT: retl
;
; X64-LABEL: func16:
; X64: # %bb.0:
; X64-NEXT: xorl %eax, %eax
-; X64-NEXT: movl %edi, %ecx
-; X64-NEXT: subw %si, %cx
+; X64-NEXT: cmpw %si, %di
; X64-NEXT: setns %al
; X64-NEXT: addl $32767, %eax # imm = 0x7FFF
; X64-NEXT: subw %si, %di
; X86-NEXT: movb {{[0-9]+}}(%esp), %al
; X86-NEXT: movb {{[0-9]+}}(%esp), %dl
; X86-NEXT: xorl %ecx, %ecx
-; X86-NEXT: movb %al, %ah
-; X86-NEXT: subb %dl, %ah
+; X86-NEXT: cmpb %dl, %al
; X86-NEXT: setns %cl
; X86-NEXT: addl $127, %ecx
; X86-NEXT: subb %dl, %al
; X64-LABEL: func8:
; X64: # %bb.0:
; X64-NEXT: xorl %ecx, %ecx
-; X64-NEXT: movl %edi, %eax
-; X64-NEXT: subb %sil, %al
+; X64-NEXT: cmpb %sil, %dil
; X64-NEXT: setns %cl
; X64-NEXT: addl $127, %ecx
; X64-NEXT: subb %sil, %dil
; X86-NEXT: shlb $4, %dl
; X86-NEXT: shlb $4, %al
; X86-NEXT: xorl %ecx, %ecx
-; X86-NEXT: movb %al, %ah
-; X86-NEXT: subb %dl, %ah
+; X86-NEXT: cmpb %dl, %al
; X86-NEXT: setns %cl
; X86-NEXT: addl $127, %ecx
; X86-NEXT: subb %dl, %al
; X64-NEXT: shlb $4, %sil
; X64-NEXT: shlb $4, %dil
; X64-NEXT: xorl %ecx, %ecx
-; X64-NEXT: movl %edi, %eax
-; X64-NEXT: subb %sil, %al
+; X64-NEXT: cmpb %sil, %dil
; X64-NEXT: setns %cl
; X64-NEXT: addl $127, %ecx
; X64-NEXT: subb %sil, %dil
define <4 x i32> @vec(<4 x i32> %x, <4 x i32> %y) nounwind {
; X86-LABEL: vec:
; X86: # %bb.0:
-; X86-NEXT: pushl %ebp
; X86-NEXT: pushl %ebx
; X86-NEXT: pushl %edi
; X86-NEXT: pushl %esi
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-NEXT: xorl %eax, %eax
-; X86-NEXT: movl %ecx, %esi
-; X86-NEXT: subl %edx, %esi
+; X86-NEXT: cmpl %edx, %ecx
; X86-NEXT: setns %al
; X86-NEXT: addl $2147483647, %eax # imm = 0x7FFFFFFF
; X86-NEXT: subl %edx, %ecx
; X86-NEXT: cmovol %eax, %ecx
; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-NEXT: xorl %eax, %eax
-; X86-NEXT: movl %edx, %edi
-; X86-NEXT: subl %esi, %edi
+; X86-NEXT: cmpl %esi, %edx
; X86-NEXT: setns %al
; X86-NEXT: addl $2147483647, %eax # imm = 0x7FFFFFFF
; X86-NEXT: subl %esi, %edx
; X86-NEXT: cmovol %eax, %edx
; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
; X86-NEXT: xorl %eax, %eax
-; X86-NEXT: movl %esi, %ebx
-; X86-NEXT: subl %edi, %ebx
+; X86-NEXT: cmpl %edi, %esi
; X86-NEXT: setns %al
; X86-NEXT: addl $2147483647, %eax # imm = 0x7FFFFFFF
; X86-NEXT: subl %edi, %esi
; X86-NEXT: cmovol %eax, %esi
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: xorl %ebx, %ebx
-; X86-NEXT: movl %edi, %ebp
-; X86-NEXT: subl %eax, %ebp
+; X86-NEXT: cmpl %eax, %edi
; X86-NEXT: setns %bl
; X86-NEXT: addl $2147483647, %ebx # imm = 0x7FFFFFFF
; X86-NEXT: subl %eax, %edi
; X86-NEXT: popl %esi
; X86-NEXT: popl %edi
; X86-NEXT: popl %ebx
-; X86-NEXT: popl %ebp
; X86-NEXT: retl $4
;
; X64-LABEL: vec:
define void @v1i8(<1 x i8>* %px, <1 x i8>* %py, <1 x i8>* %pz) nounwind {
; SSE-LABEL: v1i8:
; SSE: # %bb.0:
-; SSE-NEXT: movb (%rdi), %cl
-; SSE-NEXT: movb (%rsi), %dil
+; SSE-NEXT: movb (%rdi), %al
+; SSE-NEXT: movb (%rsi), %cl
; SSE-NEXT: xorl %esi, %esi
-; SSE-NEXT: movl %ecx, %eax
-; SSE-NEXT: subb %dil, %al
+; SSE-NEXT: cmpb %cl, %al
; SSE-NEXT: setns %sil
; SSE-NEXT: addl $127, %esi
-; SSE-NEXT: subb %dil, %cl
-; SSE-NEXT: movzbl %cl, %eax
+; SSE-NEXT: subb %cl, %al
+; SSE-NEXT: movzbl %al, %eax
; SSE-NEXT: cmovol %esi, %eax
; SSE-NEXT: movb %al, (%rdx)
; SSE-NEXT: retq
;
; AVX-LABEL: v1i8:
; AVX: # %bb.0:
-; AVX-NEXT: movb (%rdi), %cl
-; AVX-NEXT: movb (%rsi), %dil
+; AVX-NEXT: movb (%rdi), %al
+; AVX-NEXT: movb (%rsi), %cl
; AVX-NEXT: xorl %esi, %esi
-; AVX-NEXT: movl %ecx, %eax
-; AVX-NEXT: subb %dil, %al
+; AVX-NEXT: cmpb %cl, %al
; AVX-NEXT: setns %sil
; AVX-NEXT: addl $127, %esi
-; AVX-NEXT: subb %dil, %cl
-; AVX-NEXT: movzbl %cl, %eax
+; AVX-NEXT: subb %cl, %al
+; AVX-NEXT: movzbl %al, %eax
; AVX-NEXT: cmovol %esi, %eax
; AVX-NEXT: movb %al, (%rdx)
; AVX-NEXT: retq
; SSE-NEXT: movzwl (%rdi), %eax
; SSE-NEXT: movzwl (%rsi), %ecx
; SSE-NEXT: xorl %esi, %esi
-; SSE-NEXT: movl %eax, %edi
-; SSE-NEXT: subw %cx, %di
+; SSE-NEXT: cmpw %cx, %ax
; SSE-NEXT: setns %sil
; SSE-NEXT: addl $32767, %esi # imm = 0x7FFF
; SSE-NEXT: subw %cx, %ax
; AVX-NEXT: movzwl (%rdi), %eax
; AVX-NEXT: movzwl (%rsi), %ecx
; AVX-NEXT: xorl %esi, %esi
-; AVX-NEXT: movl %eax, %edi
-; AVX-NEXT: subw %cx, %di
+; AVX-NEXT: cmpw %cx, %ax
; AVX-NEXT: setns %sil
; AVX-NEXT: addl $32767, %esi # imm = 0x7FFF
; AVX-NEXT: subw %cx, %ax