[llvm] [SDPatternMatch] Add matchers m_ExtractSubvector and m_InsertSubvector (PR #120212)
Thor Preimesberger via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 9 15:11:47 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))));
+
----------------
cheezeburglar wrote:
Mea culpa - I think the latest commit should make it pass the linter. On my machine
`$ git-clang-format --diff 300deebf41d2da96701fe29c0faa8025b7efa120 f1a7cc99b45f42a5699c0464eabb1ec72cd3f967 --extensions cpp,h -- llvm/include/llvm/CodeGen/SDPatternMatch.h llvm/unittests/CodeGen/SelectionDAGPatternMatchTest.cpp`
produces no output.
https://github.com/llvm/llvm-project/pull/120212
More information about the llvm-commits
mailing list