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

via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 16 11:03:48 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- llvm/lib/Target/X86/X86ISelLowering.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 1f10178fa..4432db86b 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -50720,7 +50720,6 @@ static SDValue combineIntDivRem(SDNode *N, SelectionDAG &DAG,
   EVT VT = N->getValueType(0);
   SDLoc DL(N);
 
-  
   if (!Subtarget.hasSSE2())
     return SDValue();
 
@@ -50736,16 +50735,14 @@ static SDValue combineIntDivRem(SDNode *N, SelectionDAG &DAG,
   bool IsSigned = Opc == ISD::SDIV || Opc == ISD::SREM;
 
   // Scalar functions that do not use XMM registers must not get this combine.
-  if (!VT.isVector() &&
-      (Subtarget.useSoftFloat() ||
-       DAG.getMachineFunction().getFunction().hasFnAttribute(
-           Attribute::NoImplicitFloat)))
+  if (!VT.isVector() && (Subtarget.useSoftFloat() ||
+                         DAG.getMachineFunction().getFunction().hasFnAttribute(
+                             Attribute::NoImplicitFloat)))
     return SDValue();
 
   // If the result is only read back as scalar extracts, scalarization computes
   // just the demanded lanes.
-  if (VT.isVector() &&
-      all_of(N->users(), [](const SDNode *U) {
+  if (VT.isVector() && all_of(N->users(), [](const SDNode *U) {
         return U->getOpcode() == ISD::EXTRACT_VECTOR_ELT;
       }))
     return SDValue();
@@ -50795,11 +50792,11 @@ static SDValue combineIntDivRem(SDNode *N, SelectionDAG &DAG,
 
   // Nothing will split an illegal FP type after type legalization and the
   // strict SAE divide is 512-bit only. Scalar f32/f64 are always legal.
-  bool FPVTUsable = !VT.isVector() ||
-                     (IsStrict
-                          ? FPVT.getSizeInBits() <= 512
-                          : DCI.isBeforeLegalize() ||
-                                DAG.getTargetLoweringInfo().isTypeLegal(FPVT));
+  bool FPVTUsable =
+      !VT.isVector() ||
+      (IsStrict ? FPVT.getSizeInBits() <= 512
+                : DCI.isBeforeLegalize() ||
+                      DAG.getTargetLoweringInfo().isTypeLegal(FPVT));
 
   // Halve the divide while the integer halves stay legal.
   if (!FPVTUsable) {

``````````

</details>


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


More information about the llvm-commits mailing list