Issue 149512
Summary LoongArch: `__attribute__((target("lasx")))` does not imply LSX
Labels new issue
Assignees
Reporter xry111
    ```c
typedef long long __m256i __attribute__((__vector_size__(32), __may_alias__));
__attribute__((target("lasx")))
void ARGBToUVJRow_LASX(void) {
__m256i const_10 = ((__m256i)__builtin_lasx_xvldi((0x40A)));
}
```

It makes clang error out with `-mno-lsx`:

```
fatal error: error in backend: Do not know how to split the result of this operator!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-trunk/bin/clang++ -g -o /app/output.s -fno-verbose-asm -S -target loongarch64-unknown-linux-gnu --gcc-toolchain=/opt/compiler-explorer/loongarch64/gcc-14.2.0/loongarch64-unknown-linux-gnu --sysroot=/opt/compiler-explorer/loongarch64/gcc-14.2.0/loongarch64-unknown-linux-gnu/loongarch64-unknown-linux-gnu/sysroot -fcolor-diagnostics -fno-crash-diagnostics -mno-lsx <source>
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '<source>'.
4.	Running pass 'LoongArch DAG->DAG Pattern Instruction Selection' on function '@_Z17ARGBToUVJRow_LASXv'
 #0 0x0000000003c91dd8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3c91dd8)
 #1 0x0000000003c8f7ac llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3c8f7ac)
 #2 0x0000000003bdfff3 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bdfff3)
 #3 0x0000000003c86ffe llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3c86ffe)
 #4 0x0000000000daeacb LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
 #5 0x0000000003be9f23 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3be9f23)
 #6 0x0000000003bea088 (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bea088)
 #7 0x0000000005345595 llvm::DAGTypeLegalizer::SplitVectorResult(llvm::SDNode*, unsigned int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5345595)
 #8 0x00000000052f1aee llvm::DAGTypeLegalizer::run() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x52f1aee)
 #9 0x00000000052f21d1 llvm::SelectionDAG::LegalizeTypes() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x52f21d1)
#10 0x000000000525fbb2 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x525fbb2)
#11 0x00000000052626ad llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x52626ad)
#12 0x0000000005264506 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5264506)
#13 0x0000000005250f81 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5250f81)
#14 0x000000000306e82d llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x306e82d)
#15 0x00000000035e9172 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x35e9172)
#16 0x00000000035e9401 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x35e9401)
#17 0x00000000035ead49 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x35ead49)
#18 0x0000000003f3c650 clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3f3c650)
#19 0x00000000045dc69c clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x45dc69c)
#20 0x000000000624098c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x624098c)
#21 0x00000000045dce8d clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x45dce8d)
#22 0x00000000048e75ba clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x48e75ba)
#23 0x00000000048626db clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x48626db)
#24 0x00000000049db573 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x49db573)
#25 0x0000000000db0b25 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xdb0b25)
#26 0x0000000000da8a0d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#27 0x000000000464ebc9 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#28 0x0000000003bdfef3 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3bdfef3)
#29 0x000000000464ede9 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#30 0x000000000461217d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x461217d)
#31 0x0000000004613131 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4613131)
#32 0x000000000462063c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x462063c)
#33 0x0000000000dad341 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xdad341)
#34 0x0000000000c5cb24 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc5cb24)
#35 0x00007158a5429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#36 0x00007158a5429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#37 0x0000000000da84a5 _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xda84a5)
clang++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
```

The ICE seems just #131771, but changing `__attribute__((target("lasx")))` to `__attribute__((target("lasx,lsx")))` makes it work.  However they should have the same behavior IMO.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to