[PATCH] D54287: [WebAssembly] Implement TargetLowering hooks for vectors
Heejin Ahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 15 19:54:54 PST 2018
aheejin added a comment.
I think we can have test for each of these functions; each selection should affect code generation of some constructs. For example, for `storeOfVectorConstantIsCheap`, we can have a test that .ll code that stores a vector value to memory will generate a single vector store rather than n scalar stores. Searching for the usages of each function in llvm code might help I think.
================
Comment at: lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:526
+ return true;
+}
+
----------------
The explanation of this function says:
> Return true if inserting a scalar into a variable element of an undef vector is more efficiently handled by splatting the scalar instead.
I'm not 100% sure what this means, but to me this sounds like, if you want to insert a single element to an undef vector, it is better to just do splat then inserting a single element.
1. Is my interpretation correct?
2. If so, what should other undef elements be initialized with?
3. Don't we have `replace_lane` too? Why is `splat` faster than `replace_lane`?
And while investigating current behaviors related to this, I filed a [[ https://bugs.llvm.org/show_bug.cgi?id=39685 | bug ]]. I might be mistaken, so please let me know then.
================
Comment at: lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:529
+bool WebAssemblyTargetLowering::isVectorShiftByScalarCheap(Type *Ty) const {
+ // Anything else is actually very expensive.
+ return true;
----------------
Maybe it's better to state that wasm SIMD shift instruction only takes scalar shift amounts, so if it's not a scalar we need an expensive sequence of code.
Repository:
rL LLVM
https://reviews.llvm.org/D54287
More information about the llvm-commits
mailing list