[llvm] [SDPatternMatch] Add matchers m_ExtractSubvector and m_InsertSubvector (PR #120212)
Min-Yih Hsu via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 9 09:21:13 PST 2025
================
@@ -182,15 +188,34 @@ TEST_F(SelectionDAGPatternMatchTest, matchTernaryOp) {
EXPECT_TRUE(sd_match(ExtractELT, m_ExtractElt(m_Value(), m_Value())));
EXPECT_TRUE(sd_match(ExtractELT, m_ExtractElt(m_Value(), m_ConstInt())));
EXPECT_TRUE(sd_match(ExtractELT, m_ExtractElt(m_Value(), m_SpecificInt(1))));
+
+ EXPECT_TRUE(sd_match(InsertSubvector,
+ m_InsertSubvector(m_Value(), m_Value(), m_Value())));
+ EXPECT_TRUE(sd_match(
+ InsertSubvector,
+ m_InsertSubvector(m_Specific(V2), m_Specific(V3), m_Specific(Idx0))));
+ EXPECT_TRUE(sd_match(
+ InsertSubvector,
+ m_InsertSubvector(m_Specific(V2), m_Specific(V3), m_SpecificInt(0))));
+ EXPECT_FALSE(sd_match(
+ InsertSubvector,
+ m_InsertSubvector(m_Specific(V2), m_Specific(V3), m_Specific(Idx3))));
+ EXPECT_FALSE(sd_match(
+ InsertSubvector,
+ m_InsertSubvector(m_Specific(V2), m_Specific(V3), m_SpecificInt(3))));
+
----------------
mshockwave wrote:
@cheezeburglar could you remove this empty line to make clang-format happy?
https://github.com/llvm/llvm-project/pull/120212
More information about the llvm-commits
mailing list