<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/108936>108936</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[X86-backend] Unsupported library call operation!
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DigOrDog
</td>
</tr>
</table>
<pre>
# Description
The following code crashes X86 backend with "LLVM ERROR: Unsupported library call operation!"
# Minimal Reproduction
https://godbolt.org/
## code
```
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
define i32 @main(x86_fp80 %0) {
%CastFPTrunc = fptrunc x86_fp80 %0 to bfloat
store bfloat %CastFPTrunc, ptr null, align 2
unreachable
}
```
## Stack Trace
```
LLVM ERROR: Unsupported library call operation!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mtriple=x86_64 -O=2 <source>
1. Running pass 'Function Pass Manager' on module '<source>'.
2. Running pass 'X86 DAG->DAG Instruction Selection' on function '@main'
#0 0x000000000385d588 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x385d588)
#1 0x000000000385af2c SignalHandler(int) Signals.cpp:0:0
#2 0x00007c30b8842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00007c30b88969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x00007c30b8842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x00007c30b88287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x000000000074b35c llvm::UniqueStringSaver::save(llvm::Twine const&) (.cold) StringSaver.cpp:0:0
#7 0x00000000037b48c8 (/opt/compiler-explorer/clang-trunk/bin/llc+0x37b48c8)
#8 0x0000000003688dc7 llvm::TargetLowering::makeLibCall(llvm::SelectionDAG&, llvm::RTLIB::Libcall, llvm::EVT, llvm::ArrayRef<llvm::SDValue>, llvm::TargetLowering::MakeLibCallOptions, llvm::SDLoc const&, llvm::SDValue) const (/opt/compiler-explorer/clang-trunk/bin/llc+0x3688dc7)
#9 0x0000000001d6619e llvm::X86TargetLowering::LowerFP_TO_BF16(llvm::SDValue, llvm::SelectionDAG&) const (/opt/compiler-explorer/clang-trunk/bin/llc+0x1d6619e)
#10 0x0000000001e52034 llvm::X86TargetLowering::LowerOperation(llvm::SDValue, llvm::SelectionDAG&) const (/opt/compiler-explorer/clang-trunk/bin/llc+0x1e52034)
#11 0x000000000351fd25 (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) LegalizeDAG.cpp:0:0
#12 0x00000000035244be llvm::SelectionDAG::Legalize() (/opt/compiler-explorer/clang-trunk/bin/llc+0x35244be)
#13 0x000000000362057b llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/llc+0x362057b)
#14 0x000000000362316c llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x362316c)
#15 0x0000000003624dcf llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3624dcf)
#16 0x0000000003610ff1 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3610ff1)
#17 0x00000000029195fb llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#18 0x0000000002e64ff2 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e64ff2)
#19 0x0000000002e65281 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e65281)
#20 0x0000000002e66c26 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2e66c26)
#21 0x000000000086e124 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#22 0x000000000075f416 main (/opt/compiler-explorer/clang-trunk/bin/llc+0x75f416)
#23 0x00007c30b8829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#24 0x00007c30b8829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#25 0x0000000000865efe _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x865efe)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEmF1T5CwWgH8NfUOlKyHfF33RGtu1SlfL9p2aO4sQkmYlkAUy6v76LUjabnp8d8ZxtsbSSEjOOc_5AAJYa9YJSlcgPQNptcCj2Um1qlh3qyrZLWrZvK4AimFFNVFsMEwKEFYgXD_sKGwl5_KZiQ4S2VBIFNY7quHXIoM1Jk9UNPCZmR0ECF1ff7mBF_f3t_cgXsO_hB6HQSpDG8hZrbB6hQRzDuVAFXZGUAQQmkzNVxTDGyZYjzm8p4OSzUgOODtjBg3iNUAbgDadbGrJzVKqznb4Wqwiyzt3ZOH8624NVh01sMEGc_wqRwNBXFkHaNCDeE2DAeUhiNcxchd7G_m3tpUl7hKwfaMtrFCEikAUtpHtZbIk2EaoePN1tm8UGzjd234psscsCQYScCbGl6AT40lwGtoyQSGLEQRJ2GMmACqsWDsUIQQoDQEqIcjPptdtzznWZnP3oEZBnJ12MK7tSUEjYd1yic0sCLWRis59J2oAOoeDUVCMnNs25qwTEO0lR6EoJjtc833o8-rdHHiZ2hpMnuCDwuT9hP1KYTnBu-uL9fYC6rHumYEY1mMHFbWy1umTemJmN9ZLInuANpx_2_8LBiX_RYkBaMO0HqkG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