llvm-project/llvm/test/CodeGen/X86/fp128-compare.ll

102 lines
2.5 KiB
LLVM
Raw Normal View History

; RUN: llc < %s -O2 -mtriple=x86_64-linux-android -mattr=+mmx | FileCheck %s
; RUN: llc < %s -O2 -mtriple=x86_64-linux-gnu -mattr=+mmx | FileCheck %s
define i32 @TestComp128GT(fp128 %d1, fp128 %d2) {
entry:
%cmp = fcmp ogt fp128 %d1, %d2
%conv = zext i1 %cmp to i32
ret i32 %conv
; CHECK-LABEL: TestComp128GT:
; CHECK: callq __gttf2
; CHECK: xorl %ecx, %ecx
; CHECK: setg %cl
; CHECK: movl %ecx, %eax
; CHECK: retq
}
define i32 @TestComp128GE(fp128 %d1, fp128 %d2) {
entry:
%cmp = fcmp oge fp128 %d1, %d2
%conv = zext i1 %cmp to i32
ret i32 %conv
; CHECK-LABEL: TestComp128GE:
; CHECK: callq __getf2
; CHECK: xorl %ecx, %ecx
; CHECK: testl %eax, %eax
; CHECK: setns %cl
; CHECK: movl %ecx, %eax
; CHECK: retq
}
define i32 @TestComp128LT(fp128 %d1, fp128 %d2) {
entry:
%cmp = fcmp olt fp128 %d1, %d2
%conv = zext i1 %cmp to i32
ret i32 %conv
; CHECK-LABEL: TestComp128LT:
; CHECK: callq __lttf2
; CHECK-NEXT: shrl $31, %eax
; CHECK: retq
;
; The 'shrl' is a special optimization in llvm to combine
; the effect of 'fcmp olt' and 'zext'. The main purpose is
; to test soften call to __lttf2.
}
define i32 @TestComp128LE(fp128 %d1, fp128 %d2) {
entry:
%cmp = fcmp ole fp128 %d1, %d2
%conv = zext i1 %cmp to i32
ret i32 %conv
; CHECK-LABEL: TestComp128LE:
; CHECK: callq __letf2
; CHECK: xorl %ecx, %ecx
; CHECK: testl %eax, %eax
; CHECK: setle %cl
; CHECK: movl %ecx, %eax
; CHECK: retq
}
define i32 @TestComp128EQ(fp128 %d1, fp128 %d2) {
entry:
%cmp = fcmp oeq fp128 %d1, %d2
%conv = zext i1 %cmp to i32
ret i32 %conv
; CHECK-LABEL: TestComp128EQ:
; CHECK: callq __eqtf2
; CHECK: xorl %ecx, %ecx
; CHECK: testl %eax, %eax
; CHECK: sete %cl
; CHECK: movl %ecx, %eax
; CHECK: retq
}
define i32 @TestComp128NE(fp128 %d1, fp128 %d2) {
entry:
%cmp = fcmp une fp128 %d1, %d2
%conv = zext i1 %cmp to i32
ret i32 %conv
; CHECK-LABEL: TestComp128NE:
; CHECK: callq __netf2
; CHECK: xorl %ecx, %ecx
; CHECK: testl %eax, %eax
; CHECK: setne %cl
; CHECK: movl %ecx, %eax
; CHECK: retq
}
define fp128 @TestMax(fp128 %x, fp128 %y) {
entry:
%cmp = fcmp ogt fp128 %x, %y
%cond = select i1 %cmp, fp128 %x, fp128 %y
ret fp128 %cond
; CHECK-LABEL: TestMax:
; CHECK: movaps %xmm0
Recommit r265547, and r265610,r265639,r265657 on top of it, plus two fixes with one about error verify-regalloc reported, and another about live range update of phi after rematerialization. r265547: Replace analyzeSiblingValues with new algorithm to fix its compile time issue. The patch is to solve PR17409 and its duplicates. analyzeSiblingValues is a N x N complexity algorithm where N is the number of siblings generated by reg splitting. Although it causes siginificant compile time issue when N is large, it is also important for performance since it removes redundent spills and enables rematerialization. To solve the compile time issue, the patch removes analyzeSiblingValues and replaces it with lower cost alternatives containing two parts. The first part creates a new spill hoisting method in postOptimization of register allocation. It does spill hoisting at once after all the spills are generated instead of inside every instance of selectOrSplit. The second part queries the define expr of the original register for rematerializaiton and keep it always available during register allocation even if it is already dead. It deletes those dead instructions only in postOptimization. With the two parts in the patch, it can remove analyzeSiblingValues without sacrificing performance. Patches on top of r265547: r265610 "Fix the compare-clang diff error introduced by r265547." r265639 "Fix the sanitizer bootstrap error in r265547." r265657 "InlineSpiller.cpp: Escap \@ in r265547. [-Wdocumentation]" Differential Revision: http://reviews.llvm.org/D15302 Differential Revision: http://reviews.llvm.org/D18934 Differential Revision: http://reviews.llvm.org/D18935 Differential Revision: http://reviews.llvm.org/D18936 llvm-svn: 266162
2016-04-13 11:08:27 +08:00
; CHECK: movaps %xmm1
; CHECK: callq __gttf2
; CHECK: movaps {{.*}}, %xmm0
; CHECK: testl %eax, %eax
; CHECK: movaps {{.*}}, %xmm0
; CHECK: retq
}