[llvm] [CodeGen] Emit a more efficient magic number multiplication for exact udivs (PR #87161)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 12:38:40 PDT 2024


================
@@ -6141,6 +6138,68 @@ static SDValue BuildExactSDIV(const TargetLowering &TLI, SDNode *N,
   return DAG.getNode(ISD::MUL, dl, VT, Res, Factor);
 }
 
+/// Given an exact UDIV by a constant, create a multiplication
+/// with the multiplicative inverse of the constant.
----------------
arsenm wrote:

Is there a reference for what this is doing somewhere? 

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


More information about the llvm-commits mailing list