aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/TargetParser/Host.cpp
diff options
context:
space:
mode:
authortangaac <tangyan01@loongson.cn>2024-11-22 17:34:15 +0800
committerGitHub <noreply@github.com>2024-11-22 17:34:15 +0800
commit1d4602070f96c9a6921d51a3b907f90cd2e3ae32 (patch)
treeda186eb2b24313295a46c5b9de51ac4780294ad1 /llvm/lib/TargetParser/Host.cpp
parent05fcdd555eaac74717cd132ca434c90ae99381dd (diff)
downloadllvm-1d4602070f96c9a6921d51a3b907f90cd2e3ae32.zip
llvm-1d4602070f96c9a6921d51a3b907f90cd2e3ae32.tar.gz
llvm-1d4602070f96c9a6921d51a3b907f90cd2e3ae32.tar.bz2
[LoongArch] Support LA V1.1 feature ld-seq-sa that don't generate dbar 0x700. (#116762)
Two options for clang -mld-seq-sa: Do not generate load-load barrier instructions (dbar 0x700) -mno-ld-seq-sa: Generate load-load barrier instructions (dbar 0x700) The default is -mno-ld-seq-sa
Diffstat (limited to 'llvm/lib/TargetParser/Host.cpp')
-rw-r--r--llvm/lib/TargetParser/Host.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/TargetParser/Host.cpp b/llvm/lib/TargetParser/Host.cpp
index b295db5..e0c857b 100644
--- a/llvm/lib/TargetParser/Host.cpp
+++ b/llvm/lib/TargetParser/Host.cpp
@@ -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;
__asm__("cpucfg %[cpucfg2], %[cpucfg2]\n\t" : [cpucfg2] "+r"(cpucfg2));
+ __asm__("cpucfg %[cpucfg3], %[cpucfg3]\n\t" : [cpucfg3] "+r"(cpucfg3));
StringMap<bool> Features;
@@ -2026,12 +2027,13 @@ const StringMap<bool> sys::getHostCPUFeatures() {
Features["frecipe"] = cpucfg2 & (1U << 25); // CPUCFG.2.FRECIPE
Features["lam-bh"] = cpucfg2 & (1U << 27); // CPUCFG.2.LAM_BH
+ Features["ld-seq-sa"] = cpucfg3 & (1U << 23); // CPUCFG.3.LD_SEQ_SA
+
// TODO: Need to complete.
// Features["div32"] = cpucfg2 & (1U << 26); // CPUCFG.2.DIV32
// Features["lamcas"] = cpucfg2 & (1U << 28); // CPUCFG.2.LAMCAS
// Features["llacq-screl"] = cpucfg2 & (1U << 29); // CPUCFG.2.LLACQ_SCREL
// Features["scq"] = cpucfg2 & (1U << 30); // CPUCFG.2.SCQ
- // Features["ld-seq-sa"] = cpucfg3 & (1U << 23); // CPUCFG.3.LD_SEQ_SA
return Features;
}
#elif defined(__linux__) && defined(__riscv)