[llvm] Add SD matchers and unit test coverage for ISD::VECTOR_SHUFFLE (PR #119592)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 09:42:47 PST 2024


================
@@ -119,6 +119,25 @@ TEST_F(SelectionDAGPatternMatchTest, matchValueType) {
   EXPECT_FALSE(sd_match(Op2, m_ScalableVectorVT()));
 }
 
+TEST_F(SelectionDAGPatternMatchTest, matchVecShuffle) {
+  SDLoc DL;
+  auto Int32VT = EVT::getIntegerVT(Context, 32);
+  auto VInt32VT = EVT::getVectorVT(Context, Int32VT, 4);
+  SmallVector<int, 4> MaskData = {2, 0, 3, 1};
+  ArrayRef<int> Mask(MaskData);
----------------
mshockwave wrote:

Given how you implement `m_Mask`, I think `m_Mask` is designed to capture the mask to its argument rather than check if the mask matches its argument. Therefore, the `Mask` variable here is supposed toto store the "output" and thus doesn't need to be initialized.

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


More information about the llvm-commits mailing list