[llvm] [AMDGPU][SDAG] Try folding "lshr i64 + mad" to "mad_[iu]64_[iu]32" (PR #119218)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 07:11:00 PST 2024


================
@@ -13857,6 +13857,52 @@ static SDValue getMad64_32(SelectionDAG &DAG, const SDLoc &SL, EVT VT,
   return DAG.getNode(ISD::TRUNCATE, SL, VT, Mad);
 }
 
+// Fold
+//     y = lshr i64 x, 32
+//     res = add (mul i64 y, Constant), x   where "Constant" is a 32 bit
+//     negative value
----------------
jayfoad wrote:

"32 bit negative value" does not describe it properly. It's a 64-bit constant where the high 32 bits are all-ones. Or using the notation below you could say `Constant.hi == -1`

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


More information about the llvm-commits mailing list