Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 189 additions & 0 deletions llvm/test/CodeGen/X86/isel-smax.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=X64
; RUN: llc < %s -mtriple=x86_64-linux-gnu -fast-isel | FileCheck %s --check-prefixes=FASTISEL-X64
; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64
; RUN: llc < %s -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86
; RUN: llc < %s -mtriple=i686-linux-gnu -fast-isel | FileCheck %s --check-prefixes=FASTISEL-X86
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86

define i8 @smax_i8(i8 %a, i8 %b) nounwind readnone {
; X64-LABEL: smax_i8:
; X64: # %bb.0:
; X64-NEXT: movl %esi, %eax
; X64-NEXT: cmpb %al, %dil
; X64-NEXT: cmovgl %edi, %eax
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
;
; FASTISEL-X64-LABEL: smax_i8:
; FASTISEL-X64: # %bb.0:
; FASTISEL-X64-NEXT: movzbl %dil, %ecx
; FASTISEL-X64-NEXT: movzbl %sil, %eax
; FASTISEL-X64-NEXT: cmpb %al, %cl
; FASTISEL-X64-NEXT: cmovgl %ecx, %eax
; FASTISEL-X64-NEXT: # kill: def $al killed $al killed $eax
; FASTISEL-X64-NEXT: retq
;
; X86-LABEL: smax_i8:
; X86: # %bb.0:
; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: cmpb %cl, %al
; X86-NEXT: jg .LBB0_2
; X86-NEXT: # %bb.1:
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: .LBB0_2:
; X86-NEXT: retl
;
; FASTISEL-X86-LABEL: smax_i8:
; FASTISEL-X86: # %bb.0:
; FASTISEL-X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
; FASTISEL-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT: cmpb %cl, %al
; FASTISEL-X86-NEXT: jg .LBB0_2
; FASTISEL-X86-NEXT: # %bb.1:
; FASTISEL-X86-NEXT: movl %ecx, %eax
; FASTISEL-X86-NEXT: .LBB0_2:
; FASTISEL-X86-NEXT: retl
%ret = call i8 @llvm.smax.i8(i8 %a, i8 %b)
ret i8 %ret
}
define i16 @smax_i16(i16 %a, i16 %b) nounwind readnone {
; X64-LABEL: smax_i16:
; X64: # %bb.0:
; X64-NEXT: movl %esi, %eax
; X64-NEXT: cmpw %ax, %di
; X64-NEXT: cmovgl %edi, %eax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
; X64-NEXT: retq
;
; FASTISEL-X64-LABEL: smax_i16:
; FASTISEL-X64: # %bb.0:
; FASTISEL-X64-NEXT: movl %esi, %eax
; FASTISEL-X64-NEXT: cmpw %ax, %di
; FASTISEL-X64-NEXT: cmovgl %edi, %eax
; FASTISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
; FASTISEL-X64-NEXT: retq
;
; X86-LABEL: smax_i16:
; X86: # %bb.0:
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: cmpw %cx, %ax
; X86-NEXT: jg .LBB1_2
; X86-NEXT: # %bb.1:
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: .LBB1_2:
; X86-NEXT: # kill: def $ax killed $ax killed $eax
; X86-NEXT: retl
;
; FASTISEL-X86-LABEL: smax_i16:
; FASTISEL-X86: # %bb.0:
; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT: cmpw %cx, %ax
; FASTISEL-X86-NEXT: jg .LBB1_2
; FASTISEL-X86-NEXT: # %bb.1:
; FASTISEL-X86-NEXT: movl %ecx, %eax
; FASTISEL-X86-NEXT: .LBB1_2:
; FASTISEL-X86-NEXT: # kill: def $ax killed $ax killed $eax
; FASTISEL-X86-NEXT: retl
%ret = call i16 @llvm.smax.i16(i16 %a, i16 %b)
ret i16 %ret
}
define i32 @smax_i32(i32 %a, i32 %b) nounwind readnone {
; X64-LABEL: smax_i32:
; X64: # %bb.0:
; X64-NEXT: movl %esi, %eax
; X64-NEXT: cmpl %esi, %edi
; X64-NEXT: cmovgl %edi, %eax
; X64-NEXT: retq
;
; FASTISEL-X64-LABEL: smax_i32:
; FASTISEL-X64: # %bb.0:
; FASTISEL-X64-NEXT: movl %esi, %eax
; FASTISEL-X64-NEXT: cmpl %esi, %edi
; FASTISEL-X64-NEXT: cmovgl %edi, %eax
; FASTISEL-X64-NEXT: retq
;
; X86-LABEL: smax_i32:
; X86: # %bb.0:
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: cmpl %ecx, %eax
; X86-NEXT: jg .LBB2_2
; X86-NEXT: # %bb.1:
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: .LBB2_2:
; X86-NEXT: retl
;
; FASTISEL-X86-LABEL: smax_i32:
; FASTISEL-X86: # %bb.0:
; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT: cmpl %ecx, %eax
; FASTISEL-X86-NEXT: jg .LBB2_2
; FASTISEL-X86-NEXT: # %bb.1:
; FASTISEL-X86-NEXT: movl %ecx, %eax
; FASTISEL-X86-NEXT: .LBB2_2:
; FASTISEL-X86-NEXT: retl
%ret = call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %ret
}
define i64 @smax_i64(i64 %a, i64 %b) nounwind readnone {
; X64-LABEL: smax_i64:
; X64: # %bb.0:
; X64-NEXT: movq %rsi, %rax
; X64-NEXT: cmpq %rsi, %rdi
; X64-NEXT: cmovgq %rdi, %rax
; X64-NEXT: retq
;
; FASTISEL-X64-LABEL: smax_i64:
; FASTISEL-X64: # %bb.0:
; FASTISEL-X64-NEXT: movq %rsi, %rax
; FASTISEL-X64-NEXT: cmpq %rsi, %rdi
; FASTISEL-X64-NEXT: cmovgq %rdi, %rax
; FASTISEL-X64-NEXT: retq
;
; X86-LABEL: smax_i64:
; X86: # %bb.0:
; X86-NEXT: pushl %edi
; X86-NEXT: pushl %esi
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-NEXT: cmpl %eax, %ecx
; X86-NEXT: movl %esi, %edi
; X86-NEXT: sbbl %edx, %edi
; X86-NEXT: jl .LBB3_2
; X86-NEXT: # %bb.1:
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: movl %esi, %edx
; X86-NEXT: .LBB3_2:
; X86-NEXT: popl %esi
; X86-NEXT: popl %edi
; X86-NEXT: retl
;
; FASTISEL-X86-LABEL: smax_i64:
; FASTISEL-X86: # %bb.0:
; FASTISEL-X86-NEXT: pushl %edi
; FASTISEL-X86-NEXT: pushl %esi
; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %esi
; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT: cmpl %eax, %esi
; FASTISEL-X86-NEXT: movl %ecx, %edi
; FASTISEL-X86-NEXT: sbbl %edx, %edi
; FASTISEL-X86-NEXT: jl .LBB3_2
; FASTISEL-X86-NEXT: # %bb.1:
; FASTISEL-X86-NEXT: movl %esi, %eax
; FASTISEL-X86-NEXT: movl %ecx, %edx
; FASTISEL-X86-NEXT: .LBB3_2:
; FASTISEL-X86-NEXT: popl %esi
; FASTISEL-X86-NEXT: popl %edi
; FASTISEL-X86-NEXT: retl
%ret = call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %ret
}
189 changes: 189 additions & 0 deletions llvm/test/CodeGen/X86/isel-smin.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck %s --check-prefixes=X64
; RUN: llc < %s -mtriple=x86_64-linux-gnu -fast-isel | FileCheck %s --check-prefixes=FASTISEL-X64
; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X64
; RUN: llc < %s -mtriple=i686-linux-gnu | FileCheck %s --check-prefixes=X86
; RUN: llc < %s -mtriple=i686-linux-gnu -fast-isel | FileCheck %s --check-prefixes=FASTISEL-X86
; RUN: llc < %s -mtriple=i686-linux-gnu -global-isel -global-isel-abort=2 | FileCheck %s --check-prefixes=X86

define i8 @smin_i8(i8 %a, i8 %b) nounwind readnone {
; X64-LABEL: smin_i8:
; X64: # %bb.0:
; X64-NEXT: movl %esi, %eax
; X64-NEXT: cmpb %al, %dil
; X64-NEXT: cmovll %edi, %eax
; X64-NEXT: # kill: def $al killed $al killed $eax
; X64-NEXT: retq
;
; FASTISEL-X64-LABEL: smin_i8:
; FASTISEL-X64: # %bb.0:
; FASTISEL-X64-NEXT: movzbl %dil, %ecx
; FASTISEL-X64-NEXT: movzbl %sil, %eax
; FASTISEL-X64-NEXT: cmpb %al, %cl
; FASTISEL-X64-NEXT: cmovll %ecx, %eax
; FASTISEL-X64-NEXT: # kill: def $al killed $al killed $eax
; FASTISEL-X64-NEXT: retq
;
; X86-LABEL: smin_i8:
; X86: # %bb.0:
; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
; X86-NEXT: cmpb %cl, %al
; X86-NEXT: jl .LBB0_2
; X86-NEXT: # %bb.1:
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: .LBB0_2:
; X86-NEXT: retl
;
; FASTISEL-X86-LABEL: smin_i8:
; FASTISEL-X86: # %bb.0:
; FASTISEL-X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
; FASTISEL-X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT: cmpb %cl, %al
; FASTISEL-X86-NEXT: jl .LBB0_2
; FASTISEL-X86-NEXT: # %bb.1:
; FASTISEL-X86-NEXT: movl %ecx, %eax
; FASTISEL-X86-NEXT: .LBB0_2:
; FASTISEL-X86-NEXT: retl
%ret = call i8 @llvm.smin.i8(i8 %a, i8 %b)
ret i8 %ret
}
define i16 @smin_i16(i16 %a, i16 %b) nounwind readnone {
; X64-LABEL: smin_i16:
; X64: # %bb.0:
; X64-NEXT: movl %esi, %eax
; X64-NEXT: cmpw %ax, %di
; X64-NEXT: cmovll %edi, %eax
; X64-NEXT: # kill: def $ax killed $ax killed $eax
; X64-NEXT: retq
;
; FASTISEL-X64-LABEL: smin_i16:
; FASTISEL-X64: # %bb.0:
; FASTISEL-X64-NEXT: movl %esi, %eax
; FASTISEL-X64-NEXT: cmpw %ax, %di
; FASTISEL-X64-NEXT: cmovll %edi, %eax
; FASTISEL-X64-NEXT: # kill: def $ax killed $ax killed $eax
; FASTISEL-X64-NEXT: retq
;
; X86-LABEL: smin_i16:
; X86: # %bb.0:
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: cmpw %cx, %ax
; X86-NEXT: jl .LBB1_2
; X86-NEXT: # %bb.1:
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: .LBB1_2:
; X86-NEXT: # kill: def $ax killed $ax killed $eax
; X86-NEXT: retl
;
; FASTISEL-X86-LABEL: smin_i16:
; FASTISEL-X86: # %bb.0:
; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
; FASTISEL-X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT: cmpw %cx, %ax
; FASTISEL-X86-NEXT: jl .LBB1_2
; FASTISEL-X86-NEXT: # %bb.1:
; FASTISEL-X86-NEXT: movl %ecx, %eax
; FASTISEL-X86-NEXT: .LBB1_2:
; FASTISEL-X86-NEXT: # kill: def $ax killed $ax killed $eax
; FASTISEL-X86-NEXT: retl
%ret = call i16 @llvm.smin.i16(i16 %a, i16 %b)
ret i16 %ret
}
define i32 @smin_i32(i32 %a, i32 %b) nounwind readnone {
; X64-LABEL: smin_i32:
; X64: # %bb.0:
; X64-NEXT: movl %esi, %eax
; X64-NEXT: cmpl %esi, %edi
; X64-NEXT: cmovll %edi, %eax
; X64-NEXT: retq
;
; FASTISEL-X64-LABEL: smin_i32:
; FASTISEL-X64: # %bb.0:
; FASTISEL-X64-NEXT: movl %esi, %eax
; FASTISEL-X64-NEXT: cmpl %esi, %edi
; FASTISEL-X64-NEXT: cmovll %edi, %eax
; FASTISEL-X64-NEXT: retq
;
; X86-LABEL: smin_i32:
; X86: # %bb.0:
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: cmpl %ecx, %eax
; X86-NEXT: jl .LBB2_2
; X86-NEXT: # %bb.1:
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: .LBB2_2:
; X86-NEXT: retl
;
; FASTISEL-X86-LABEL: smin_i32:
; FASTISEL-X86: # %bb.0:
; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT: cmpl %ecx, %eax
; FASTISEL-X86-NEXT: jl .LBB2_2
; FASTISEL-X86-NEXT: # %bb.1:
; FASTISEL-X86-NEXT: movl %ecx, %eax
; FASTISEL-X86-NEXT: .LBB2_2:
; FASTISEL-X86-NEXT: retl
%ret = call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %ret
}
define i64 @smin_i64(i64 %a, i64 %b) nounwind readnone {
; X64-LABEL: smin_i64:
; X64: # %bb.0:
; X64-NEXT: movq %rsi, %rax
; X64-NEXT: cmpq %rsi, %rdi
; X64-NEXT: cmovlq %rdi, %rax
; X64-NEXT: retq
;
; FASTISEL-X64-LABEL: smin_i64:
; FASTISEL-X64: # %bb.0:
; FASTISEL-X64-NEXT: movq %rsi, %rax
; FASTISEL-X64-NEXT: cmpq %rsi, %rdi
; FASTISEL-X64-NEXT: cmovlq %rdi, %rax
; FASTISEL-X64-NEXT: retq
;
; X86-LABEL: smin_i64:
; X86: # %bb.0:
; X86-NEXT: pushl %edi
; X86-NEXT: pushl %esi
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
; X86-NEXT: cmpl %ecx, %eax
; X86-NEXT: movl %edx, %edi
; X86-NEXT: sbbl %esi, %edi
; X86-NEXT: jl .LBB3_2
; X86-NEXT: # %bb.1:
; X86-NEXT: movl %ecx, %eax
; X86-NEXT: movl %esi, %edx
; X86-NEXT: .LBB3_2:
; X86-NEXT: popl %esi
; X86-NEXT: popl %edi
; X86-NEXT: retl
;
; FASTISEL-X86-LABEL: smin_i64:
; FASTISEL-X86: # %bb.0:
; FASTISEL-X86-NEXT: pushl %edi
; FASTISEL-X86-NEXT: pushl %esi
; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %esi
; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %edx
; FASTISEL-X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; FASTISEL-X86-NEXT: cmpl %esi, %eax
; FASTISEL-X86-NEXT: movl %edx, %edi
; FASTISEL-X86-NEXT: sbbl %ecx, %edi
; FASTISEL-X86-NEXT: jl .LBB3_2
; FASTISEL-X86-NEXT: # %bb.1:
; FASTISEL-X86-NEXT: movl %esi, %eax
; FASTISEL-X86-NEXT: movl %ecx, %edx
; FASTISEL-X86-NEXT: .LBB3_2:
; FASTISEL-X86-NEXT: popl %esi
; FASTISEL-X86-NEXT: popl %edi
; FASTISEL-X86-NEXT: retl
%ret = call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %ret
}
Loading
Loading