summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2015-08-24 16:51:46 +0000
committerDan Gohman <dan433584@gmail.com>2015-08-24 16:51:46 +0000
commit01612f627d86321f352c6b4fbd05394be36778a2 (patch)
tree0f0b8351a9c67aef0d13d431571bfcfd070af3d3 /llvm/lib
parente419a7c307b91b359dfd6b9dd78666d02bf478a7 (diff)
downloadbcm5719-llvm-01612f627d86321f352c6b4fbd05394be36778a2.tar.gz
bcm5719-llvm-01612f627d86321f352c6b4fbd05394be36778a2.zip
[WebAssembly] Tell TargetTransformInfo about popcnt and sqrt.
llvm-svn: 245853
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp11
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h3
2 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
index fa88ed526df..559932f5fb4 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
@@ -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;
}
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h b/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h
index 7ffb6047b96..f2158ca0dfc 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h
@@ -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;
/// @}
OpenPOWER on IntegriCloud