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

via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 01:53:35 PDT 2026


================
@@ -50431,6 +50441,155 @@ 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())
+    return SDValue();
+
+  // Don't introduce a trapping FP divide under strict FP.
+  if (DAG.getMachineFunction().getFunction().hasFnAttribute(
+          Attribute::StrictFP))
----------------
Andarwinux wrote:

Yes, strictfp <=i32 should be supported in x86-specific path, otherwise it would be very unbalanced if strictfp i64 could be vectorized but strictfp <=i32 could not.



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


More information about the llvm-commits mailing list