[clang] [llvm] [LoongArch] Support LA V1.1 feature ld-seq-sa that don't generate dbar 0x700. (PR #116762)

Yingwei Zheng via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 23 20:13:40 PST 2024


================
@@ -2011,8 +2011,9 @@ const StringMap<bool> sys::getHostCPUFeatures() {
 const StringMap<bool> sys::getHostCPUFeatures() {
   unsigned long hwcap = getauxval(AT_HWCAP);
   bool HasFPU = hwcap & (1UL << 3); // HWCAP_LOONGARCH_FPU
-  uint32_t cpucfg2 = 0x2;
+  const uint32_t cpucfg2 = 0x2, cpucfg3 = 0x3;
----------------
dtcxzyw wrote:

I encountered a compilation error with gcc 13.2:
```
[1/371] Building CXX object lib/TargetParser/CMakeFiles/LLVMTargetParser.dir/Host.cpp.o
FAILED: lib/TargetParser/CMakeFiles/LLVMTargetParser.dir/Host.cpp.o 
ccache /usr/bin/g++ -DGTEST_HAS_RTTI=0 -DLLVM_EXPORTS -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/dtcxzyw/llvm-build/lib/TargetParser -I/home/dtcxzyw/llvm-project/llvm/lib/TargetParser -I/home/dtcxzyw/llvm-build/include -I/home/dtcxzyw/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -w -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17 -fPIC  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT lib/TargetParser/CMakeFiles/LLVMTargetParser.dir/Host.cpp.o -MF lib/TargetParser/CMakeFiles/LLVMTargetParser.dir/Host.cpp.o.d -o lib/TargetParser/CMakeFiles/LLVMTargetParser.dir/Host.cpp.o -c /home/dtcxzyw/llvm-project/llvm/lib/TargetParser/Host.cpp
/home/dtcxzyw/llvm-project/llvm/lib/TargetParser/Host.cpp: In function ‘const llvm::StringMap<bool, llvm::MallocAllocator> llvm::sys::getHostCPUFeatures()’:
/home/dtcxzyw/llvm-project/llvm/lib/TargetParser/Host.cpp:2015:3: error: read-only variable ‘cpucfg2’ used as ‘asm’ output
 2015 |   __asm__("cpucfg %[cpucfg2], %[cpucfg2]\n\t" : [cpucfg2] "+r"(cpucfg2));
      |   ^~~~~~~
/home/dtcxzyw/llvm-project/llvm/lib/TargetParser/Host.cpp:2016:3: error: read-only variable ‘cpucfg3’ used as ‘asm’ output
 2016 |   __asm__("cpucfg %[cpucfg3], %[cpucfg3]\n\t" : [cpucfg3] "+r"(cpucfg3));
      |   ^~~~~~~
ninja: build stopped: subcommand failed.
```

https://github.com/llvm/llvm-project/pull/116762


More information about the cfe-commits mailing list