Skip to content

[X86][windows] Return fp128 on the stack#194214

Closed
tgross35 wants to merge 1 commit into
llvm:mainfrom
tgross35:win-f128-abi
Closed

[X86][windows] Return fp128 on the stack#194214
tgross35 wants to merge 1 commit into
llvm:mainfrom
tgross35:win-f128-abi

Conversation

@tgross35

Copy link
Copy Markdown
Contributor

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.

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 5ee1c0b ("[windows] Always pass fp128 arguments indirectly").

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.

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 5ee1c0b ("[windows] Always pass
fp128 arguments indirectly").

[1]: https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170#return-values
@@ -130,54 +130,54 @@ def CC_#NAME : CallingConv<[

// __mmask64 (v64i1) --> GPR64 (for x64) or 2 x GPR32 (for IA32)
CCIfType<[v64i1], CCPromoteToType<i64>>,
CCIfSubtarget<"is64Bit()", CCIfType<[i64],
CCIfSubtarget<"is64Bit()", CCIfType<[i64],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some trailing whitespace in this file that I unintentionally trimmed, but I think that's fine. If you'd prefer to me to split it out though, I can do that too.

@Andarwinux

Copy link
Copy Markdown
Member

Since ABI doesn’t specify this, why choose the less efficient approach? Why can’t make gcc match clang’s behavior?

@tgross35

Copy link
Copy Markdown
Contributor Author

@rnk @phoebewang I'd appreciate a review once ready since you handled #128848 and #115052, but I need some help here first. This is going to hit the assertion at

assert(VA.isRegLoc() && "Can only return in registers!");
. What is the correct way to turn a type into a sret? Nothing stood out to me in existing tablegen files.

@github-actions

Copy link
Copy Markdown

🐧 Linux x64 Test Results

  • 173267 tests passed
  • 3254 tests skipped
  • 3 tests failed

Failed Tests

(click on a test name to see its output)

LLVM

LLVM.CodeGen/X86/fp128-libcalls-strict.ll
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll -O2 -mtriple=x86_64-linux-android      -enable-legalize-types-checking      | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll --check-prefix=ANDROID
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -O2 -mtriple=x86_64-linux-android -enable-legalize-types-checking
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll --check-prefix=ANDROID
# note: command had no output on stdout or stderr
# RUN: at line 5
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll -O2 -mtriple=x86_64-linux-gnu      -enable-legalize-types-checking      | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll --check-prefix=GNU
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -O2 -mtriple=x86_64-linux-gnu -enable-legalize-types-checking
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll --check-prefix=GNU
# note: command had no output on stdout or stderr
# RUN: at line 8
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll -O2 -mtriple=i686-linux-gnu -mattr=+sse2      -enable-legalize-types-checking      | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll --check-prefix=X86
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -O2 -mtriple=i686-linux-gnu -mattr=+sse2 -enable-legalize-types-checking
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll --check-prefix=X86
# note: command had no output on stdout or stderr
# RUN: at line 11
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll -O2 -mtriple=x86_64-pc-windows-msvc      -enable-legalize-types-checking      | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll --check-prefix=WIN
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -O2 -mtriple=x86_64-pc-windows-msvc -enable-legalize-types-checking
# .---command stderr------------
# | llc: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Target/X86/X86ISelLoweringCall.cpp:773: virtual SDValue llvm::X86TargetLowering::LowerReturn(SDValue, CallingConv::ID, bool, const SmallVectorImpl<ISD::OutputArg> &, const SmallVectorImpl<SDValue> &, const SDLoc &, SelectionDAG &) const: Assertion `VA.isRegLoc() && "Can only return in registers!"' failed.
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
# | Stack dump:
# | 0.	Program arguments: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -O2 -mtriple=x86_64-pc-windows-msvc -enable-legalize-types-checking
# | 1.	Running pass 'Function Pass Manager' on module '<stdin>'.
# | 2.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@add'
# |  #0 0x0000000008680de8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:880:13
# |  #1 0x000000000867dd51 llvm::sys::RunSignalHandlers() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Signals.cpp:109:18
# |  #2 0x0000000008681c01 SignalHandler(int, siginfo_t*, void*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:448:38
# |  #3 0x00007edd89818330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
# |  #4 0x00007edd89871b2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
# |  #5 0x00007edd8981827e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
# |  #6 0x00007edd897fb8ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
# |  #7 0x00007edd897fb81b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
# |  #8 0x00007edd8980e517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
# |  #9 0x00000000068f770a llvm::X86TargetLowering::LowerReturn(llvm::SDValue, unsigned int, bool, llvm::SmallVectorImpl<llvm::ISD::OutputArg> const&, llvm::SmallVectorImpl<llvm::SDValue> const&, llvm::SDLoc const&, llvm::SelectionDAG&) const /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Target/X86/X86ISelLoweringCall.cpp:796:5
# | #10 0x000000000836b6e7 llvm::SelectionDAGBuilder::visitRet(llvm::ReturnInst const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:2345:39
# | #11 0x0000000008369716 getValueID /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/IR/Value.h:544:12
# | #12 0x0000000008369716 getOpcode /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/IR/Instruction.h:343:39
# | #13 0x0000000008369716 isTerminator /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/IR/Instruction.h:346:51
# | #14 0x0000000008369716 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:1394:10
# | #15 0x0000000008447755 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void, true, llvm::BasicBlock>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void, true, llvm::BasicBlock>, false, true>, bool&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:0:12
# | #16 0x0000000008446dd3 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1692:8
# | #17 0x0000000008443ec1 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:660:22
# | #18 0x0000000008441590 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:401:20
# | #19 0x000000000731fa03 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:0:10
# | #20 0x000000000789fc58 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:0:27
# | #21 0x00000000078a7702 llvm::FPPassManager::runOnModule(llvm::Module&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1444:13
# | #22 0x00000000078a06cb runOnModule /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1513:27
# | #23 0x00000000078a06cb llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:531:44
# | #24 0x0000000005000e7b compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/tools/llc/llc.cpp:882:17
# | #25 0x0000000004ffddc3 main /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/tools/llc/llc.cpp:460:13
# | #26 0x00007edd897fd1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
# | #27 0x00007edd897fd28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
# | #28 0x0000000004ff98e5 _start (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc+0x4ff98e5)
# `-----------------------------
# error: command failed with exit status: -6
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll --check-prefix=WIN
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls-strict.ll --check-prefix=WIN
# `-----------------------------
# error: command failed with exit status: 2

--

LLVM.CodeGen/X86/fp128-libcalls.ll
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls.ll -O2 -mtriple=x86_64-linux-android      -enable-legalize-types-checking | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls.ll --check-prefix=ANDROID
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -O2 -mtriple=x86_64-linux-android -enable-legalize-types-checking
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls.ll --check-prefix=ANDROID
# note: command had no output on stdout or stderr
# RUN: at line 4
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls.ll -O2 -mtriple=x86_64-linux-gnu      -enable-legalize-types-checking | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls.ll --check-prefix=GNU
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -O2 -mtriple=x86_64-linux-gnu -enable-legalize-types-checking
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls.ll --check-prefix=GNU
# note: command had no output on stdout or stderr
# RUN: at line 6
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls.ll -O2 -mtriple=i686-linux-gnu -mattr=sse2      -enable-legalize-types-checking | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls.ll --check-prefix=X86
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -O2 -mtriple=i686-linux-gnu -mattr=sse2 -enable-legalize-types-checking
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls.ll --check-prefix=X86
# note: command had no output on stdout or stderr
# RUN: at line 8
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls.ll -O2 -mtriple=x86_64-pc-windows-msvc      -enable-legalize-types-checking | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls.ll --check-prefix=WIN
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -O2 -mtriple=x86_64-pc-windows-msvc -enable-legalize-types-checking
# .---command stderr------------
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
# | Stack dump:
# | 0.	Program arguments: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -O2 -mtriple=x86_64-pc-windows-msvc -enable-legalize-types-checking
# | 1.	Running pass 'Function Pass Manager' on module '<stdin>'.
# | 2.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@Test128Add'
# |  #0 0x0000000008680de8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:880:13
# |  #1 0x000000000867dd51 llvm::sys::RunSignalHandlers() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Signals.cpp:109:18
# |  #2 0x0000000008681c01 SignalHandler(int, siginfo_t*, void*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:448:38
# |  #3 0x00007fb90440e330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
# |  #4 0x00007fb904467b2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
# |  #5 0x00007fb90440e27e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
# |  #6 0x00007fb9043f18ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
# |  #7 0x00000000068f8a03 operator[] /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/SmallVector.h:300:5
# |  #8 0x00000000068f8a03 llvm::X86TargetLowering::LowerCallResult(llvm::SDValue, llvm::SDValue, unsigned int, bool, llvm::SmallVectorImpl<llvm::ISD::InputArg> const&, llvm::SDLoc const&, llvm::SelectionDAG&, llvm::SmallVectorImpl<llvm::SDValue>&, unsigned int*) const /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Target/X86/X86ISelLoweringCall.cpp:0:0
# |  #9 0x000000000690156d llvm::X86TargetLowering::LowerCall(llvm::TargetLowering::CallLoweringInfo&, llvm::SmallVectorImpl<llvm::SDValue>&) const /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Target/X86/X86ISelLoweringCall.cpp:2759:10
# | #10 0x0000000008386d48 llvm::TargetLowering::LowerCallTo(llvm::TargetLowering::CallLoweringInfo&) const /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:11530:13
# | #11 0x0000000008333a42 (anonymous namespace)::SelectionDAGLegalize::ExpandLibCall(llvm::RTLIB::Libcall, llvm::SDNode*, std::vector<llvm::TargetLoweringBase::ArgListEntry, std::allocator<llvm::TargetLoweringBase::ArgListEntry>>&&, bool, llvm::EVT) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:2194:8
# | #12 0x0000000008332487 ~_Vector_base /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:369:24
# | #13 0x0000000008332487 ~vector /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:738:7
# | #14 0x0000000008332487 (anonymous namespace)::SelectionDAGLegalize::ExpandLibCall(llvm::RTLIB::Libcall, llvm::SDNode*, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:2218:1
# | #15 0x0000000008331cbd (anonymous namespace)::SelectionDAGLegalize::ExpandFPLibCall(llvm::SDNode*, llvm::RTLIB::Libcall, llvm::SmallVectorImpl<llvm::SDValue>&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:2240:19
# | #16 0x0000000008316d67 (anonymous namespace)::SelectionDAGLegalize::ConvertNodeToLibcall(llvm::SDNode*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:0:0
# | #17 0x000000000830b611 (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1426:1
# | #18 0x000000000830a744 use_empty /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:781:43
# | #19 0x000000000830a744 llvm::SelectionDAG::Legalize() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:6545:16
# | #20 0x0000000008448bae ~TimeRegion /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/Support/Timer.h:167:9
# | #21 0x0000000008448bae llvm::SelectionDAGISel::CodeGenAndEmitDAG() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1123:3
# | #22 0x0000000008446dd3 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1692:8
# | #23 0x0000000008443ec1 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:660:22
# | #24 0x0000000008441590 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:401:20
# | #25 0x000000000731fa03 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:0:10
# | #26 0x000000000789fc58 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:0:27
# | #27 0x00000000078a7702 llvm::FPPassManager::runOnModule(llvm::Module&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1444:13
# | #28 0x00000000078a06cb runOnModule /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1513:27
# | #29 0x00000000078a06cb llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:531:44
# | #30 0x0000000005000e7b compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/tools/llc/llc.cpp:882:17
# | #31 0x0000000004ffddc3 main /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/tools/llc/llc.cpp:460:13
# | #32 0x00007fb9043f31ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
# | #33 0x00007fb9043f328b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
# | #34 0x0000000004ff98e5 _start (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc+0x4ff98e5)
# `-----------------------------
# error: command failed with exit status: -6
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls.ll --check-prefix=WIN
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/fp128-libcalls.ll --check-prefix=WIN
# `-----------------------------
# error: command failed with exit status: 2

--

LLVM.CodeGen/X86/i128-fp128-abi.ll
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 5
sed 's/PrimTy/fp128/g' /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/i128-fp128-abi.ll | sed 's/Prim0/0xL0/g' | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=x86_64-unknown-linux-gnu -verify-machineinstrs | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/i128-fp128-abi.ll --check-prefix=CHECK-X64-F128
# executed command: sed s/PrimTy/fp128/g /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/i128-fp128-abi.ll
# note: command had no output on stdout or stderr
# executed command: sed s/Prim0/0xL0/g
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=x86_64-unknown-linux-gnu -verify-machineinstrs
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/i128-fp128-abi.ll --check-prefix=CHECK-X64-F128
# note: command had no output on stdout or stderr
# RUN: at line 6
sed 's/PrimTy/i128/g'  /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/i128-fp128-abi.ll | sed 's/Prim0/0/g'    | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=x86_64-unknown-linux-gnu -verify-machineinstrs | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/i128-fp128-abi.ll --check-prefix=CHECK-X64-I128
# executed command: sed s/PrimTy/i128/g /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/i128-fp128-abi.ll
# note: command had no output on stdout or stderr
# executed command: sed s/Prim0/0/g
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=x86_64-unknown-linux-gnu -verify-machineinstrs
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/i128-fp128-abi.ll --check-prefix=CHECK-X64-I128
# note: command had no output on stdout or stderr
# RUN: at line 7
sed 's/PrimTy/fp128/g' /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/i128-fp128-abi.ll | sed 's/Prim0/0xL0/g' | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=x86_64-pc-windows-msvc -verify-machineinstrs   | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/i128-fp128-abi.ll --check-prefix=CHECK-MSVC64-F128
# executed command: sed s/PrimTy/fp128/g /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/i128-fp128-abi.ll
# note: command had no output on stdout or stderr
# executed command: sed s/Prim0/0xL0/g
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=x86_64-pc-windows-msvc -verify-machineinstrs
# .---command stderr------------
# | llc: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Target/X86/X86ISelLoweringCall.cpp:773: virtual SDValue llvm::X86TargetLowering::LowerReturn(SDValue, CallingConv::ID, bool, const SmallVectorImpl<ISD::OutputArg> &, const SmallVectorImpl<SDValue> &, const SDLoc &, SelectionDAG &) const: Assertion `VA.isRegLoc() && "Can only return in registers!"' failed.
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
# | Stack dump:
# | 0.	Program arguments: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mtriple=x86_64-pc-windows-msvc -verify-machineinstrs
# | 1.	Running pass 'Function Pass Manager' on module '<stdin>'.
# | 2.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@return'
# |  #0 0x0000000008680de8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:880:13
# |  #1 0x000000000867dd51 llvm::sys::RunSignalHandlers() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Signals.cpp:109:18
# |  #2 0x0000000008681c01 SignalHandler(int, siginfo_t*, void*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:448:38
# |  #3 0x0000799b65ad4330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
# |  #4 0x0000799b65b2db2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
# |  #5 0x0000799b65ad427e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
# |  #6 0x0000799b65ab78ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
# |  #7 0x0000799b65ab781b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
# |  #8 0x0000799b65aca517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
# |  #9 0x00000000068f770a llvm::X86TargetLowering::LowerReturn(llvm::SDValue, unsigned int, bool, llvm::SmallVectorImpl<llvm::ISD::OutputArg> const&, llvm::SmallVectorImpl<llvm::SDValue> const&, llvm::SDLoc const&, llvm::SelectionDAG&) const /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Target/X86/X86ISelLoweringCall.cpp:796:5
# | #10 0x000000000836b6e7 llvm::SelectionDAGBuilder::visitRet(llvm::ReturnInst const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:2345:39
# | #11 0x0000000008369716 getValueID /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/IR/Value.h:544:12
# | #12 0x0000000008369716 getOpcode /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/IR/Instruction.h:343:39
# | #13 0x0000000008369716 isTerminator /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/IR/Instruction.h:346:51
# | #14 0x0000000008369716 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:1394:10
# | #15 0x0000000008447755 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void, true, llvm::BasicBlock>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void, true, llvm::BasicBlock>, false, true>, bool&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:0:12
# | #16 0x0000000008446dd3 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1692:8
# | #17 0x0000000008443ec1 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:660:22
# | #18 0x0000000008441590 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:401:20
# | #19 0x000000000731fa03 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:0:10
# | #20 0x000000000789fc58 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:0:27
# | #21 0x00000000078a7702 llvm::FPPassManager::runOnModule(llvm::Module&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1444:13
# | #22 0x00000000078a06cb runOnModule /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1513:27
# | #23 0x00000000078a06cb llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:531:44
# | #24 0x0000000005000e7b compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/tools/llc/llc.cpp:882:17
# | #25 0x0000000004ffddc3 main /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/tools/llc/llc.cpp:460:13
# | #26 0x0000799b65ab91ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
# | #27 0x0000799b65ab928b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
# | #28 0x0000000004ff98e5 _start (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc+0x4ff98e5)
# `-----------------------------
# error: command failed with exit status: -6
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/i128-fp128-abi.ll --check-prefix=CHECK-MSVC64-F128
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/X86/i128-fp128-abi.ll --check-prefix=CHECK-MSVC64-F128
# `-----------------------------
# error: command failed with exit status: 2

--

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the infrastructure label.

@github-actions

Copy link
Copy Markdown

🪟 Windows x64 Test Results

  • 133907 tests passed
  • 3162 tests skipped
  • 3 tests failed

Failed Tests

(click on a test name to see its output)

LLVM

LLVM.CodeGen/X86/fp128-libcalls-strict.ll
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\llc.exe < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls-strict.ll -O2 -mtriple=x86_64-linux-android      -enable-legalize-types-checking      | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls-strict.ll --check-prefix=ANDROID
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -O2 -mtriple=x86_64-linux-android -enable-legalize-types-checking
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls-strict.ll' --check-prefix=ANDROID
# note: command had no output on stdout or stderr
# RUN: at line 5
c:\_work\llvm-project\llvm-project\build\bin\llc.exe < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls-strict.ll -O2 -mtriple=x86_64-linux-gnu      -enable-legalize-types-checking      | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls-strict.ll --check-prefix=GNU
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -O2 -mtriple=x86_64-linux-gnu -enable-legalize-types-checking
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls-strict.ll' --check-prefix=GNU
# note: command had no output on stdout or stderr
# RUN: at line 8
c:\_work\llvm-project\llvm-project\build\bin\llc.exe < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls-strict.ll -O2 -mtriple=i686-linux-gnu -mattr=+sse2      -enable-legalize-types-checking      | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls-strict.ll --check-prefix=X86
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -O2 -mtriple=i686-linux-gnu -mattr=+sse2 -enable-legalize-types-checking
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls-strict.ll' --check-prefix=X86
# note: command had no output on stdout or stderr
# RUN: at line 11
c:\_work\llvm-project\llvm-project\build\bin\llc.exe < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls-strict.ll -O2 -mtriple=x86_64-pc-windows-msvc      -enable-legalize-types-checking      | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls-strict.ll --check-prefix=WIN
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -O2 -mtriple=x86_64-pc-windows-msvc -enable-legalize-types-checking
# .---command stderr------------
# | Assertion failed: VA.isRegLoc() && "Can only return in registers!", file C:\_work\llvm-project\llvm-project\llvm\lib\Target\X86\X86ISelLoweringCall.cpp, line 773
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
# | Stack dump:
# | 0.	Program arguments: c:\\_work\\llvm-project\\llvm-project\\build\\bin\\llc.exe -O2 -mtriple=x86_64-pc-windows-msvc -enable-legalize-types-checking
# | 1.	Running pass 'Function Pass Manager' on module '<stdin>'.
# | 2.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@add'
# | Exception Code: 0xC000001D
# |  #0 0x00007ff79c1f96f6 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x2dd96f6)
# |  #1 0x00007ffe3c97bb04 (C:\Windows\System32\ucrtbase.dll+0x7bb04)
# |  #2 0x00007ffe3c97cad1 (C:\Windows\System32\ucrtbase.dll+0x7cad1)
# |  #3 0x00007ffe3c97e4a1 (C:\Windows\System32\ucrtbase.dll+0x7e4a1)
# |  #4 0x00007ffe3c97e6e1 (C:\Windows\System32\ucrtbase.dll+0x7e6e1)
# |  #5 0x00007ff79dc82c96 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x4862c96)
# |  #6 0x00007ff79b1b684b (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x1d9684b)
# |  #7 0x00007ff79b1b3f0c (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x1d93f0c)
# |  #8 0x00007ff799b01fab (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x6e1fab)
# |  #9 0x00007ff799b017f0 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x6e17f0)
# | #10 0x00007ff799afd7a5 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x6dd7a5)
# | #11 0x00007ff79b3a1f4c (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x1f81f4c)
# | #12 0x00007ff799afa824 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x6da824)
# | #13 0x00007ff799ec2763 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0xaa2763)
# | #14 0x00007ff79990a749 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x4ea749)
# | #15 0x00007ff7999131dd (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x4f31dd)
# | #16 0x00007ff79990b3c8 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x4eb3c8)
# | #17 0x00007ff79942747f (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x747f)
# | #18 0x00007ff79dd785e0 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x49585e0)
# | #19 0x00007ffe41824cb0 (C:\Windows\System32\KERNEL32.DLL+0x14cb0)
# | #20 0x00007ffe4e87edcb (C:\Windows\SYSTEM32\ntdll.dll+0x7edcb)
# `-----------------------------
# error: command failed with exit status: 0xc000001d
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls-strict.ll' --check-prefix=WIN
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls-strict.ll --check-prefix=WIN
# `-----------------------------
# error: command failed with exit status: 2

--

LLVM.CodeGen/X86/fp128-libcalls.ll
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\llc.exe < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls.ll -O2 -mtriple=x86_64-linux-android      -enable-legalize-types-checking | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls.ll --check-prefix=ANDROID
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -O2 -mtriple=x86_64-linux-android -enable-legalize-types-checking
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls.ll' --check-prefix=ANDROID
# note: command had no output on stdout or stderr
# RUN: at line 4
c:\_work\llvm-project\llvm-project\build\bin\llc.exe < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls.ll -O2 -mtriple=x86_64-linux-gnu      -enable-legalize-types-checking | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls.ll --check-prefix=GNU
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -O2 -mtriple=x86_64-linux-gnu -enable-legalize-types-checking
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls.ll' --check-prefix=GNU
# note: command had no output on stdout or stderr
# RUN: at line 6
c:\_work\llvm-project\llvm-project\build\bin\llc.exe < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls.ll -O2 -mtriple=i686-linux-gnu -mattr=sse2      -enable-legalize-types-checking | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls.ll --check-prefix=X86
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -O2 -mtriple=i686-linux-gnu -mattr=sse2 -enable-legalize-types-checking
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls.ll' --check-prefix=X86
# note: command had no output on stdout or stderr
# RUN: at line 8
c:\_work\llvm-project\llvm-project\build\bin\llc.exe < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls.ll -O2 -mtriple=x86_64-pc-windows-msvc      -enable-legalize-types-checking | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls.ll --check-prefix=WIN
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -O2 -mtriple=x86_64-pc-windows-msvc -enable-legalize-types-checking
# note: command had no output on stdout or stderr
# error: command failed with exit status: 0xc0000409
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls.ll' --check-prefix=WIN
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\fp128-libcalls.ll --check-prefix=WIN
# `-----------------------------
# error: command failed with exit status: 2

--

LLVM.CodeGen/X86/i128-fp128-abi.ll
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 5
sed 's/PrimTy/fp128/g' C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\i128-fp128-abi.ll | sed 's/Prim0/0xL0/g' | c:\_work\llvm-project\llvm-project\build\bin\llc.exe -mtriple=x86_64-unknown-linux-gnu -verify-machineinstrs | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\i128-fp128-abi.ll --check-prefix=CHECK-X64-F128
# executed command: sed s/PrimTy/fp128/g 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\i128-fp128-abi.ll'
# note: command had no output on stdout or stderr
# executed command: sed s/Prim0/0xL0/g
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=x86_64-unknown-linux-gnu -verify-machineinstrs
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\i128-fp128-abi.ll' --check-prefix=CHECK-X64-F128
# note: command had no output on stdout or stderr
# RUN: at line 6
sed 's/PrimTy/i128/g'  C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\i128-fp128-abi.ll | sed 's/Prim0/0/g'    | c:\_work\llvm-project\llvm-project\build\bin\llc.exe -mtriple=x86_64-unknown-linux-gnu -verify-machineinstrs | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\i128-fp128-abi.ll --check-prefix=CHECK-X64-I128
# executed command: sed s/PrimTy/i128/g 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\i128-fp128-abi.ll'
# note: command had no output on stdout or stderr
# executed command: sed s/Prim0/0/g
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=x86_64-unknown-linux-gnu -verify-machineinstrs
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\i128-fp128-abi.ll' --check-prefix=CHECK-X64-I128
# note: command had no output on stdout or stderr
# RUN: at line 7
sed 's/PrimTy/fp128/g' C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\i128-fp128-abi.ll | sed 's/Prim0/0xL0/g' | c:\_work\llvm-project\llvm-project\build\bin\llc.exe -mtriple=x86_64-pc-windows-msvc -verify-machineinstrs   | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\i128-fp128-abi.ll --check-prefix=CHECK-MSVC64-F128
# executed command: sed s/PrimTy/fp128/g 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\i128-fp128-abi.ll'
# note: command had no output on stdout or stderr
# executed command: sed s/Prim0/0xL0/g
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=x86_64-pc-windows-msvc -verify-machineinstrs
# .---command stderr------------
# | Assertion failed: VA.isRegLoc() && "Can only return in registers!", file C:\_work\llvm-project\llvm-project\llvm\lib\Target\X86\X86ISelLoweringCall.cpp, line 773
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
# | Stack dump:
# | 0.	Program arguments: c:\\_work\\llvm-project\\llvm-project\\build\\bin\\llc.exe -mtriple=x86_64-pc-windows-msvc -verify-machineinstrs
# | 1.	Running pass 'Function Pass Manager' on module '<stdin>'.
# | 2.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@return'
# | Exception Code: 0xC000001D
# |  #0 0x00007ff79c1f96f6 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x2dd96f6)
# |  #1 0x00007ffe3c97bb04 (C:\Windows\System32\ucrtbase.dll+0x7bb04)
# |  #2 0x00007ffe3c97cad1 (C:\Windows\System32\ucrtbase.dll+0x7cad1)
# |  #3 0x00007ffe3c97e4a1 (C:\Windows\System32\ucrtbase.dll+0x7e4a1)
# |  #4 0x00007ffe3c97e6e1 (C:\Windows\System32\ucrtbase.dll+0x7e6e1)
# |  #5 0x00007ff79dc82c96 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x4862c96)
# |  #6 0x00007ff79b1b684b (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x1d9684b)
# |  #7 0x00007ff79b1b3f0c (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x1d93f0c)
# |  #8 0x00007ff799b01fab (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x6e1fab)
# |  #9 0x00007ff799b017f0 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x6e17f0)
# | #10 0x00007ff799afd7a5 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x6dd7a5)
# | #11 0x00007ff79b3a1f4c (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x1f81f4c)
# | #12 0x00007ff799afa824 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x6da824)
# | #13 0x00007ff799ec2763 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0xaa2763)
# | #14 0x00007ff79990a749 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x4ea749)
# | #15 0x00007ff7999131dd (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x4f31dd)
# | #16 0x00007ff79990b3c8 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x4eb3c8)
# | #17 0x00007ff79942747f (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x747f)
# | #18 0x00007ff79dd785e0 (c:\_work\llvm-project\llvm-project\build\bin\llc.exe+0x49585e0)
# | #19 0x00007ffe41824cb0 (C:\Windows\System32\KERNEL32.DLL+0x14cb0)
# | #20 0x00007ffe4e87edcb (C:\Windows\SYSTEM32\ntdll.dll+0x7edcb)
# `-----------------------------
# error: command failed with exit status: 0xc000001d
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\i128-fp128-abi.ll' --check-prefix=CHECK-MSVC64-F128
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\i128-fp128-abi.ll --check-prefix=CHECK-MSVC64-F128
# `-----------------------------
# error: command failed with exit status: 2

--

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the infrastructure label.

@tgross35

tgross35 commented Apr 26, 2026

Copy link
Copy Markdown
Contributor Author

Since ABI doesn’t specify this, why choose the less efficient approach? Why can’t make gcc match clang’s behavior?

That was my initial plan for a long time, which I noted in the linked commit. But I talked with a handful of people and got the impression that the proposed behavior here (return on the stack) is likely a closer interpretation of the MSVC ABI's handling of fundamental types than returning in xmm0. This also applies to i128 but it is much more set in stone (based on some light GCC archaeology I got the feeling that returning __int128 in xmm0 is not really intentional, but rather a carryover of __m128).

If that's the case then I don't think the performance difference is especially concerning. The type already needs to be passed in memory and even a simple f128 addition is ~300 instructions (~50 for the shortest nontrivial fast path), an extra movups won't matter much.

@tgross35

Copy link
Copy Markdown
Contributor Author

I'm still a bit stuck here figuring out how to get the stack return working. @phoebewang or perhaps @nikic do you happen to have any ideas?

folkertdev added a commit that referenced this pull request Jul 1, 2026
Subsumes #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 5ee1c0b ("[windows] Always pass
fp128 arguments indirectly").

[1]:
https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170#return-values
llvm-upstreamsync Bot pushed a commit to qualcomm/cpullvm-toolchain that referenced this pull request Jul 1, 2026
Subsumes llvm/llvm-project#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 5ee1c0b ("[windows] Always pass
fp128 arguments indirectly").

[1]:
https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170#return-values
llvm-sync Bot pushed a commit to arm/arm-toolchain that referenced this pull request Jul 1, 2026
Subsumes llvm/llvm-project#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 5ee1c0b ("[windows] Always pass
fp128 arguments indirectly").

[1]:
https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170#return-values
maarcosrmz pushed a commit to maarcosrmz/llvm-project that referenced this pull request Jul 1, 2026
Subsumes llvm#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 5ee1c0b ("[windows] Always pass
fp128 arguments indirectly").

[1]:
https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170#return-values
llvm-upstream-sync Bot pushed a commit to sriyalamar/cpullvm-toolchain that referenced this pull request Jul 1, 2026
Subsumes llvm/llvm-project#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 5ee1c0b ("[windows] Always pass
fp128 arguments indirectly").

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

tgross35 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

#204887 finished this up

@tgross35 tgross35 closed this Jul 7, 2026
@tgross35
tgross35 deleted the win-f128-abi branch July 7, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants