[PATCH] D72467: Remove "mask" operand from shufflevector.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 24 05:55:40 PST 2020


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

LGTM, but should get a 2nd opinion since I'm not familiar with some of the parts.
Also, please update the related LangRef text for shufflevector in or alongside this patch.

Could add some ascii art to visualize the mask indexing as requested by @ctetreau ?

  shufflevector <3 x float> %x, <3 x float> %y, <n x i32> %mask:
  +---+---+---+---+---+---+
  |     x     |     y     |  vector operands
  +---+---+---+---+---+---+
  | 0 | 1 | 2 | 0 | 1 | 2 |  per-operand indexing
  +---+---+---+---+---+---+
  | 0 | 1 | 2 | 3 | 4 | 5 |  shuffle mask indexing
  +---+---+---+---+---+---+



================
Comment at: llvm/include/llvm/IR/Instructions.h:2039
   /// Return the shuffle mask value of this instruction for the given element
   /// index. Return -1 if the element is undef.
   int getMaskValue(unsigned Elt) const {
----------------
Can replace the magic -1 with the named "UndefMaskElem" in this comment.


================
Comment at: llvm/include/llvm/IR/Instructions.h:2050
   /// Return the mask for this instruction as a vector of integers. Undefined
   /// elements of the mask are returned as -1.
   void getShuffleMask(SmallVectorImpl<int> &Result) const {
----------------
Can replace the magic -1 with the named "UndefMaskElem" in this comment.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72467/new/

https://reviews.llvm.org/D72467





More information about the llvm-commits mailing list