[clang] [llvm] [RISCV] Allow `Zicsr`/`Zifencei` to duplicate with `g` (PR #136842)

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 23 08:06:09 PDT 2025


================
@@ -717,6 +716,16 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
     } while (!Ext.empty());
   }
 
+  // We add Zicsr/Zifenci as final to allow duplicated "zicsr"/"zifencei" like
+  // "rv64g_zicsr_zifencei".
+  if (Baseline == 'g') {
+    for (const char *Ext : RISCVGImplicationsZi) {
+      auto Version = findDefaultVersion(Ext);
+      assert(Version && "Default extension version not found?");
+      ISAInfo->Exts[std::string(Ext)] = {Version->Major, Version->Minor};
----------------
topperc wrote:

Maybe we should skip this assignment if it is already in the string. The user could pass a different version number than the default. Though we only allow the default version from the user today.

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


More information about the cfe-commits mailing list