[PATCH] D158399: [WebAssembly] Optimize vector shift using a splat value from outside block

Yolanda via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 21 05:18:49 PDT 2023


YolandaCY created this revision.
Herald added subscribers: sunshaoce, pmatos, asb, sunfish, hiraditya, jgravelle-google, sbc100, dschuff.
Herald added a project: All.
YolandaCY added reviewers: tlively, craig.topper.
YolandaCY published this revision for review.
YolandaCY added a comment.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.

This is to resolve a WebAssembly codegen issue when vector shift is used in a loop, while the shift amount is initialized outside the loop. Could you help take a look? Thanks!


The vector shift operation in WebAssembly uses an i32 shift amount type,
while the LLVM IR requires binary operator uses the same type of operands.
When the shift amount operand is splated from a different block, the splat source
will not be exported and the vector shift will be unrolled to scalar shifts.
This patch enables the vector shift to identify the splat source value from
the other block, and generate expected WebAssembly bytecode when lowering.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158399

Files:
  llvm/include/llvm/CodeGen/SelectionDAG.h
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h
  llvm/test/CodeGen/WebAssembly/simd-shift-in-loop.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158399.551933.patch
Type: text/x-patch
Size: 10540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230821/554c90b6/attachment.bin>


More information about the llvm-commits mailing list