[WebAssembly] v8x16.swizzle and rewrite BUILD_VECTOR lowering
authorThomas Lively <tlively@google.com>
Wed, 9 Oct 2019 17:39:19 +0000 (17:39 +0000)
committerThomas Lively <tlively@google.com>
Wed, 9 Oct 2019 17:39:19 +0000 (17:39 +0000)
commitd5b7a4e2e8dc63b02129a29745c548613152a522
tree20219c8248eb1428ff670be384c4e61a96055b52
parent0115c10328281567391855766fef8fbe57a1d4cc
[WebAssembly] v8x16.swizzle and rewrite BUILD_VECTOR lowering

Summary:
Adds the new v8x16.swizzle SIMD instruction as specified at
https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#swizzling-using-variable-indices.
In addition to adding swizzles as a candidate lowering in
LowerBUILD_VECTOR, also rewrites and simplifies the lowering to
minimize the number of replace_lanes necessary rather than trying to
minimize code size. This leads to more uses of v128.const instead of
splats, which is expected to increase performance.

The new code will be easier to tune once V8 implements all the vector
construction operations, and it will also be easier to add new
candidate instructions in the future if necessary.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68527

llvm-svn: 374188
llvm/lib/Target/WebAssembly/WebAssemblyISD.def
llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
llvm/test/CodeGen/WebAssembly/simd-build-vector.ll
llvm/test/MC/WebAssembly/simd-encodings.s