[llvm] [SelectionDAG] Add m_Neg and m_Not pattern matcher and update DAGCombiner (PR #85365)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 15 06:13:03 PDT 2024
================
@@ -174,10 +174,16 @@ TEST_F(SelectionDAGPatternMatchTest, matchUnaryOp) {
SDValue SExt = DAG->getNode(ISD::SIGN_EXTEND, DL, Int64VT, Op0);
SDValue Trunc = DAG->getNode(ISD::TRUNCATE, DL, Int32VT, Op1);
+ SDValue Neg = DAG->getNegative(Op0, DL, Int32VT);
+ SDValue Not = DAG->getNOT(DL, Op0, Int32VT);
+
using namespace SDPatternMatch;
EXPECT_TRUE(sd_match(ZExt, m_UnaryOp(ISD::ZERO_EXTEND, m_Value())));
EXPECT_TRUE(sd_match(SExt, m_SExt(m_Value())));
EXPECT_TRUE(sd_match(Trunc, m_Trunc(m_Specific(Op1))));
+
+ EXPECT_TRUE(sd_match(Neg, m_Neg(m_Value())));
+ EXPECT_TRUE(sd_match(Not, m_Not(m_Value())));
----------------
arsenm wrote:
Maybe test some expect_false cases
https://github.com/llvm/llvm-project/pull/85365
More information about the llvm-commits
mailing list