[llvm] [SDAG] Add missing float type legalizations for FMODF (PR #128055)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 28 07:12:08 PST 2025


================
@@ -2616,6 +2624,18 @@ bool SelectionDAG::expandMultipleResultFPLibCall(
 
   auto [Call, CallChain] = TLI->LowerCallTo(CLI);
 
+  if (CallRetResNo && !Node->hasAnyUseOfValue(*CallRetResNo)) {
+    // This is needed for x87, which uses a floating-point stack. If (for
----------------
MacDue wrote:

> I was thinking X86ISD::PopX87Reg would just lower to the same COPY we currently generate for CopyFromReg; whether that actually lowers to a pop would be decided later.

This works quite well :+1: I've updated X86 call lowering to use an `X86ISD::POP_FROM_X87_REG` to handle these results -- and removed any hacks from the generic SDAG expansion. 

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


More information about the llvm-commits mailing list