Turn MipsOptimizeMathLibCalls into a target-independent scalar transform
[oota-llvm.git] / lib / CodeGen / BasicTargetTransformInfo.cpp
index 0883ab0ce7f1e54179cd1a5f9f250ade891d50f1..d5340e60231eae4870f8fbab1a518c93e586c026 100644 (file)
@@ -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.