mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-09 21:50:50 +00:00
a018099669
Current implementation handles unordered comparison poorly in soft-float mode. Consider (a ULE b) which is a <= b. It is lowered to (ledf2(a, b) <= 0 || unorddf2(a, b) != 0) (in general). We can do better job by lowering it to (__gtdf2(a, b) <= 0). Such replacement is true for other CMP's (ult, ugt, uge). In general, we just call same function as for ordered case but negate comparison against zero. Differential Revision: http://reviews.llvm.org/D10804 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242280 91177308-0d34-0410-b5e6-96231b3b80d8
128 lines
2.4 KiB
LLVM
128 lines
2.4 KiB
LLVM
; RUN: llc < %s -march=x86 -mcpu=pentium -mtriple=x86-linux-gnu -float-abi=soft | FileCheck %s
|
|
|
|
define i1 @test1(double %d) #0 {
|
|
entry:
|
|
%cmp = fcmp ule double %d, 0.000000e+00
|
|
ret i1 %cmp
|
|
}
|
|
; CHECK-LABEL: test1:
|
|
; CHECK: calll __gtdf2
|
|
; CHECK: setle
|
|
; CHECK: retl
|
|
|
|
define i1 @test2(double %d) #0 {
|
|
entry:
|
|
%cmp = fcmp ult double %d, 0.000000e+00
|
|
ret i1 %cmp
|
|
}
|
|
; CHECK-LABEL: test2:
|
|
; CHECK: calll __gedf2
|
|
; CHECK: sets
|
|
; CHECK: retl
|
|
|
|
define i1 @test3(double %d) #0 {
|
|
entry:
|
|
%cmp = fcmp ugt double %d, 0.000000e+00
|
|
ret i1 %cmp
|
|
}
|
|
; CHECK-LABEL: test3:
|
|
; CHECK: calll __ledf2
|
|
; CHECK: setg
|
|
; CHECK: retl
|
|
|
|
define i1 @test4(double %d) #0 {
|
|
entry:
|
|
%cmp = fcmp uge double %d, 0.000000e+00
|
|
ret i1 %cmp
|
|
}
|
|
; CHECK-LABEL: test4:
|
|
; CHECK: calll __ltdf2
|
|
; CHECK: setns
|
|
; CHECK: retl
|
|
|
|
define i1 @test5(double %d) #0 {
|
|
entry:
|
|
%cmp = fcmp ole double %d, 0.000000e+00
|
|
ret i1 %cmp
|
|
}
|
|
; CHECK-LABEL: test5:
|
|
; CHECK: calll __ledf2
|
|
; CHECK: setle
|
|
; CHECK: retl
|
|
|
|
define i1 @test6(double %d) #0 {
|
|
entry:
|
|
%cmp = fcmp olt double %d, 0.000000e+00
|
|
ret i1 %cmp
|
|
}
|
|
; CHECK-LABEL: test6:
|
|
; CHECK: calll __ltdf2
|
|
; CHECK: sets
|
|
; CHECK: retl
|
|
|
|
define i1 @test7(double %d) #0 {
|
|
entry:
|
|
%cmp = fcmp ogt double %d, 0.000000e+00
|
|
ret i1 %cmp
|
|
}
|
|
; CHECK-LABEL: test7:
|
|
; CHECK: calll __gtdf2
|
|
; CHECK: setg
|
|
; CHECK: retl
|
|
|
|
define i1 @test8(double %d) #0 {
|
|
entry:
|
|
%cmp = fcmp oge double %d, 0.000000e+00
|
|
ret i1 %cmp
|
|
}
|
|
; CHECK-LABEL: test8:
|
|
; CHECK: calll __gedf2
|
|
; CHECK: setns
|
|
; CHECK: retl
|
|
|
|
define i1 @test9(double %d) #0 {
|
|
entry:
|
|
%cmp = fcmp oeq double %d, 0.000000e+00
|
|
ret i1 %cmp
|
|
}
|
|
; CHECK-LABEL: test9:
|
|
; CHECK: calll __eqdf2
|
|
; CHECK: sete
|
|
; CHECK: retl
|
|
|
|
define i1 @test10(double %d) #0 {
|
|
entry:
|
|
%cmp = fcmp ueq double %d, 0.000000e+00
|
|
ret i1 %cmp
|
|
}
|
|
; CHECK-LABEL: test10:
|
|
; CHECK: calll __eqdf2
|
|
; CHECK: sete
|
|
; CHECK: calll __unorddf2
|
|
; CHECK: setne
|
|
; CHECK: retl
|
|
|
|
define i1 @test11(double %d) #0 {
|
|
entry:
|
|
%cmp = fcmp one double %d, 0.000000e+00
|
|
ret i1 %cmp
|
|
}
|
|
; CHECK-LABEL: test11:
|
|
; CHECK: calll __gtdf2
|
|
; CHECK: setg
|
|
; CHECK: calll __ltdf2
|
|
; CHECK: sets
|
|
; CHECK: retl
|
|
|
|
define i1 @test12(double %d) #0 {
|
|
entry:
|
|
%cmp = fcmp une double %d, 0.000000e+00
|
|
ret i1 %cmp
|
|
}
|
|
; CHECK-LABEL: test12:
|
|
; CHECK: calll __nedf2
|
|
; CHECK: setne
|
|
; CHECK: retl
|
|
|
|
attributes #0 = { "use-soft-float"="true" }
|