[llvm] SelectionDAG: neg (and x, 1)  -->  SIGN_EXTEND_INREG x, i1 (PR #131239)
    Matthias Braun via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Mar 14 10:47:15 PDT 2025
    
    
  
================
@@ -3964,6 +3964,20 @@ SDValue DAGCombiner::visitSUB(SDNode *N) {
           isNullConstant(N1S.getOperand(0)))
         return DAG.getSplat(VT, DL, N1S.getOperand(1));
     }
+
+    // sub 0, (and x, 1)  -->  SIGN_EXTEND_INREG x, i1
+    if (N1.getOpcode() == ISD::AND && N1.hasOneUse() &&
+        isOneOrOneSplat(N1->getOperand(1))) {
----------------
MatzeB wrote:
Submitted one as #131367
https://github.com/llvm/llvm-project/pull/131239
    
    
More information about the llvm-commits
mailing list