diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2015-01-13 20:53:23 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2015-01-13 20:53:23 +0000 |
commit | bf0db918b23cb28b8ed35fe0371d0d9be6fd27f4 (patch) | |
tree | 0c652c950ff493f9058e8e8998486df42f556b5e /llvm/lib/CodeGen | |
parent | e93d06a5793514da2c6b16165e67361443094a4e (diff) | |
download | bcm5719-llvm-bf0db918b23cb28b8ed35fe0371d0d9be6fd27f4.tar.gz bcm5719-llvm-bf0db918b23cb28b8ed35fe0371d0d9be6fd27f4.zip |
R600: Implement getRecipEstimate
This requires a new hook to prevent expanding sqrt in terms
of rsqrt and reciprocal. v_rcp_f32, v_rsq_f32, and v_sqrt_f32 are
all the same rate, so this expansion would just double the number
of instructions and cycles.
llvm-svn: 225828
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringBase.cpp | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 171ee1e3488..e57c5a2b1ac 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -7538,7 +7538,8 @@ SDValue DAGCombiner::visitFREM(SDNode *N) { } SDValue DAGCombiner::visitFSQRT(SDNode *N) { - if (DAG.getTarget().Options.UnsafeFPMath) { + if (DAG.getTarget().Options.UnsafeFPMath && + !TLI.isFsqrtCheap()) { // Compute this as X * (1/sqrt(X)) = X * (X ** -0.5) if (SDValue RV = BuildRsqrtEstimate(N->getOperand(0))) { EVT VT = RV.getValueType(); diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp index fae54d2c304..9b2fdffa87c 100644 --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -710,6 +710,7 @@ TargetLoweringBase::TargetLoweringBase(const TargetMachine &tm) HasMultipleConditionRegisters = false; HasExtractBitsInsn = false; IntDivIsCheap = false; + FsqrtIsCheap = false; Pow2SDivIsCheap = false; JumpIsExpensive = false; PredictableSelectIsExpensive = false; |