[llvm] [X86] Extend `combinei64TruncSrlAdd` to handle patterns with `or` and `xor` (PR #128435)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 26 19:33:04 PST 2025


=?utf-8?q?João?= Gouveia <jtalonegouveia at gmail.com>,
=?utf-8?q?João?= Gouveia <jtalonegouveia at gmail.com>,
=?utf-8?q?João?= Gouveia <jtalonegouveia at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/128435 at github.com>


================
@@ -53810,11 +53827,15 @@ static SDValue combineTruncatedArithmetic(SDNode *N, SelectionDAG &DAG,
   if (!Src.hasOneUse())
     return SDValue();
 
-  if (SDValue R = combinei64TruncSrlAdd(Src, VT, DAG, DL))
-    return R;
+  if (VT == MVT::i32 && SrcVT == MVT::i64 && SrcOpcode == ISD::SRL &&
+      Src.getOperand(0).getNumOperands() == 2 &&
+      isa<ConstantSDNode>(Src.getOperand(1)) &&
+      isa<ConstantSDNode>(Src.getOperand(0).getOperand(1))) {
+    if (SDValue R = combinei64TruncSrlBinop(Src, VT, DAG, DL))
----------------
phoebewang wrote:

Maybe `combinei64TruncSrlConstant`?

https://github.com/llvm/llvm-project/pull/128435


More information about the llvm-commits mailing list