[WebAssembly] Tell TargetTransformInfo about popcnt and sqrt.
[oota-llvm.git] / lib / Target / WebAssembly / WebAssemblyTargetTransformInfo.cpp
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;
 }