[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:48 PST 2024


================
@@ -540,6 +549,24 @@ struct BinaryOpc_match {
   }
 };
 
+/// Matches shuffle.
+template <typename T0, typename T1, typename T2> struct SDShuffle_match {
+  T0 Op1;
+  T1 Op2;
+  T2 Mask;
----------------
mshockwave wrote:

Since `m_Mask` is different from other pattern classes -- it has `match(ArrayRef<int>)` rather than `match(Context, SDValue)`, I think you at least need to check if `T2` has the desired signature using type traits.
But more fundamentally, should be put another layer here? Could we just store the mask's `ArrayRef` directly here?

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


More information about the llvm-commits mailing list