[all-commits] [llvm/llvm-project] aa47e5: [X86][Windows] Return `fp128` on the stack (#204887)

Folkert de Vries via All-commits all-commits at lists.llvm.org
Wed Jul 1 01:12:54 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aa47e59245e24edb6d0c7d5f91b3a1c5a7bb35f1
      https://github.com/llvm/llvm-project/commit/aa47e59245e24edb6d0c7d5f91b3a1c5a7bb35f1
  Author: Folkert de Vries <folkert at folkertdev.nl>
  Date:   2026-07-01 (Wed, 01 Jul 2026)

  Changed paths:
    M clang/lib/CodeGen/Targets/X86.cpp
    M clang/test/CodeGen/win-fp128.c
    M llvm/docs/ReleaseNotes.md
    M llvm/lib/Target/X86/X86CallingConv.td
    M llvm/lib/Target/X86/X86ISelLoweringCall.cpp
    M llvm/test/CodeGen/X86/fp128-libcalls-strict.ll
    M llvm/test/CodeGen/X86/fp128-libcalls.ll
    A llvm/test/CodeGen/X86/fp128-return-calling-conv.ll
    M llvm/test/CodeGen/X86/i128-fp128-abi.ll

  Log Message:
  -----------
  [X86][Windows] Return `fp128` on the stack (#204887)

Subsumes https://github.com/llvm/llvm-project/pull/194214

For x86-64 Windows targets, LLVM currently returns `fp128` in xmm0. This
does match `i128` (both Clang and GCC return `__int128` in xmm0) but
disagrees with GCC's behavior of returning `__float128` on the stack.

https://gcc.godbolt.org/z/xnWeGqcbW

Microsoft does not specify a `__float128` ABI so any decision is purely
an extension. The Windows x64 calling convention [1] does say that user-
defined types that do not fit in a register should be returned
indirectly, so the GCC behavior seems like a reasonable interpretation
of this rule.

Thus, change `fp128` to return on the stack for Windows targets. This is
done for both MinGW and MSVC targets; if official guidelines are ever
published, this can be revisited.

The change is made in LLVM (via sret demotion of f128), but also
explicitly in `clang`. Frontends should emit the `sret` explicitly, if
only for debug info, return value optimization, etc.

Relates to the pass ABI change in 5ee1c0b71485 ("[windows] Always pass
fp128 arguments indirectly").

[1]:
https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170#return-values



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list