Martin Storsjö 7679d02d66
[X86] Correctly call 16 byte atomic helpers on x86_64 Windows (#181356)
On x86_64 Windows, i128 values are returned in xmm0, and as arguments to
functions, they are passed indirectly (rather than in a GPR pair) - see
WinX86_64ABIInfo::classify in Clang [1].

When AtomicExpandPass generates a libcall, it normally generates one
with i128 arguments and return types. This type isn't lowered correctly
(it ends up passed or returned in a pair of GPRs).

To fix this issue, make AtomicExpandPass use the v2i64 type instead of
i128 here, just like Clang would do for an explicit function call; this
type ends up lowered correctly.

This fixes https://github.com/mstorsjo/llvm-mingw/issues/538 and
https://github.com/llvm/llvm-project/issues/136428.

[1]
https://github.com/llvm/llvm-project/blob/llvmorg-21.1.8/clang/lib/CodeGen/Targets/X86.cpp#L3390-L3408
2026-02-17 00:18:45 +02:00
..
2026-02-06 17:11:15 -08:00
2025-07-15 13:22:33 -04:00
2025-11-10 12:34:00 -08:00