llvm-6502/test/CodeGen/X86/long-setcc.ll
Eli Friedman b4b8b0cc90 Add a target-specific branchless method for double-width relational
comparisons on x86.  Essentially, the way this works is that SUB+SBB sets
the relevant flags the same way a double-width CMP would.

This is a substantial improvement over the generic lowering in LLVM. The output
is also shorter than the gcc-generated output; I haven't done any detailed
benchmarking, though.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127852 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-18 02:34:11 +00:00

36 lines
602 B
LLVM

; RUN: llc < %s -march=x86 | FileCheck %s
; General case
define i1 @t1(i64 %x, i64 %y) nounwind {
; CHECK: @t1
; CHECK: subl
; CHECK: sbbl
; CHECK: setl %al
%B = icmp slt i64 %x, %y
ret i1 %B
}
; Some special cases
define i1 @t2(i64 %x) nounwind {
; CHECK: @t2
; CHECK: shrl $31, %eax
%B = icmp slt i64 %x, 0
ret i1 %B
}
define i1 @t3(i64 %x) nounwind {
; CHECK: @t3
; CHECX: cmpl $0
; CHECX: sete %al
%tmp = icmp ult i64 %x, 4294967296
ret i1 %tmp
}
define i1 @t4(i64 %x) nounwind {
; CHECK: @t4
; CHECX: cmpl $0
; CHECX: setne %al
%tmp = icmp ugt i64 %x, 4294967295
ret i1 %tmp
}