Skip to content

Cannot select llvm.{min,max}imum.{f32,f64} #53353

Closed
@Urgau

Description

@Urgau

It seems that none of these intrinsics are actually implemented:

  • llvm.minimum.f32
  • llvm.minimum.f64
  • llvm.maximum.f32
  • llvm.maximum.f64

This came up when trying to implement the minimum and maximum functions in Rust, rust-lang/rust#91008. Which leads us to use a manual implementation.

godbolt

LLVM ERROR: Cannot select: 0x55d57d5a8d30: f32 = fmaximum 0x55d57d5a8bf8, 0x55d57d5a8cc8
  0x55d57d5a8bf8: f32,ch = CopyFromReg 0x55d57d52da08, Register:f32 %0
    0x55d57d5a8b90: f32 = Register %0
  0x55d57d5a8cc8: f32,ch = CopyFromReg 0x55d57d52da08, Register:f32 %1
    0x55d57d5a8c60: f32 = Register %1
In function: _ZN1a4test17hb60f9f6975710eeaE
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 <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@_ZN1a4test17hb60f9f6975710eeaE'
 #0 0x000055d579c6b16f PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x000055d579c68a2d SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f10dfdc83c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #3 0x00007f10df89718b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4618b)
 #4 0x00007f10df876859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x25859)
 #5 0x000055d579bafd18 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2bafd18)
 #6 0x000055d579a7bec6 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2a7bec6)
 #7 0x000055d579a7eea2 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2a7eea2)
 #8 0x000055d5787d91ff (anonymous namespace)::X86DAGToDAGISel::Select(llvm::SDNode*) X86ISelDAGToDAG.cpp:0:0
 #9 0x000055d579a7aa24 llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-trunk/bin/llc+0x2a7aa24)
#10 0x000055d579a823a6 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/llc+0x2a823a6)
#11 0x000055d579a85c5c llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2a85c5c)
#12 0x000055d579a87b92 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.886) SelectionDAGISel.cpp:0:0
#13 0x000055d5787e12c0 (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) X86ISelDAGToDAG.cpp:0:0
#14 0x000055d57908cc58 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x208cc58)
#15 0x000055d5794ca629 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x24ca629)
#16 0x000055d5794ca8c1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x24ca8c1)
#17 0x000055d5794cbb37 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x24cbb37)
#18 0x000055d57796d0d5 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#19 0x000055d57789606e main (/opt/compiler-explorer/clang-trunk/bin/llc+0x89606e)
#20 0x00007f10df8780b3 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
#21 0x000055d5779646ca _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x9646ca)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions