[llvm] [X86] Lower scalar integer div/rem to FP division (PR #216589)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 10:33:03 PDT 2026


================
@@ -50710,28 +50785,34 @@ static SDValue combineIntDivRem(SDNode *N, SelectionDAG &DAG,
   MVT FPSclVT = MVT::f64;
   if (EltBits <= 16 || BothFitFP(APFloat::IEEEsingle()))
     FPSclVT = MVT::f32;
-  EVT FPVT = VT.changeVectorElementType(*DAG.getContext(), FPSclVT);
+  EVT FPVT = VT.isVector()
+                 ? VT.changeVectorElementType(*DAG.getContext(), FPSclVT)
+                 : EVT(FPSclVT);
 
   bool IsStrict = DAG.getMachineFunction().getFunction().hasFnAttribute(
       Attribute::StrictFP);
   if (IsStrict) {
+    // Scalar strictfp support is not implemented yet.
+    if (!VT.isVector())
+      return SDValue();
     // The SAE forms are 512-bit only. Inputs widen into a zmm below, which
     // requires 512-bit types to be legal and a power of 2 lane count.
     if (!Subtarget.useAVX512Regs() || !isPowerOf2_32(VT.getVectorNumElements()))
       return SDValue();
-  } else if (!IsSigned && VT.getScalarSizeInBits() == 32 &&
+  } else if (VT.isVector() && !IsSigned && VT.getScalarSizeInBits() == 32 &&
----------------
Andarwinux wrote:

Yes.

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


More information about the llvm-commits mailing list