diff options
author | Dale Johannesen <dalej@apple.com> | 2009-09-25 17:23:22 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2009-09-25 17:23:22 +0000 |
commit | c72134269f27f775b49063a9c4f1ff8736ce9eec (patch) | |
tree | e32df3d674a094a4776e094818d8bf2580683ded /llvm/lib | |
parent | 221460e0bee5a9eb51eae8f7b6df3e29ae8a1aa2 (diff) | |
download | bcm5719-llvm-c72134269f27f775b49063a9c4f1ff8736ce9eec.tar.gz bcm5719-llvm-c72134269f27f775b49063a9c4f1ff8736ce9eec.zip |
Generate FSQRT from calls to the sqrt function, which
allows appropriate backends to generate a sqrt instruction.
On x86, this isn't done at -O0 because we go through
FastISel instead. This is a behavior change from before
this series of sqrt patches started. I think this is OK
considering that compile speed is most important at -O0, but
could be convinced otherwise.
llvm-svn: 82778
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index 36e7285f207..8431e20d831 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -4576,6 +4576,15 @@ void SelectionDAGLowering::visitCall(CallInst &I) { Tmp.getValueType(), Tmp)); return; } + } else if (Name == "sqrt" || Name == "sqrtf" || Name == "sqrtl") { + if (I.getNumOperands() == 2 && // Basic sanity checks. + I.getOperand(1)->getType()->isFloatingPoint() && + I.getType() == I.getOperand(1)->getType()) { + SDValue Tmp = getValue(I.getOperand(1)); + setValue(&I, DAG.getNode(ISD::FSQRT, getCurDebugLoc(), + Tmp.getValueType(), Tmp)); + return; + } } } } else if (isa<InlineAsm>(I.getOperand(0))) { |