[clang] [llvm] [X86][Windows] Return `fp128` on the stack (PR #204887)
Trevor Gross via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 19 16:17:35 PDT 2026
================
@@ -670,6 +670,20 @@ bool X86TargetLowering::CanLowerReturn(
CallingConv::ID CallConv, MachineFunction &MF, bool isVarArg,
const SmallVectorImpl<ISD::OutputArg> &Outs, LLVMContext &Context,
const Type *RetTy) const {
+ // Mingw64 GCC returns f128 via sret, which matches the documentation of the
+ // Windows x64 calling convention:
+ //
+ // https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170#return-values
+ //
+ // > Otherwise, the caller must allocate memory for the return value and pass
+ // a pointer to it as the first argument.
+ //
+ // Return false, which will perform sret demotion.
----------------
tgross35 wrote:
This could probably be rephrased to be clear that it is one reasonable interpretation of the CC, and that what we're picking also matches GCC. Since the spec also says:
> Nonscalar types including floats, doubles, and vector types such as __m128, __m128i, __m128d are returned in XMM0
which could easily be taken to mean f128 too.
https://github.com/llvm/llvm-project/pull/204887
More information about the cfe-commits
mailing list