[llvm] r245853 - [WebAssembly] Tell TargetTransformInfo about popcnt and sqrt.

Dan Gohman via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 09:51:46 PDT 2015


Author: djg
Date: Mon Aug 24 11:51:46 2015
New Revision: 245853

URL: http://llvm.org/viewvc/llvm-project?rev=245853&view=rev
Log:
[WebAssembly] Tell TargetTransformInfo about popcnt and sqrt.

Modified:
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp?rev=245853&r1=245852&r2=245853&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp Mon Aug 24 11:51:46 2015
@@ -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;
 }

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h?rev=245853&r1=245852&r2=245853&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h Mon Aug 24 11:51:46 2015
@@ -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;
 
   /// @}
 




More information about the llvm-commits mailing list