From f6c7baea098aac03687f5041fc860ca95f070e4e Mon Sep 17 00:00:00 2001 From: Seth Brenith Date: Mon, 4 Dec 2023 11:53:36 -0800 Subject: [Win/x64] Update preserve_most to treat XMM registers like C (#73866) As [scottmcm described](https://discourse.llvm.org/t/conv-c-and-conv-preservemost-mix-badly-on-windows-x64/73054), the `preserve_most` calling convention, as currently implemented, is a bad fit for Windows on x64. The intent of `preserve_most` is "to make the code in the caller as unintrusive as possible", but `preserve_most` causes the caller to spill and restore ten SIMD registers. It would be preferable to make `preserve_most` treat the XMM registers however the C calling convention does on the target operating system. This is a breaking change, but the documentation indicates that `preserve_most` is still experimental, so I believe that ABI compatibility is not yet a requirement. --- llvm/docs/LangRef.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'llvm/docs/LangRef.rst') diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index af064d7..4bd19a3 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -365,8 +365,9 @@ added in the future: - On X86-64 the callee preserves all general purpose registers, except for R11 and return registers, if any. R11 can be used as a scratch register. - Floating-point registers (XMMs/YMMs) are not preserved and need to be - saved by the caller. + The treatment of floating-point registers (XMMs/YMMs) matches the OS's C + calling convention: on most platforms, they are not preserved and need to + be saved by the caller, but on Windows, xmm6-xmm15 are preserved. - On AArch64 the callee preserve all general purpose registers, except X0-X8 and X16-X18. -- cgit v1.1