[llvm] [CodeGen] Fix generating permute bytes from register pair when the initial values are undefined (PR #74437)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 12:44:00 PST 2024


================
@@ -2360,8 +2360,10 @@ SDValue NVPTXTargetLowering::LowerVECTOR_SHUFFLE(SDValue Op,
   const ShuffleVectorSDNode *SVN = cast<ShuffleVectorSDNode>(Op.getNode());
   SDValue V2 = Op.getOperand(1);
   uint32_t Selector = 0;
-  for (auto I : llvm::enumerate(SVN->getMask()))
-    Selector |= (I.value() << (I.index() * 4));
+  for (auto I : llvm::enumerate(SVN->getMask())) {
+    if (I.value() != -1)
----------------
Artem-B wrote:

I'd add a comment that `-1` index is a placeholder for undef. 

https://github.com/llvm/llvm-project/pull/74437


More information about the llvm-commits mailing list