<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/115710>115710</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [X86-backend] fptrunc fp128 %x to bfloat failed!
        </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/z/M6WE541vK

## Code
```
@G.1 = global bfloat 0xR7F80

define void @f(fp128 %x) {
  %CastFPTrunc = fptrunc fp128 %x to bfloat
  store bfloat %CastFPTrunc, ptr @G.1, align 2
  ret void
}
```
## 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 -O2 -mtriple=x86_64-linux-android -mattr=+mmx -enable-legalize-types-checking <source>
1.      Running pass 'Function Pass Manager' on module '<source>'.
2.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@f'
 #0 0x000000000391df98 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x391df98)
 #1 0x000000000391bb5c SignalHandler(int) Signals.cpp:0:0
 #2 0x000077ce84842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x000077ce848969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x000077ce84842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x000077ce848287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000000000075696c llvm::UniqueStringSaver::save(llvm::Twine const&) (.cold) StringSaver.cpp:0:0
 #7 0x00000000038740b8 (/opt/compiler-explorer/clang-trunk/bin/llc+0x38740b8)
 #8 0x0000000003744e97 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+0x3744e97)
 #9 0x0000000001dcab1e llvm::X86TargetLowering::LowerFP_TO_BF16(llvm::SDValue, llvm::SelectionDAG&) const (/opt/compiler-explorer/clang-trunk/bin/llc+0x1dcab1e)
#10 0x0000000001eb8957 llvm::X86TargetLowering::LowerOperation(llvm::SDValue, llvm::SelectionDAG&) const (/opt/compiler-explorer/clang-trunk/bin/llc+0x1eb8957)
#11 0x00000000035d6ca5 (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) LegalizeDAG.cpp:0:0
#12 0x00000000035db42e llvm::SelectionDAG::Legalize() (/opt/compiler-explorer/clang-trunk/bin/llc+0x35db42e)
#13 0x00000000036db80b llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/llc+0x36db80b)
#14 0x00000000036de3fc llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x36de3fc)
#15 0x00000000036e005f llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x36e005f)
#16 0x00000000036cc411 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x36cc411)
#17 0x00000000029b498b llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#18 0x0000000002f09492 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2f09492)
#19 0x0000000002f09721 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2f09721)
#20 0x0000000002f0b0c6 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2f0b0c6)
#21 0x000000000087d334 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#22 0x000000000076aca6 main (/opt/compiler-explorer/clang-trunk/bin/llc+0x76aca6)
#23 0x000077ce84829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#24 0x000077ce84829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#25 0x00000000008750fe _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x8750fe)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEmEtz4yoWgH8N3lB2IfReeOHEcSY1ySQV5_b0LoUQlpkg0ABKnPvrp0BybNy5tzudnmpXHhZwzvnOg4cgxvBGMjYH6RlIlxPS263S8yVvbvVSNZNK1a9zgGO4ZIZq3lmuJEBLgBYPWwY3Sgj1wmUDqaoZpJqYLTPwa5HBitAnJmv4wu0WAoyvr7_cwIv7-9t7EC_gH9L0Xae0ZTUUvNJEv0JKhICqY5p4IzgCGA-mxr84hjdc8pYIeM86reqeHnC21nYGxAuAVwCvGlVXStiZ0g3Aqz8BXt1k_75Ik-j5nycqndZzVbOxIUPjz_CYoMtZBEG8hI1QFRGw2ghFLES7-3xVoGNdNdtwyeCz4jUECdoAXGy6CBcQ4HQHcAlBfjaMhK7pnBi7unvQvaRe_6az_vtBBlo1mtuLGas02yOEOgA-h53VcCB2T0TwRkK8l9XMerYROV--7_AQkLUl9Ak-aELfj8vPJNML3l1fLNYX0PRVyy0ksOobqJmTdd6e5JDbbV_NqGoBXgnxvP837bT6D6MW4BU3pmcG4BUksoZcUtHXDNrtWIq-CK3zYjaYH_yq-7ZzVnwTm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