Description
The below fails to select on target powerpc64le-unknown-linux-gnu
:
define half @demo(fp128 %a) unnamed_addr {
start:
%_0 = fptrunc fp128 %a to half
ret half %_0
}
LLVM ERROR: Cannot select: 0x8255100: i32 = fp_to_fp16 0x8254d10
0x8254d10: f128,ch = CopyFromReg 0x81d62a0, Register:f128 %0
0x8254ca0: f128 = Register %0
In function: demo
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=powerpc64le-unknown-linux-gnu <source>
1. Running pass 'Function Pass Manager' on module '<source>'.
2. Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on function '@demo'
#0 0x00000000036a9bd8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x36a9bd8)
#1 0x00000000036a754c SignalHandler(int) Signals.cpp:0:0
#2 0x0000798ba1642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x0000798ba16969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x0000798ba1642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x0000798ba16287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x0000000000728eee llvm::UniqueStringSaver::save(llvm::StringRef) (.cold) StringSaver.cpp:0:0
#7 0x0000000003479844 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3479844)
#8 0x0000000003480265 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3480265)
#9 0x0000000001776d27 (anonymous namespace)::PPCDAGToDAGISel::Select(llvm::SDNode*) PPCISelDAGToDAG.cpp:0:0
#10 0x0000000003476d07 llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-trunk/bin/llc+0x3476d07)
#11 0x0000000003484c65 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/llc+0x3484c65)
#12 0x0000000003487918 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3487918)
#13 0x000000000348a0f9 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#14 0x000000000177d7a7 (anonymous namespace)::PPCDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) PPCISelDAGToDAG.cpp:0:0
#15 0x00000000027da790 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#16 0x0000000002cff152 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2cff152)
#17 0x0000000002cff2d1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2cff2d1)
#18 0x0000000002d00f80 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2d00f80)
#19 0x000000000083d4c4 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#20 0x000000000073b0ce main (/opt/compiler-explorer/clang-trunk/bin/llc+0x73b0ce)
#21 0x0000798ba1629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#22 0x0000798ba1629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#23 0x00000000008350fe _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x8350fe)
Program terminated with signal: SIGSEGV
Compiler returned: 139
Link: https://llvm.godbolt.org/z/16W8EKzfa
both powerpc64
and powerpc
(32-bit) complete selection and emit a call to __trunctfhf2
. I am not sure if this is correct or if it should try to call __trunckfhf2
instead, but all three targets (powerpc64, powerpc64le, powerpc) should all probably act the same.