mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
[InstCombine] add tests for FP sign-bit cmp optimization with fdiv; NFC
These are baseline tests for D51942. Patch by: @marels (Martin Elshuber) llvm-svn: 343222
This commit is contained in:
parent
c499c7b046
commit
cd67cf7062
@ -377,3 +377,99 @@ define i1 @test19_undef_ordered() {
|
||||
ret i1 %cmp
|
||||
}
|
||||
|
||||
; Can fold 1.0 / X < 0.0 --> X < 0 with ninf
|
||||
define i1 @test20_recipX_olt_0(float %X) {
|
||||
; CHECK-LABEL: @test20_recipX_olt_0(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv ninf float 1.000000e+00, [[X:%.*]]
|
||||
; CHECK-NEXT: [[CMP:%.*]] = fcmp ninf olt float [[DIV]], 0.000000e+00
|
||||
; CHECK-NEXT: ret i1 [[CMP]]
|
||||
;
|
||||
%div = fdiv ninf float 1.0, %X
|
||||
%cmp = fcmp ninf olt float %div, 0.0
|
||||
ret i1 %cmp
|
||||
}
|
||||
|
||||
; Can fold -2.0 / X <= 0.0 --> X >= 0 with ninf
|
||||
define i1 @test21_recipX_ole_0(float %X) {
|
||||
; CHECK-LABEL: @test21_recipX_ole_0(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv ninf float -2.000000e+00, [[X:%.*]]
|
||||
; CHECK-NEXT: [[CMP:%.*]] = fcmp ninf ole float [[DIV]], 0.000000e+00
|
||||
; CHECK-NEXT: ret i1 [[CMP]]
|
||||
;
|
||||
%div = fdiv ninf float -2.0, %X
|
||||
%cmp = fcmp ninf ole float %div, 0.0
|
||||
ret i1 %cmp
|
||||
}
|
||||
|
||||
; Can fold 2.0 / X > 0.0 --> X > 0 with ninf
|
||||
define i1 @test22_recipX_ogt_0(float %X) {
|
||||
; CHECK-LABEL: @test22_recipX_ogt_0(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv ninf float 2.000000e+00, [[X:%.*]]
|
||||
; CHECK-NEXT: [[CMP:%.*]] = fcmp ninf ogt float [[DIV]], 0.000000e+00
|
||||
; CHECK-NEXT: ret i1 [[CMP]]
|
||||
;
|
||||
%div = fdiv ninf float 2.0, %X
|
||||
%cmp = fcmp ninf ogt float %div, 0.0
|
||||
ret i1 %cmp
|
||||
}
|
||||
|
||||
; Can fold -1.0 / X >= 0.0 --> X <= 0 with ninf
|
||||
define i1 @test23_recipX_oge_0(float %X) {
|
||||
; CHECK-LABEL: @test23_recipX_oge_0(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv ninf float -1.000000e+00, [[X:%.*]]
|
||||
; CHECK-NEXT: [[CMP:%.*]] = fcmp ninf oge float [[DIV]], 0.000000e+00
|
||||
; CHECK-NEXT: ret i1 [[CMP]]
|
||||
;
|
||||
%div = fdiv ninf float -1.0, %X
|
||||
%cmp = fcmp ninf oge float %div, 0.0
|
||||
ret i1 %cmp
|
||||
}
|
||||
|
||||
; Do not fold 1.0 / X > 0.0 when ninf is missing
|
||||
define i1 @test24_recipX_noninf_cmp(float %X) {
|
||||
; CHECK-LABEL: @test24_recipX_noninf_cmp(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv ninf float 2.000000e+00, [[X:%.*]]
|
||||
; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt float [[DIV]], 0.000000e+00
|
||||
; CHECK-NEXT: ret i1 [[CMP]]
|
||||
;
|
||||
%div = fdiv ninf float 2.0, %X
|
||||
%cmp = fcmp ogt float %div, 0.0
|
||||
ret i1 %cmp
|
||||
}
|
||||
|
||||
; Do not fold 1.0 / X > 0.0 when ninf is missing
|
||||
define i1 @test25_recipX_noninf_div(float %X) {
|
||||
; CHECK-LABEL: @test25_recipX_noninf_div(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv float 2.000000e+00, [[X:%.*]]
|
||||
; CHECK-NEXT: [[CMP:%.*]] = fcmp ninf ogt float [[DIV]], 0.000000e+00
|
||||
; CHECK-NEXT: ret i1 [[CMP]]
|
||||
;
|
||||
%div = fdiv float 2.0, %X
|
||||
%cmp = fcmp ninf ogt float %div, 0.0
|
||||
ret i1 %cmp
|
||||
}
|
||||
|
||||
; Do not fold 1.0 / X > 0.0 with unordered predicates
|
||||
define i1 @test26_recipX_unorderd(float %X) {
|
||||
; CHECK-LABEL: @test26_recipX_unorderd(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv ninf float 2.000000e+00, [[X:%.*]]
|
||||
; CHECK-NEXT: [[CMP:%.*]] = fcmp ninf ugt float [[DIV]], 0.000000e+00
|
||||
; CHECK-NEXT: ret i1 [[CMP]]
|
||||
;
|
||||
%div = fdiv ninf float 2.0, %X
|
||||
%cmp = fcmp ninf ugt float %div, 0.0
|
||||
ret i1 %cmp
|
||||
}
|
||||
|
||||
; Fold <-1.0, -1.0> / X > <-0.0, -0.0>
|
||||
define <2 x i1> @test27_recipX_gt_vecsplat(<2 x float> %X) {
|
||||
; CHECK-LABEL: @test27_recipX_gt_vecsplat(
|
||||
; CHECK-NEXT: [[DIV:%.*]] = fdiv ninf <2 x float> <float -1.000000e+00, float -1.000000e+00>, [[X:%.*]]
|
||||
; CHECK-NEXT: [[CMP:%.*]] = fcmp ninf ogt <2 x float> [[DIV]], <float -0.000000e+00, float -0.000000e+00>
|
||||
; CHECK-NEXT: ret <2 x i1> [[CMP]]
|
||||
;
|
||||
%div = fdiv ninf <2 x float> <float -1.0, float -1.0>, %X
|
||||
%cmp = fcmp ninf ogt <2 x float> %div, <float -0.0, float -0.0>
|
||||
ret <2 x i1> %cmp
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user