[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 00:11:52 PDT 2024
================
@@ -174,10 +174,18 @@ TEST_F(SelectionDAGPatternMatchTest, matchUnaryOp) {
SDValue SExt = DAG->getNode(ISD::SIGN_EXTEND, DL, Int64VT, Op0);
SDValue Trunc = DAG->getNode(ISD::TRUNCATE, DL, Int32VT, Op1);
+ SDValue Zero = DAG->getConstant(0, DL, Int32VT);
+ SDValue AllOnes = DAG->getConstant(APInt::getAllOnes(32), DL, Int32VT);
+ SDValue Neg = DAG->getNode(ISD::SUB, DL, Int32VT, Zero, Op0);
+ SDValue Not = DAG->getNode(ISD::XOR, DL, Int32VT, AllOnes, Op0);
----------------
arsenm wrote:
There is already a DAG->getNOT helper for this
https://github.com/llvm/llvm-project/pull/85365
More information about the llvm-commits
mailing list