File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
clang/lib/Driver/ToolChains/Arch Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -135,8 +135,13 @@ void loongarch::getLoongArchTargetFeatures(const Driver &D,
135
135
Features.push_back (" +lsx" );
136
136
137
137
std::string ArchName;
138
- if (const Arg *A = Args.getLastArg (options::OPT_march_EQ))
138
+ if (const Arg *A = Args.getLastArg (options::OPT_march_EQ)) {
139
139
ArchName = A->getValue ();
140
+ if (ArchName == " native" )
141
+ for (auto &F : llvm::sys::getHostCPUFeatures ())
142
+ Features.push_back (
143
+ Args.MakeArgString ((F.second ? " +" : " -" ) + F.first ()));
144
+ }
140
145
ArchName = postProcessTargetCPUString (ArchName, Triple);
141
146
llvm::LoongArch::getArchFeatures (ArchName, Features);
142
147
Original file line number Diff line number Diff line change @@ -2006,6 +2006,15 @@ const StringMap<bool> sys::getHostCPUFeatures() {
2006
2006
Features[" lasx" ] = hwcap & (1UL << 5 ); // HWCAP_LOONGARCH_LASX
2007
2007
Features[" lvz" ] = hwcap & (1UL << 9 ); // HWCAP_LOONGARCH_LVZ
2008
2008
2009
+ Features[" frecipe" ] = cpucfg2 & (1U << 25 ); // CPUCFG.2.FRECIPE
2010
+ Features[" lam-bh" ] = cpucfg2 & (1U << 27 ); // CPUCFG.2.LAM_BH
2011
+
2012
+ // TODO: Need to complete.
2013
+ // Features["div32"] = cpucfg2 & (1U << 26); // CPUCFG.2.DIV32
2014
+ // Features["lamcas"] = cpucfg2 & (1U << 28); // CPUCFG.2.LAMCAS
2015
+ // Features["llacq-screl"] = cpucfg2 & (1U << 29); // CPUCFG.2.LLACQ_SCREL
2016
+ // Features["scq"] = cpucfg2 & (1U << 30); // CPUCFG.2.SCQ
2017
+ // Features["ld-seq-sa"] = cpucfg3 & (1U << 23); // CPUCFG.3.LD_SEQ_SA
2009
2018
return Features;
2010
2019
}
2011
2020
#elif defined(__linux__) && defined(__riscv)
You can’t perform that action at this time.
0 commit comments