[clang] [llvm] [X86][Windows] Return `fp128` on the stack (PR #204887)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 19 15:09:25 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-x86
@llvm/pr-subscribers-clang-codegen
Author: Folkert de Vries (folkertdev)
<details>
<summary>Changes</summary>
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.
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
---
Patch is 63.26 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/204887.diff
6 Files Affected:
- (modified) clang/lib/CodeGen/Targets/X86.cpp (+8-6)
- (modified) clang/test/CodeGen/win-fp128.c (+2-2)
- (modified) llvm/lib/Target/X86/X86ISelLoweringCall.cpp (+14)
- (modified) llvm/test/CodeGen/X86/fp128-libcalls-strict.ll (+341-110)
- (modified) llvm/test/CodeGen/X86/fp128-libcalls.ll (+179-72)
- (modified) llvm/test/CodeGen/X86/i128-fp128-abi.ll (+80-52)
``````````diff
diff --git a/clang/lib/CodeGen/Targets/X86.cpp b/clang/lib/CodeGen/Targets/X86.cpp
index dbe4d656aabc5..77c912b021604 100644
--- a/clang/lib/CodeGen/Targets/X86.cpp
+++ b/clang/lib/CodeGen/Targets/X86.cpp
@@ -3437,8 +3437,6 @@ ABIArgInfo WinX86_64ABIInfo::classify(QualType Ty, unsigned &FreeSSERegs,
case BuiltinType::Int128:
case BuiltinType::UInt128:
case BuiltinType::Float128:
- // 128-bit float and integer types share the same ABI.
-
// If it's a parameter type, the normal ABI rule is that arguments larger
// than 8 bytes are passed indirectly. GCC follows it. We follow it too,
// even though it isn't particularly efficient.
@@ -3449,10 +3447,14 @@ ABIArgInfo WinX86_64ABIInfo::classify(QualType Ty, unsigned &FreeSSERegs,
// Mingw64 GCC returns i128 in XMM0. Coerce to v2i64 to handle that.
// Clang matches them for compatibility.
- // NOTE: GCC actually returns f128 indirectly but will hopefully change.
- // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054#c8.
- return ABIArgInfo::getDirect(llvm::FixedVectorType::get(
- llvm::Type::getInt64Ty(getVMContext()), 2));
+ if (BT->getKind() == BuiltinType::Int128 ||
+ BT->getKind() == BuiltinType::UInt128)
+ return ABIArgInfo::getDirect(llvm::FixedVectorType::get(
+ llvm::Type::getInt64Ty(getVMContext()), 2));
+
+ // Mingw64 GCC returns f128 via sret. Clang matches that for
+ // compatibility.
+ break;
default:
break;
diff --git a/clang/test/CodeGen/win-fp128.c b/clang/test/CodeGen/win-fp128.c
index 58e203d4fc8ed..dc144f899fa4f 100644
--- a/clang/test/CodeGen/win-fp128.c
+++ b/clang/test/CodeGen/win-fp128.c
@@ -3,10 +3,10 @@
// __float128 is unsupported on MSVC
__float128 fp128_ret(void) { return 0; }
-// CHECK-GNU64: define dso_local <2 x i64> @fp128_ret()
+// CHECK-GNU64: define dso_local fp128 @fp128_ret()
__float128 fp128_args(__float128 a, __float128 b) { return a * b; }
-// CHECK-GNU64: define dso_local <2 x i64> @fp128_args(ptr noundef dead_on_return %0, ptr noundef dead_on_return %1)
+// CHECK-GNU64: define dso_local fp128 @fp128_args(ptr noundef dead_on_return %0, ptr noundef dead_on_return %1)
void fp128_vararg(int a, ...) {
// CHECK-GNU64-LABEL: define dso_local void @fp128_vararg
diff --git a/llvm/lib/Target/X86/X86ISelLoweringCall.cpp b/llvm/lib/Target/X86/X86ISelLoweringCall.cpp
index 7c068115df481..bce581ad7a48b 100644
--- a/llvm/lib/Target/X86/X86ISelLoweringCall.cpp
+++ b/llvm/lib/Target/X86/X86ISelLoweringCall.cpp
@@ -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.
+ if (Subtarget.isCallingConvWin64(CallConv) &&
+ llvm::any_of(
+ Outs, [](const ISD::OutputArg &Out) { return Out.VT == MVT::f128; }))
+ return false;
+
SmallVector<CCValAssign, 16> RVLocs;
CCState CCInfo(CallConv, isVarArg, MF, RVLocs, Context);
return CCInfo.CheckReturn(Outs, RetCC_X86);
diff --git a/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll b/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll
index ad2d690fd7ed0..dfff88d30bcd4 100644
--- a/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll
+++ b/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll
@@ -79,15 +79,22 @@ define fp128 @add(fp128 %x, fp128 %y) nounwind strictfp {
;
; WIN-LABEL: add:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $72, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
-; WIN-NEXT: movaps (%rdx), %xmm1
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $80, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
+; WIN-NEXT: movaps (%r8), %xmm1
; WIN-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %r8
; WIN-NEXT: callq __addtf3
-; WIN-NEXT: addq $72, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $80, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: add:
@@ -201,15 +208,22 @@ define fp128 @sub(fp128 %x, fp128 %y) nounwind strictfp {
;
; WIN-LABEL: sub:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $72, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
-; WIN-NEXT: movaps (%rdx), %xmm1
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $80, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
+; WIN-NEXT: movaps (%r8), %xmm1
; WIN-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %r8
; WIN-NEXT: callq __subtf3
-; WIN-NEXT: addq $72, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $80, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: sub:
@@ -323,15 +337,22 @@ define fp128 @mul(fp128 %x, fp128 %y) nounwind strictfp {
;
; WIN-LABEL: mul:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $72, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
-; WIN-NEXT: movaps (%rdx), %xmm1
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $80, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
+; WIN-NEXT: movaps (%r8), %xmm1
; WIN-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %r8
; WIN-NEXT: callq __multf3
-; WIN-NEXT: addq $72, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $80, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: mul:
@@ -445,15 +466,22 @@ define fp128 @div(fp128 %x, fp128 %y) nounwind strictfp {
;
; WIN-LABEL: div:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $72, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
-; WIN-NEXT: movaps (%rdx), %xmm1
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $80, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
+; WIN-NEXT: movaps (%r8), %xmm1
; WIN-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %r8
; WIN-NEXT: callq __divtf3
-; WIN-NEXT: addq $72, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $80, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: div:
@@ -568,18 +596,25 @@ define fp128 @fma(fp128 %x, fp128 %y, fp128 %z) nounwind strictfp {
;
; WIN-LABEL: fma:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $88, %rsp
-; WIN-NEXT: movaps (%r8), %xmm0
-; WIN-NEXT: movaps (%rcx), %xmm1
-; WIN-NEXT: movaps (%rdx), %xmm2
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $96, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%r9), %xmm0
+; WIN-NEXT: movaps (%rdx), %xmm1
+; WIN-NEXT: movaps (%r8), %xmm2
; WIN-NEXT: movaps %xmm2, {{[0-9]+}}(%rsp)
; WIN-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %r8
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %r9
; WIN-NEXT: callq fmal
-; WIN-NEXT: addq $88, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $96, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: fma:
@@ -694,15 +729,22 @@ define fp128 @frem(fp128 %x, fp128 %y) nounwind strictfp {
;
; WIN-LABEL: frem:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $72, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
-; WIN-NEXT: movaps (%rdx), %xmm1
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $80, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
+; WIN-NEXT: movaps (%r8), %xmm1
; WIN-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %r8
; WIN-NEXT: callq fmodl
-; WIN-NEXT: addq $72, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $80, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: frem:
@@ -797,12 +839,19 @@ define fp128 @ceil(fp128 %x) nounwind strictfp {
;
; WIN-LABEL: ceil:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $56, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $64, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
; WIN-NEXT: callq ceill
-; WIN-NEXT: addq $56, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $64, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: ceil:
@@ -887,12 +936,19 @@ define fp128 @acos(fp128 %x) nounwind strictfp {
;
; WIN-LABEL: acos:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $56, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $64, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
; WIN-NEXT: callq acosl
-; WIN-NEXT: addq $56, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $64, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: acos:
@@ -977,12 +1033,19 @@ define fp128 @cos(fp128 %x) nounwind strictfp {
;
; WIN-LABEL: cos:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $56, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $64, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
; WIN-NEXT: callq cosl
-; WIN-NEXT: addq $56, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $64, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: cos:
@@ -1067,12 +1130,19 @@ define fp128 @cosh(fp128 %x) nounwind strictfp {
;
; WIN-LABEL: cosh:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $56, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $64, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
; WIN-NEXT: callq coshl
-; WIN-NEXT: addq $56, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $64, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: cosh:
@@ -1157,12 +1227,19 @@ define fp128 @exp(fp128 %x) nounwind strictfp {
;
; WIN-LABEL: exp:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $56, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $64, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
; WIN-NEXT: callq expl
-; WIN-NEXT: addq $56, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $64, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: exp:
@@ -1247,12 +1324,19 @@ define fp128 @exp2(fp128 %x) nounwind strictfp {
;
; WIN-LABEL: exp2:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $56, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $64, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
; WIN-NEXT: callq exp2l
-; WIN-NEXT: addq $56, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $64, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: exp2:
@@ -1337,12 +1421,19 @@ define fp128 @floor(fp128 %x) nounwind strictfp {
;
; WIN-LABEL: floor:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $56, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $64, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
; WIN-NEXT: callq floorl
-; WIN-NEXT: addq $56, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $64, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: floor:
@@ -1427,12 +1518,19 @@ define fp128 @log(fp128 %x) nounwind strictfp {
;
; WIN-LABEL: log:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $56, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $64, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
; WIN-NEXT: callq logl
-; WIN-NEXT: addq $56, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $64, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: log:
@@ -1517,12 +1615,19 @@ define fp128 @log10(fp128 %x) nounwind strictfp {
;
; WIN-LABEL: log10:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $56, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $64, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
; WIN-NEXT: callq log10l
-; WIN-NEXT: addq $56, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $64, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: log10:
@@ -1607,12 +1712,19 @@ define fp128 @log2(fp128 %x) nounwind strictfp {
;
; WIN-LABEL: log2:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $56, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $64, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
; WIN-NEXT: callq log2l
-; WIN-NEXT: addq $56, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $64, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: log2:
@@ -1709,15 +1821,22 @@ define fp128 @maxnum(fp128 %x, fp128 %y) nounwind strictfp {
;
; WIN-LABEL: maxnum:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $72, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
-; WIN-NEXT: movaps (%rdx), %xmm1
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $80, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
+; WIN-NEXT: movaps (%r8), %xmm1
; WIN-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %r8
; WIN-NEXT: callq fmaxl
-; WIN-NEXT: addq $72, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $80, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: maxnum:
@@ -1824,15 +1943,22 @@ define fp128 @minnum(fp128 %x, fp128 %y) nounwind strictfp {
;
; WIN-LABEL: minnum:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $72, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
-; WIN-NEXT: movaps (%rdx), %xmm1
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $80, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
+; WIN-NEXT: movaps (%r8), %xmm1
; WIN-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %r8
; WIN-NEXT: callq fminl
-; WIN-NEXT: addq $72, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $80, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: minnum:
@@ -1927,12 +2053,19 @@ define fp128 @nearbyint(fp128 %x) nounwind strictfp {
;
; WIN-LABEL: nearbyint:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $56, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $64, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
; WIN-NEXT: callq nearbyintl
-; WIN-NEXT: addq $56, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $64, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: nearbyint:
@@ -2029,15 +2162,22 @@ define fp128 @pow(fp128 %x, fp128 %y) nounwind strictfp {
;
; WIN-LABEL: pow:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $72, %rsp
-; WIN-NEXT: movaps (%rcx), %xmm0
-; WIN-NEXT: movaps (%rdx), %xmm1
+; WIN-NEXT: pushq %rsi
+; WIN-NEXT: subq $80, %rsp
+; WIN-NEXT: movq %rcx, %rsi
+; WIN-NEXT: movaps (%rdx), %xmm0
+; WIN-NEXT: movaps (%r8), %xmm1
; WIN-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
; WIN-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx
+; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %r8
; WIN-NEXT: callq powl
-; WIN-NEXT: addq $72, %rsp
+; WIN-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
+; WIN-NEXT: movaps %xmm0, (%rsi)
+; WIN-NEXT: movq %rsi, %rax
+; WIN-NEXT: addq $80, %rsp
+; WIN-NEXT: popq %rsi
; WIN-NEXT: retq
;
; WIN-X86-LABEL: pow:
@@ -2143,12 +2283,19 @@ define fp128 @powi(fp128 %x, i32 %y) nounwind strictfp {
;
; WIN-LABEL: powi:
; WIN: # %bb.0: # %entry
-; WIN-NEXT: subq $56, %rsp
-; WIN-NEXT: ...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/204887
More information about the cfe-commits
mailing list