[WebAssembly] Tell TargetTransformInfo about popcnt and sqrt.
authorDan Gohman <dan433584@gmail.com>
Mon, 24 Aug 2015 16:51:46 +0000 (16:51 +0000)
committerDan Gohman <dan433584@gmail.com>
Mon, 24 Aug 2015 16:51:46 +0000 (16:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245853 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h

index fa88ed526df2cbd77262096680dbf52f46758c86..559932f5fb48951e8b08cc2ef4ec433385b41789 100644 (file)
@@ -21,8 +21,13 @@ using namespace llvm;
 #define DEBUG_TYPE "wasmtti"
 
 TargetTransformInfo::PopcntSupportKind
-WebAssemblyTTIImpl::getPopcntSupport(unsigned TyWidth) {
+WebAssemblyTTIImpl::getPopcntSupport(unsigned TyWidth) const {
   assert(isPowerOf2_32(TyWidth) && "Ty width must be power of 2");
-  // TODO: Make Math.popcount32 happen in WebAssembly.
-  return TTI::PSK_Software;
+  return TargetTransformInfo::PSK_FastHardware;
+}
+
+bool
+WebAssemblyTTIImpl::haveFastSqrt(Type *Ty) const {
+  assert(Ty->isFPOrFPVectorTy() && "Ty must be floating point");
+  return true;
 }
index 7ffb6047b9633a4ebe3ff61ee013a6f4cccbc5c8..f2158ca0dfc3af7cac145099b92e5fad9618e32d 100644 (file)
@@ -54,7 +54,8 @@ public:
 
   // TODO: Implement more Scalar TTI for WebAssembly
 
-  TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth);
+  TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth) const;
+  bool haveFastSqrt(Type *Ty) const;
 
   /// @}