[llvm] Add matchers m_ExtractSubvector and m_InsertSubvector (PR #120212)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 3 14:51:40 PST 2025


================
@@ -293,6 +310,14 @@ TEST_F(SelectionDAGPatternMatchTest, matchBinaryOp) {
   EXPECT_FALSE(sd_match(SFAdd, m_ChainedBinOp(ISD::STRICT_FADD, m_OtherVT(),
                                               m_SpecificVT(Float32VT))));
 
+  EXPECT_TRUE(sd_match(SubVec, m_ExtractSubvector(m_Value(), m_Value())));
+  EXPECT_TRUE(
+      sd_match(SubVec, m_BinOp(ISD::EXTRACT_SUBVECTOR, m_Value(), m_Value())));
+  EXPECT_TRUE(
+      sd_match(SubVec, m_ExtractSubvector(m_Specific(Vec), m_Specific(Idx0))));
+  EXPECT_TRUE(sd_match(SubVec, m_BinOp(ISD::EXTRACT_SUBVECTOR, m_Specific(Vec),
----------------
mshockwave wrote:

I don't think we really need the checks with `m_BinOp` here. `m_ExtractSubvector` should suffice.

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


More information about the llvm-commits mailing list