diff options
author | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-08-23 10:27:02 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-08-23 10:27:02 +0000 |
commit | 37cd6cfba2e92fa89fbc4e8653edf1bb3229ba0d (patch) | |
tree | e6823002829472937c12857c88104b02b2d3b7a3 /llvm/lib/CodeGen/BasicTargetTransformInfo.cpp | |
parent | 1f1b2756a467b8ab835109c4aae6a4e84cbd64c3 (diff) | |
download | llvm-37cd6cfba2e92fa89fbc4e8653edf1bb3229ba0d.zip llvm-37cd6cfba2e92fa89fbc4e8653edf1bb3229ba0d.tar.gz llvm-37cd6cfba2e92fa89fbc4e8653edf1bb3229ba0d.tar.bz2 |
Turn MipsOptimizeMathLibCalls into a target-independent scalar transform
...so that it can be used for z too. Most of the code is the same.
The only real change is to use TargetTransformInfo to test when a sqrt
instruction is available.
The pass is opt-in because at the moment it only handles sqrt.
llvm-svn: 189097
Diffstat (limited to 'llvm/lib/CodeGen/BasicTargetTransformInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/BasicTargetTransformInfo.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp b/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp index 0883ab0..d5340e6 100644 --- a/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp +++ b/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp @@ -83,6 +83,7 @@ public: virtual unsigned getJumpBufAlignment() const; virtual unsigned getJumpBufSize() const; virtual bool shouldBuildLookupTables() const; + virtual bool haveFastSqrt(Type *Ty) const; /// @} @@ -182,6 +183,12 @@ bool BasicTTI::shouldBuildLookupTables() const { TLI->isOperationLegalOrCustom(ISD::BRIND, MVT::Other)); } +bool BasicTTI::haveFastSqrt(Type *Ty) const { + const TargetLoweringBase *TLI = getTLI(); + EVT VT = TLI->getValueType(Ty); + return TLI->isTypeLegal(VT) && TLI->isOperationLegalOrCustom(ISD::FSQRT, VT); +} + //===----------------------------------------------------------------------===// // // Calls used by the vectorizers. |