summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/Inline/ARM/inline-fp.ll
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2019-06-01 19:40:07 +0000
committerCraig Topper <craig.topper@intel.com>2019-06-01 19:40:07 +0000
commit7cebf0af4076c7d198ef8ef90b79d1ff422a42cd (patch)
tree525e928b02d880c35c6bf0972e4945b0cca81b86 /llvm/test/Transforms/Inline/ARM/inline-fp.ll
parentcd1878d0f957f72e34b378d25742dbc886f079bc (diff)
downloadbcm5719-llvm-7cebf0af4076c7d198ef8ef90b79d1ff422a42cd.tar.gz
bcm5719-llvm-7cebf0af4076c7d198ef8ef90b79d1ff422a42cd.zip
[InlineCost] Don't add the soft float function call cost for the fneg idiom, fsub -0.0, %x
Summary: Fneg can be implemented with an xor rather than a function call so we don't need to add the function call overhead. This was pointed out in D62699 Reviewers: efriedma, cameron.mcinally Reviewed By: efriedma Subscribers: javed.absar, eraman, hiraditya, haicheng, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62747 llvm-svn: 362304
Diffstat (limited to 'llvm/test/Transforms/Inline/ARM/inline-fp.ll')
-rw-r--r--llvm/test/Transforms/Inline/ARM/inline-fp.ll25
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/test/Transforms/Inline/ARM/inline-fp.ll b/llvm/test/Transforms/Inline/ARM/inline-fp.ll
index fdc066c9ba6..1d74dfd15b1 100644
--- a/llvm/test/Transforms/Inline/ARM/inline-fp.ll
+++ b/llvm/test/Transforms/Inline/ARM/inline-fp.ll
@@ -12,6 +12,8 @@
; NOFP-DAG: double not inlined into test_double because too costly to inline (cost=125, threshold=75)
; NOFP-DAG: single_force_soft not inlined into test_single_force_soft because too costly to inline (cost=125, threshold=75)
; NOFP-DAG: single_force_soft not inlined into test_single_force_soft because too costly to inline (cost=125, threshold=75)
+; NOFP-DAG: single_force_soft_fneg not inlined into test_single_force_soft_fneg because too costly to inline (cost=100, threshold=75)
+; NOFP-DAG: single_force_soft_fneg not inlined into test_single_force_soft_fneg because too costly to inline (cost=100, threshold=75)
; FULLFP-DAG: single inlined into test_single with (cost=0, threshold=75)
; FULLFP-DAG: single inlined into test_single with (cost=-15000, threshold=75)
@@ -21,6 +23,8 @@
; FULLFP-DAG: double inlined into test_double with (cost=-15000, threshold=75)
; FULLFP-DAG: single_force_soft not inlined into test_single_force_soft because too costly to inline (cost=125, threshold=75)
; FULLFP-DAG: single_force_soft not inlined into test_single_force_soft because too costly to inline (cost=125, threshold=75)
+; FULLFP-DAG: single_force_soft_fneg not inlined into test_single_force_soft_fneg because too costly to inline (cost=100, threshold=75)
+; FULLFP-DAG: single_force_soft_fneg not inlined into test_single_force_soft_fneg because too costly to inline (cost=100, threshold=75)
; SINGLEFP-DAG: single inlined into test_single with (cost=0, threshold=75)
; SINGLEFP-DAG: single inlined into test_single with (cost=-15000, threshold=75)
@@ -30,6 +34,8 @@
; SINGLEFP-DAG: double not inlined into test_double because too costly to inline (cost=125, threshold=75)
; SINGLEFP-DAG: single_force_soft not inlined into test_single_force_soft because too costly to inline (cost=125, threshold=75)
; SINGLEFP-DAG: single_force_soft not inlined into test_single_force_soft because too costly to inline (cost=125, threshold=75)
+; SINGLEFP-DAG: single_force_soft_fneg not inlined into test_single_force_soft_fneg because too costly to inline (cost=100, threshold=75)
+; SINGLEFP-DAG: single_force_soft_fneg not inlined into test_single_force_soft_fneg because too costly to inline (cost=100, threshold=75)
define i32 @test_single(i32 %a, i8 %b, i32 %c, i8 %d) #0 {
%call = call float @single(i32 %a, i8 zeroext %b)
@@ -55,6 +61,12 @@ define i32 @test_single_force_soft(i32 %a, i8 %b, i32 %c, i8 %d) #1 {
ret i32 0
}
+define i32 @test_single_force_soft_fneg(i32 %a, i8 %b, i32 %c, i8 %d) #1 {
+ %call = call float @single_force_soft_fneg(i32 %a, i8 zeroext %b) #1
+ %call2 = call float @single_force_soft_fneg(i32 %c, i8 zeroext %d) #1
+ ret i32 0
+}
+
define internal float @single(i32 %response, i8 zeroext %value1) #0 {
entry:
%conv = zext i8 %value1 to i32
@@ -106,6 +118,19 @@ entry:
ret float %div
}
+define internal float @single_force_soft_fneg(i32 %response, i8 zeroext %value1) #1 {
+entry:
+ %conv = zext i8 %value1 to i32
+ %sub = add nsw i32 %conv, -1
+ %conv1 = sitofp i32 %sub to float
+ %0 = tail call float @llvm.pow.f32(float 0x3FF028F5C0000000, float %conv1)
+ %mul = fsub float -0.0, %0
+ %conv2 = sitofp i32 %response to float
+ %sub3 = fsub float %conv2, %mul
+ %div = fdiv float %sub3, %mul
+ ret float %div
+}
+
declare float @llvm.pow.f32(float, float) optsize minsize
declare double @llvm.pow.f64(double, double) optsize minsize
OpenPOWER on IntegriCloud