[PATCH] D54287: [WebAssembly] Implement TargetLowering hooks for vectors
Thomas Lively via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 8 17:38:51 PST 2018
tlively created this revision.
tlively added reviewers: aheejin, dschuff.
Herald added subscribers: llvm-commits, sunfish, jgravelle-google, sbc100.
Repository:
rL LLVM
https://reviews.llvm.org/D54287
Files:
lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
lib/Target/WebAssembly/WebAssemblyISelLowering.h
Index: lib/Target/WebAssembly/WebAssemblyISelLowering.h
===================================================================
--- lib/Target/WebAssembly/WebAssemblyISelLowering.h
+++ lib/Target/WebAssembly/WebAssemblyISelLowering.h
@@ -64,6 +64,13 @@
bool allowsMisalignedMemoryAccesses(EVT, unsigned AddrSpace, unsigned Align,
bool *Fast) const override;
bool isIntDivCheap(EVT VT, AttributeList Attr) const override;
+ bool
+ shouldExpandBuildVectorWithShuffles(EVT,
+ unsigned DefinedValues) const override;
+ bool storeOfVectorConstantIsCheap(EVT MemVT, unsigned NumElem,
+ unsigned AddrSpace) const override;
+ bool shouldSplatInsEltVarIndex(EVT) const override;
+ bool isVectorShiftByScalarCheap(Type *Ty) const override;
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context,
EVT VT) const override;
Index: lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
===================================================================
--- lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -508,6 +508,28 @@
return true;
}
+bool WebAssemblyTargetLowering::shouldExpandBuildVectorWithShuffles(
+ EVT, unsigned DefinedValues) const {
+ // Shuffles are very large (18 bytes!), so we would rather not use them.
+ return false;
+}
+
+bool WebAssemblyTargetLowering::storeOfVectorConstantIsCheap(
+ EVT MemVT, unsigned NumElem, unsigned AddrSpace) const {
+ // The alternative is to store each element individually, which is more code.
+ return true;
+}
+
+bool WebAssemblyTargetLowering::shouldSplatInsEltVarIndex(EVT) const {
+ // WebAssembly has native splats.
+ return true;
+}
+
+bool WebAssemblyTargetLowering::isVectorShiftByScalarCheap(Type *Ty) const {
+ // Anything else is actually very expensive.
+ return true;
+}
+
EVT WebAssemblyTargetLowering::getSetCCResultType(const DataLayout &DL,
LLVMContext &C,
EVT VT) const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54287.173252.patch
Type: text/x-patch
Size: 2169 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181109/4ef3d3f9/attachment.bin>
More information about the llvm-commits
mailing list