[llvm] [X86] Lower vector integer division and remainder through float division (PR #205263)

Adam Scott via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 23:35:17 PDT 2026


================
@@ -50564,6 +50572,200 @@ static SDValue combineMulToPMADD52(SDNode *N, const SDLoc &DL,
   return SDValue();
 }
 
+// x86 has no vector integer divide instructions. Lower vector
+// UDIV/SDIV/UREM/SREM through float division instead of scalarizing into N
+// scalar hardware divides.
+static SDValue combineIntDivRem(SDNode *N, SelectionDAG &DAG,
+                                TargetLowering::DAGCombinerInfo &DCI,
+                                const X86Subtarget &Subtarget) {
+  EVT VT = N->getValueType(0);
+  SDLoc DL(N);
+
+  // Run before the legalizer expands the division.
+  if (!VT.isVector() || !Subtarget.hasSSE2() || !DCI.isBeforeLegalizeOps())
----------------
as4230 wrote:

DCI.isBeforeLegalizeOps does seem to be redundant here so I will cut it. 

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


More information about the llvm-commits mailing list