[llvm] [AMDGPU][SDAG] Try folding "lshr i64 + mad" to "mad_u64_u32" (PR #119218)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 5 23:03:44 PST 2025


================
@@ -13915,6 +13945,14 @@ SDValue SITargetLowering::tryFoldToMad64_32(SDNode *N,
   SDValue MulRHS = LHS.getOperand(1);
   SDValue AddRHS = RHS;
 
+  if (isa<ConstantSDNode>(MulLHS) || isa<ConstantSDNode>(MulRHS)) {
+    if (MulRHS.getOpcode() == ISD::SRL)
+      std::swap(MulLHS, MulRHS);
----------------
arsenm wrote:

Sink all the logic into the implementation 

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


More information about the llvm-commits mailing list