summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-10-18 18:36:49 +0000
committerSanjay Patel <spatel@rotateright.com>2016-10-18 18:36:49 +0000
commit19601fa58772d1f3213e969bd8b2123d7918bf91 (patch)
treee0f48abc44a5c9af856aa552f859f42dfdbf0754 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parentefdc36c80202653e7f6469565e9cfabc9355786b (diff)
downloadbcm5719-llvm-19601fa58772d1f3213e969bd8b2123d7918bf91.tar.gz
bcm5719-llvm-19601fa58772d1f3213e969bd8b2123d7918bf91.zip
revert r284495: [Target] remove TargetRecip class
There's something wrong with the StringRef usage while parsing the attribute string. llvm-svn: 284513
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp41
1 files changed, 9 insertions, 32 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index dd7328ccab0..aa63889a7d7 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -14870,21 +14870,11 @@ SDValue DAGCombiner::BuildReciprocalEstimate(SDValue Op, SDNodeFlags *Flags) {
if (Level >= AfterLegalizeDAG)
return SDValue();
- // TODO: Handle half and/or extended types?
- EVT VT = Op.getValueType();
- if (VT.getScalarType() != MVT::f32 && VT.getScalarType() != MVT::f64)
- return SDValue();
+ // Expose the DAG combiner to the target combiner implementations.
+ TargetLowering::DAGCombinerInfo DCI(DAG, Level, false, this);
- // If estimates are explicitly disabled for this function, we're done.
- MachineFunction &MF = DAG.getMachineFunction();
- int Enabled = TLI.getDivEnabled(VT, MF);
- if (Enabled == TLI.ReciprocalEstimate::Disabled)
- return SDValue();
-
- // Estimates may be explicitly enabled for this type with a custom number of
- // refinement steps.
- int Iterations = TLI.getDivRefinementSteps(VT, MF);
- if (SDValue Est = TLI.getRecipEstimate(Op, DAG, Enabled, Iterations)) {
+ unsigned Iterations = 0;
+ if (SDValue Est = TLI.getRecipEstimate(Op, DCI, Iterations)) {
if (Iterations) {
// Newton iteration for a function: F(X) is X_{i+1} = X_i - F(X_i)/F'(X_i)
// For the reciprocal, we need to find the zero of the function:
@@ -14899,7 +14889,7 @@ SDValue DAGCombiner::BuildReciprocalEstimate(SDValue Op, SDNodeFlags *Flags) {
AddToWorklist(Est.getNode());
// Newton iterations: Est = Est + Est (1 - Arg * Est)
- for (int i = 0; i < Iterations; ++i) {
+ for (unsigned i = 0; i < Iterations; ++i) {
SDValue NewEst = DAG.getNode(ISD::FMUL, DL, VT, Op, Est, Flags);
AddToWorklist(NewEst.getNode());
@@ -15021,24 +15011,11 @@ SDValue DAGCombiner::buildSqrtEstimateImpl(SDValue Op, SDNodeFlags *Flags,
if (Level >= AfterLegalizeDAG)
return SDValue();
- // TODO: Handle half and/or extended types?
- EVT VT = Op.getValueType();
- if (VT.getScalarType() != MVT::f32 && VT.getScalarType() != MVT::f64)
- return SDValue();
-
- // If estimates are explicitly disabled for this function, we're done.
- MachineFunction &MF = DAG.getMachineFunction();
- int Enabled = TLI.getSqrtEnabled(VT, MF);
- if (Enabled == TLI.ReciprocalEstimate::Disabled)
- return SDValue();
-
- // Estimates may be explicitly enabled for this type with a custom number of
- // refinement steps.
- int Iterations = TLI.getSqrtRefinementSteps(VT, MF);
-
+ // Expose the DAG combiner to the target combiner implementations.
+ TargetLowering::DAGCombinerInfo DCI(DAG, Level, false, this);
+ unsigned Iterations = 0;
bool UseOneConstNR = false;
- if (SDValue Est =
- TLI.getRsqrtEstimate(Op, DAG, Enabled, Iterations, UseOneConstNR)) {
+ if (SDValue Est = TLI.getRsqrtEstimate(Op, DCI, Iterations, UseOneConstNR)) {
AddToWorklist(Est.getNode());
if (Iterations) {
Est = UseOneConstNR
OpenPOWER on IntegriCloud