diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index c070394a3667..446cc6128bab 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1097,6 +1097,8 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
   {"e", "i",		check_implicit_always},
   {"i", "zicsr",	check_implicit_for_i},
   {"i", "zifencei",	check_implicit_for_i},
+  {"i", "zicntr",	check_implicit_for_i},
+  {"i", "zihpm",	check_implicit_for_i},
   {"g", "i",		check_implicit_always},
   {"g", "m",		check_implicit_always},
   {"g", "a",		check_implicit_always},
@@ -1148,6 +1150,8 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
   {"zhinx", "zhinxmin",	check_implicit_always},
   {"zhinxmin", "zfinx",	check_implicit_always},
   {"zfinx", "zicsr",	check_implicit_always},
+  {"zicntr", "zicsr",	check_implicit_always},
+  {"zihpm", "zicsr",	check_implicit_always},
   {"zk", "zkn",		check_implicit_always},
   {"zk", "zkr",		check_implicit_always},
   {"zk", "zkt",		check_implicit_always},
@@ -1251,13 +1255,17 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] =
   {"zicbom",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
   {"zicbop",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
   {"zicboz",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
+  {"zicntr",		ISA_SPEC_CLASS_DRAFT,		2, 0,  0 },
   {"zicond",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
   {"zicsr",		ISA_SPEC_CLASS_20191213,	2, 0,  0 },
   {"zicsr",		ISA_SPEC_CLASS_20190608,	2, 0,  0 },
+  {"zicsr",		ISA_SPEC_CLASS_DRAFT,		2, 0,  0 },
   {"zifencei",		ISA_SPEC_CLASS_20191213,	2, 0,  0 },
   {"zifencei",		ISA_SPEC_CLASS_20190608,	2, 0,  0 },
+  {"zifencei",		ISA_SPEC_CLASS_DRAFT,		2, 0,  0 },
   {"zihintntl",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
   {"zihintpause",	ISA_SPEC_CLASS_DRAFT,		2, 0,  0 },
+  {"zihpm",		ISA_SPEC_CLASS_DRAFT,		2, 0,  0 },
   {"zmmul",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
   {"zawrs",		ISA_SPEC_CLASS_DRAFT,		1, 0,  0 },
   {"zfa",		ISA_SPEC_CLASS_DRAFT,		0, 1,  0 },
@@ -1649,6 +1657,18 @@ riscv_get_default_ext_version (enum riscv_spec_class *default_isa_spec,
     }
 }
 
+/* Check if the subset is one of the extensions split from
+   the 'I' extension version 2.0.  */
+
+static bool
+riscv_is_subset_of_i_2p0 (const char *subset)
+{
+  return (strcmp (subset, "zicsr") == 0
+	  || strcmp (subset, "zifencei") == 0
+	  || strcmp (subset, "zicntr") == 0
+	  || strcmp (subset, "zihpm") == 0);
+}
+
 /* Find the default versions for the extension before adding them to
    the subset list, if their versions are RISCV_UNKNOWN_VERSION.
    Afterwards, report errors if we can not find their default versions.  */
@@ -1662,9 +1682,26 @@ riscv_parse_add_subset (riscv_parse_subset_t *rps,
 {
   int major_version = major;
   int minor_version = minor;
+  bool handle_subset_of_i_2p0 = false;
+
+  /* If a subset of the 'I' extension version 2.0 is being added,
+     check the version of 'I' and allow its version unknown when the
+     'I' extension version is less than 2.1.
+     Draft 'E' is arbitrarily handled since it's a draft but the default
+     handling is the same as 'I' >= 2.1 because non-draft 'E' extension
+     does not have 'I' version 2.0 subsets.  */
+  if (riscv_is_subset_of_i_2p0 (subset))
+    {
+      riscv_subset_t *ext_i;
+      if (riscv_lookup_subset (rps->subset_list, "i", &ext_i)
+	  && (ext_i->major_version < 2
+	      || (ext_i->major_version == 2 && ext_i->minor_version < 1)))
+	handle_subset_of_i_2p0 = true;
+    }
 
-  if (major_version == RISCV_UNKNOWN_VERSION
-       || minor_version == RISCV_UNKNOWN_VERSION)
+  if (!handle_subset_of_i_2p0
+      && (major_version == RISCV_UNKNOWN_VERSION
+	  || minor_version == RISCV_UNKNOWN_VERSION))
     riscv_get_default_ext_version (rps->isa_spec, subset,
 				   &major_version, &minor_version);
 
@@ -1677,9 +1714,9 @@ riscv_parse_add_subset (riscv_parse_subset_t *rps,
 	rps->error_handler
 	  (_("x ISA extension `%s' must be set with the versions"),
 	   subset);
-      /* Allow old ISA spec can recognize zicsr and zifencei.  */
-      else if (strcmp (subset, "zicsr") != 0
-	       && strcmp (subset, "zifencei") != 0)
+      /* Allow old ISA spec (version 2.2) can recognize extensions
+	 effectively split from the base 'I' extension version 2.0.  */
+      else if (!riscv_is_subset_of_i_2p0 (subset))
 	rps->error_handler
 	  (_("cannot find default versions of the ISA extension `%s'"),
 	   subset);
@@ -2389,6 +2426,9 @@ riscv_multi_subset_supports (riscv_parse_subset_t *rps,
       return riscv_subset_supports (rps, "zicbop");
     case INSN_CLASS_ZICBOZ:
       return riscv_subset_supports (rps, "zicboz");
+    case INSN_CLASS_ZICNTR:
+      /* Instead of 'Zicntr', query for 'I' for compatibility.  */
+      return riscv_subset_supports (rps, "i");
     case INSN_CLASS_ZICOND:
       return riscv_subset_supports (rps, "zicond");
     case INSN_CLASS_ZICSR:
@@ -2592,6 +2632,8 @@ riscv_multi_subset_supports_ext (riscv_parse_subset_t *rps,
       return "zicbop";
     case INSN_CLASS_ZICBOZ:
       return "zicboz";
+    case INSN_CLASS_ZICNTR:
+      return "zicntr";
     case INSN_CLASS_ZICOND:
       return "zicond";
     case INSN_CLASS_ZICSR:
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 5759d3a5fc4e..aa88cec881e4 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -66,6 +66,10 @@ enum riscv_csr_class
 
   CSR_CLASS_I,
   CSR_CLASS_I_32,	/* rv32 only */
+  CSR_CLASS_ZICNTR,	/* basic hardware perf counter */
+  CSR_CLASS_ZICNTR_32,	/* basic hardware perf counter, rv32 only */
+  CSR_CLASS_ZIHPM,	/* additional hardware perf counter */
+  CSR_CLASS_ZIHPM_32,	/* additional hardware perf counter, rv32 only */
   CSR_CLASS_F,		/* f-ext only */
   CSR_CLASS_ZKR,	/* zkr only */
   CSR_CLASS_V,		/* rvv only */
@@ -1033,6 +1037,18 @@ riscv_csr_address (const char *csr_name,
       need_check_version = true;
       extension = "i";
       break;
+    case CSR_CLASS_ZICNTR_32:
+      is_rv32_only = true;
+      /* Fall through.  */
+    case CSR_CLASS_ZICNTR:
+      extension = "zicntr";
+      break;
+    case CSR_CLASS_ZIHPM_32:
+      is_rv32_only = true;
+      /* Fall through.  */
+    case CSR_CLASS_ZIHPM:
+      extension = "zihpm";
+      break;
     case CSR_CLASS_H_32:
       is_rv32_only = true;
       /* Fall through.  */
@@ -2611,6 +2627,15 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
 		      insn_with_csr = false;
 		    }
 
+		  /* Check if we are using a 'Zicntr' pseudoinstruction
+		     without the 'Zicntr' extension.  */
+		  if (insn->insn_class == INSN_CLASS_ZICNTR
+		      && !riscv_subset_supports (&riscv_rps_as, "zicntr"))
+		    {
+		      as_warn (_("`%s' needs `zicntr' extension"),
+			       insn->name);
+		    }
+
 		  /* The (segmant) load and store with EEW 64 cannot be used
 		     when zve32x is enabled.  */
 		  if (ip->insn_mo->pinfo & INSN_V_EEW64
diff --git a/gas/testsuite/gas/riscv/csr-insns-pseudo-noalias.d b/gas/testsuite/gas/riscv/csr-insns-pseudo-noalias.d
index b9300cea6f9f..36a0db4d379e 100644
--- a/gas/testsuite/gas/riscv/csr-insns-pseudo-noalias.d
+++ b/gas/testsuite/gas/riscv/csr-insns-pseudo-noalias.d
@@ -1,5 +1,5 @@
 #source: csr-insns-pseudo.s
-#as: -march=rv32if
+#as: -march=rv32if_zicntr
 #objdump: -dr -Mno-aliases
 
 .*:[ 	]+file format .*
diff --git a/gas/testsuite/gas/riscv/csr-insns-pseudo-nozicntr.d b/gas/testsuite/gas/riscv/csr-insns-pseudo-nozicntr.d
new file mode 100644
index 000000000000..482b62301508
--- /dev/null
+++ b/gas/testsuite/gas/riscv/csr-insns-pseudo-nozicntr.d
@@ -0,0 +1,37 @@
+#source: csr-insns-pseudo.s
+#as: -march=rv32if
+#warning_output: csr-insns-pseudo-nozicntr.l
+#objdump: -dr
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <pseudo_csr_insn>:
+[ 	]+[0-9a-f]+:[ 	]+000022f3[ 	]+csrr[ 	]+t0,ustatus
+[ 	]+[0-9a-f]+:[ 	]+00029073[ 	]+csrw[ 	]+ustatus,t0
+[ 	]+[0-9a-f]+:[ 	]+0002a073[ 	]+csrs[ 	]+ustatus,t0
+[ 	]+[0-9a-f]+:[ 	]+0002b073[ 	]+csrc[ 	]+ustatus,t0
+[ 	]+[0-9a-f]+:[ 	]+000fd073[ 	]+csrwi[ 	]+ustatus,31
+[ 	]+[0-9a-f]+:[ 	]+000fe073[ 	]+csrsi[ 	]+ustatus,31
+[ 	]+[0-9a-f]+:[ 	]+000ff073[ 	]+csrci[ 	]+ustatus,31
+[ 	]+[0-9a-f]+:[ 	]+c00022f3[ 	]+rdcycle[ 	]+t0
+[ 	]+[0-9a-f]+:[ 	]+c01022f3[ 	]+rdtime[ 	]+t0
+[ 	]+[0-9a-f]+:[ 	]+c02022f3[ 	]+rdinstret[ 	]+t0
+[ 	]+[0-9a-f]+:[ 	]+c80022f3[ 	]+rdcycleh[ 	]+t0
+[ 	]+[0-9a-f]+:[ 	]+c81022f3[ 	]+rdtimeh[ 	]+t0
+[ 	]+[0-9a-f]+:[ 	]+c82022f3[ 	]+rdinstreth[ 	]+t0
+[ 	]+[0-9a-f]+:[ 	]+003022f3[ 	]+frcsr[ 	]+t0
+[ 	]+[0-9a-f]+:[ 	]+003392f3[ 	]+fscsr[ 	]+t0,t2
+[ 	]+[0-9a-f]+:[ 	]+00339073[ 	]+fscsr[ 	]+t2
+[ 	]+[0-9a-f]+:[ 	]+002022f3[ 	]+frrm[ 	]+t0
+[ 	]+[0-9a-f]+:[ 	]+002312f3[ 	]+fsrm[ 	]+t0,t1
+[ 	]+[0-9a-f]+:[ 	]+00231073[ 	]+fsrm[ 	]+t1
+[ 	]+[0-9a-f]+:[ 	]+002fd2f3[ 	]+fsrmi[ 	]+t0,31
+[ 	]+[0-9a-f]+:[ 	]+002fd073[ 	]+fsrmi[ 	]+zero,31
+[ 	]+[0-9a-f]+:[ 	]+001022f3[ 	]+frflags[ 	]+t0
+[ 	]+[0-9a-f]+:[ 	]+001312f3[ 	]+fsflags[ 	]+t0,t1
+[ 	]+[0-9a-f]+:[ 	]+00131073[ 	]+fsflags[ 	]+t1
+[ 	]+[0-9a-f]+:[ 	]+001fd2f3[ 	]+fsflagsi[ 	]+t0,31
+[ 	]+[0-9a-f]+:[ 	]+001fd073[ 	]+fsflagsi[ 	]+zero,31
diff --git a/gas/testsuite/gas/riscv/csr-insns-pseudo-nozicntr.l b/gas/testsuite/gas/riscv/csr-insns-pseudo-nozicntr.l
new file mode 100644
index 000000000000..457499f82713
--- /dev/null
+++ b/gas/testsuite/gas/riscv/csr-insns-pseudo-nozicntr.l
@@ -0,0 +1,7 @@
+.*Assembler messages:
+.*Warning: `rdcycle' needs `zicntr' extension
+.*Warning: `rdtime' needs `zicntr' extension
+.*Warning: `rdinstret' needs `zicntr' extension
+.*Warning: `rdcycleh' needs `zicntr' extension
+.*Warning: `rdtimeh' needs `zicntr' extension
+.*Warning: `rdinstreth' needs `zicntr' extension
diff --git a/gas/testsuite/gas/riscv/csr-insns-pseudo-zfinx.d b/gas/testsuite/gas/riscv/csr-insns-pseudo-zfinx.d
index 6e86398cf7b6..52a4f4d8d2ed 100644
--- a/gas/testsuite/gas/riscv/csr-insns-pseudo-zfinx.d
+++ b/gas/testsuite/gas/riscv/csr-insns-pseudo-zfinx.d
@@ -1,5 +1,5 @@
 #source: csr-insns-pseudo.s
-#as: -march=rv32i_zfinx
+#as: -march=rv32i_zicntr_zfinx
 #objdump: -dr
 
 .*:[ 	]+file format .*
diff --git a/gas/testsuite/gas/riscv/csr-insns-pseudo.d b/gas/testsuite/gas/riscv/csr-insns-pseudo.d
index 3df7b4b112af..cdb72152e8c9 100644
--- a/gas/testsuite/gas/riscv/csr-insns-pseudo.d
+++ b/gas/testsuite/gas/riscv/csr-insns-pseudo.d
@@ -1,5 +1,5 @@
 #source: csr-insns-pseudo.s
-#as: -march=rv32if
+#as: -march=rv32if_zicntr
 #objdump: -dr
 
 .*:[ 	]+file format .*
diff --git a/gas/testsuite/gas/riscv/csr-insns-pseudo.s b/gas/testsuite/gas/riscv/csr-insns-pseudo.s
index 8efaa4eadd98..01adff70294a 100644
--- a/gas/testsuite/gas/riscv/csr-insns-pseudo.s
+++ b/gas/testsuite/gas/riscv/csr-insns-pseudo.s
@@ -8,11 +8,12 @@ pseudo_csr_insn:
 	csrsi 0x0, 31
 	csrci 0x0, 31
 
+	# Zicntr
 	rdcycle t0
 	rdtime t0
 	rdinstret t0
 
-	# rv32i-ext
+	# Zicntr (RV32)
 	rdcycleh t0
 	rdtimeh t0
 	rdinstreth t0
diff --git a/gas/testsuite/gas/riscv/csr-insns-read-only.d b/gas/testsuite/gas/riscv/csr-insns-read-only.d
index 6b3549b875ac..1a7e2caddf10 100644
--- a/gas/testsuite/gas/riscv/csr-insns-read-only.d
+++ b/gas/testsuite/gas/riscv/csr-insns-read-only.d
@@ -1,3 +1,3 @@
-#as: -march=rv32if -mcsr-check -mpriv-spec=1.11
+#as: -march=rv32if_zicntr -mcsr-check -mpriv-spec=1.11
 #source: csr-insns-read-only.s
 #warning_output: csr-insns-read-only.l
diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.l b/gas/testsuite/gas/riscv/csr-version-1p10.l
index 054179a416db..d0cc295d3900 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p10.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p10.l
@@ -1,258 +1,514 @@
 .*Assembler messages:
+.*Warning: invalid CSR `cycle', needs `zicntr' extension
+.*Info: macro .*
+.*Warning: invalid CSR `cycle', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw cycle,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `time', needs `zicntr' extension
+.*Info: macro .*
+.*Warning: invalid CSR `time', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw time,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `instret', needs `zicntr' extension
+.*Info: macro .*
+.*Warning: invalid CSR `instret', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw instret,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter3', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter3', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter3,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter4', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter4', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter4,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter5', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter5', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter5,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter6', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter6', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter6,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter7', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter7', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter7,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter8', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter8', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter8,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter9', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter9', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter9,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter10', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter10', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter10,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter11', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter11', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter11,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter12', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter12', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter12,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter13', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter13', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter13,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter14', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter14', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter14,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter15', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter15', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter15,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter16', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter16', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter16,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter17', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter17', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter17,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter18', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter18', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter18,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter19', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter19', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter19,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter20', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter20', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter20,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter21', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter21', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter21,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter22', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter22', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter22,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter23', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter23', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter23,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter24', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter24', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter24,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter25', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter25', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter25,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter26', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter26', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter26,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter27', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter27', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter27,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter28', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter28', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter28,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter29', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter29', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter29,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter30', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter30', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter30,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter31', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter31', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter31,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `cycleh', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `cycleh', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: invalid CSR `cycleh', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `cycleh', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw cycleh,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `timeh', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `timeh', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: invalid CSR `timeh', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `timeh', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw timeh,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `instreth', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `instreth', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: invalid CSR `instreth', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `instreth', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw instreth,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter3h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter3h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter3h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter3h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter3h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter4h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter4h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter4h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter4h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter4h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter5h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter5h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter5h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter5h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter5h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter6h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter6h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter6h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter6h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter6h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter7h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter7h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter7h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter7h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter7h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter8h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter8h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter8h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter8h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter8h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter9h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter9h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter9h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter9h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter9h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter10h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter10h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter10h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter10h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter10h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter11h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter11h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter11h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter11h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter11h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter12h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter12h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter12h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter12h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter12h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter13h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter13h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter13h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter13h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter13h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter14h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter14h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter14h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter14h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter14h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter15h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter15h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter15h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter15h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter15h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter16h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter16h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter16h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter16h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter16h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter17h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter17h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter17h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter17h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter17h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter18h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter18h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter18h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter18h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter18h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter19h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter19h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter19h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter19h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter19h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter20h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter20h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter20h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter20h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter20h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter21h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter21h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter21h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter21h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter21h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter22h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter22h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter22h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter22h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter22h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter23h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter23h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter23h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter23h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter23h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter24h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter24h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter24h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter24h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter24h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter25h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter25h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter25h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter25h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter25h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter26h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter26h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter26h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter26h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter26h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter27h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter27h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter27h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter27h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter27h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter28h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter28h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter28h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter28h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter28h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter29h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter29h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter29h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter29h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter29h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter30h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter30h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter30h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter30h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter30h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter31h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter31h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter31h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter31h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter31h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `senvcfg' for the privileged spec `1.10'
diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.l b/gas/testsuite/gas/riscv/csr-version-1p11.l
index cc365f1df415..4765f61c72b3 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p11.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p11.l
@@ -1,258 +1,514 @@
 .*Assembler messages:
+.*Warning: invalid CSR `cycle', needs `zicntr' extension
+.*Info: macro .*
+.*Warning: invalid CSR `cycle', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw cycle,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `time', needs `zicntr' extension
+.*Info: macro .*
+.*Warning: invalid CSR `time', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw time,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `instret', needs `zicntr' extension
+.*Info: macro .*
+.*Warning: invalid CSR `instret', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw instret,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter3', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter3', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter3,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter4', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter4', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter4,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter5', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter5', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter5,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter6', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter6', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter6,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter7', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter7', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter7,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter8', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter8', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter8,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter9', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter9', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter9,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter10', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter10', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter10,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter11', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter11', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter11,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter12', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter12', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter12,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter13', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter13', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter13,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter14', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter14', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter14,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter15', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter15', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter15,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter16', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter16', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter16,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter17', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter17', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter17,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter18', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter18', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter18,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter19', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter19', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter19,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter20', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter20', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter20,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter21', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter21', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter21,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter22', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter22', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter22,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter23', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter23', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter23,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter24', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter24', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter24,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter25', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter25', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter25,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter26', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter26', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter26,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter27', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter27', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter27,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter28', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter28', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter28,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter29', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter29', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter29,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter30', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter30', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter30,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter31', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter31', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter31,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `cycleh', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `cycleh', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: invalid CSR `cycleh', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `cycleh', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw cycleh,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `timeh', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `timeh', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: invalid CSR `timeh', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `timeh', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw timeh,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `instreth', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `instreth', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: invalid CSR `instreth', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `instreth', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw instreth,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter3h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter3h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter3h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter3h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter3h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter4h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter4h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter4h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter4h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter4h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter5h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter5h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter5h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter5h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter5h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter6h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter6h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter6h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter6h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter6h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter7h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter7h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter7h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter7h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter7h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter8h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter8h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter8h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter8h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter8h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter9h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter9h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter9h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter9h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter9h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter10h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter10h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter10h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter10h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter10h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter11h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter11h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter11h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter11h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter11h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter12h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter12h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter12h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter12h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter12h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter13h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter13h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter13h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter13h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter13h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter14h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter14h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter14h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter14h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter14h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter15h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter15h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter15h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter15h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter15h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter16h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter16h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter16h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter16h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter16h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter17h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter17h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter17h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter17h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter17h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter18h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter18h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter18h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter18h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter18h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter19h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter19h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter19h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter19h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter19h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter20h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter20h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter20h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter20h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter20h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter21h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter21h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter21h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter21h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter21h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter22h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter22h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter22h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter22h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter22h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter23h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter23h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter23h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter23h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter23h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter24h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter24h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter24h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter24h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter24h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter25h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter25h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter25h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter25h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter25h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter26h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter26h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter26h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter26h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter26h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter27h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter27h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter27h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter27h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter27h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter28h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter28h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter28h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter28h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter28h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter29h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter29h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter29h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter29h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter29h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter30h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter30h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter30h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter30h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter30h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter31h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter31h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter31h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter31h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter31h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `senvcfg' for the privileged spec `1.11'
diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.l b/gas/testsuite/gas/riscv/csr-version-1p12.l
index 7a7f5f717c52..c1fe4b062631 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p12.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p12.l
@@ -1,258 +1,514 @@
 .*Assembler messages:
+.*Warning: invalid CSR `cycle', needs `zicntr' extension
+.*Info: macro .*
+.*Warning: invalid CSR `cycle', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw cycle,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `time', needs `zicntr' extension
+.*Info: macro .*
+.*Warning: invalid CSR `time', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw time,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `instret', needs `zicntr' extension
+.*Info: macro .*
+.*Warning: invalid CSR `instret', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw instret,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter3', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter3', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter3,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter4', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter4', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter4,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter5', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter5', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter5,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter6', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter6', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter6,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter7', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter7', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter7,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter8', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter8', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter8,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter9', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter9', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter9,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter10', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter10', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter10,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter11', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter11', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter11,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter12', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter12', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter12,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter13', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter13', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter13,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter14', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter14', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter14,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter15', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter15', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter15,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter16', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter16', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter16,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter17', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter17', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter17,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter18', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter18', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter18,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter19', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter19', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter19,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter20', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter20', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter20,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter21', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter21', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter21,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter22', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter22', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter22,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter23', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter23', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter23,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter24', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter24', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter24,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter25', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter25', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter25,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter26', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter26', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter26,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter27', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter27', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter27,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter28', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter28', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter28,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter29', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter29', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter29,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter30', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter30', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter30,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter31', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter31', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter31,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `cycleh', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `cycleh', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: invalid CSR `cycleh', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `cycleh', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw cycleh,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `timeh', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `timeh', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: invalid CSR `timeh', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `timeh', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw timeh,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `instreth', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `instreth', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: invalid CSR `instreth', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `instreth', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw instreth,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter3h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter3h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter3h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter3h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter3h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter4h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter4h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter4h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter4h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter4h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter5h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter5h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter5h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter5h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter5h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter6h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter6h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter6h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter6h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter6h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter7h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter7h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter7h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter7h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter7h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter8h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter8h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter8h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter8h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter8h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter9h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter9h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter9h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter9h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter9h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter10h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter10h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter10h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter10h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter10h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter11h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter11h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter11h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter11h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter11h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter12h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter12h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter12h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter12h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter12h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter13h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter13h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter13h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter13h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter13h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter14h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter14h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter14h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter14h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter14h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter15h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter15h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter15h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter15h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter15h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter16h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter16h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter16h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter16h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter16h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter17h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter17h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter17h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter17h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter17h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter18h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter18h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter18h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter18h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter18h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter19h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter19h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter19h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter19h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter19h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter20h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter20h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter20h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter20h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter20h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter21h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter21h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter21h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter21h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter21h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter22h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter22h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter22h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter22h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter22h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter23h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter23h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter23h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter23h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter23h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter24h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter24h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter24h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter24h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter24h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter25h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter25h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter25h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter25h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter25h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter26h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter26h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter26h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter26h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter26h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter27h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter27h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter27h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter27h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter27h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter28h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter28h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter28h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter28h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter28h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter29h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter29h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter29h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter29h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter29h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter30h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter30h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter30h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter30h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter30h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter31h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter31h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter31h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter31h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter31h,a1'
 .*Info: macro .*
 .*Warning: read-only CSR is written `csrw mvendorid,a1'
diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.l b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
index 7fcd73ab7ddd..4a42f0d5f272 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p9p1.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
@@ -1,258 +1,514 @@
 .*Assembler messages:
+.*Warning: invalid CSR `cycle', needs `zicntr' extension
+.*Info: macro .*
+.*Warning: invalid CSR `cycle', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw cycle,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `time', needs `zicntr' extension
+.*Info: macro .*
+.*Warning: invalid CSR `time', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw time,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `instret', needs `zicntr' extension
+.*Info: macro .*
+.*Warning: invalid CSR `instret', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw instret,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter3', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter3', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter3,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter4', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter4', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter4,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter5', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter5', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter5,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter6', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter6', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter6,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter7', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter7', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter7,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter8', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter8', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter8,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter9', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter9', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter9,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter10', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter10', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter10,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter11', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter11', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter11,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter12', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter12', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter12,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter13', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter13', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter13,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter14', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter14', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter14,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter15', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter15', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter15,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter16', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter16', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter16,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter17', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter17', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter17,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter18', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter18', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter18,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter19', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter19', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter19,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter20', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter20', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter20,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter21', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter21', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter21,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter22', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter22', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter22,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter23', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter23', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter23,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter24', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter24', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter24,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter25', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter25', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter25,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter26', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter26', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter26,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter27', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter27', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter27,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter28', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter28', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter28,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter29', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter29', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter29,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter30', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter30', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter30,a1'
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter31', needs `zihpm' extension
+.*Info: macro .*
+.*Warning: invalid CSR `hpmcounter31', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter31,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `cycleh', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `cycleh', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: invalid CSR `cycleh', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `cycleh', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw cycleh,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `timeh', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `timeh', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: invalid CSR `timeh', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `timeh', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw timeh,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `instreth', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `instreth', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: invalid CSR `instreth', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `instreth', needs `zicntr' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw instreth,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter3h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter3h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter3h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter3h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter3h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter4h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter4h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter4h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter4h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter4h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter5h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter5h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter5h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter5h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter5h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter6h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter6h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter6h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter6h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter6h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter7h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter7h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter7h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter7h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter7h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter8h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter8h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter8h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter8h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter8h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter9h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter9h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter9h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter9h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter9h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter10h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter10h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter10h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter10h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter10h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter11h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter11h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter11h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter11h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter11h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter12h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter12h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter12h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter12h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter12h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter13h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter13h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter13h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter13h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter13h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter14h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter14h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter14h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter14h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter14h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter15h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter15h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter15h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter15h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter15h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter16h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter16h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter16h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter16h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter16h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter17h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter17h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter17h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter17h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter17h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter18h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter18h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter18h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter18h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter18h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter19h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter19h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter19h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter19h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter19h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter20h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter20h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter20h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter20h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter20h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter21h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter21h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter21h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter21h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter21h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter22h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter22h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter22h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter22h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter22h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter23h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter23h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter23h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter23h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter23h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter24h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter24h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter24h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter24h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter24h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter25h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter25h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter25h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter25h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter25h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter26h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter26h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter26h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter26h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter26h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter27h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter27h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter27h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter27h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter27h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter28h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter28h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter28h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter28h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter28h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter29h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter29h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter29h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter29h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter29h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter30h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter30h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter30h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter30h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter30h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `hpmcounter31h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter31h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: invalid CSR `hpmcounter31h', needs rv32i extension
 .*Info: macro .*
+.*Warning: invalid CSR `hpmcounter31h', needs `zihpm' extension
+.*Info: macro .*
 .*Warning: read-only CSR is written `csrw hpmcounter31h,a1'
 .*Info: macro .*
 .*Warning: invalid CSR `scounteren' for the privileged spec `1.9.1'
diff --git a/include/opcode/riscv-opc.h b/include/opcode/riscv-opc.h
index 375483500e2a..dbb061ddf7f9 100644
--- a/include/opcode/riscv-opc.h
+++ b/include/opcode/riscv-opc.h
@@ -3558,70 +3558,70 @@ DECLARE_INSN(vt_maskcn, MATCH_VT_MASKCN, MASK_VT_MASKCN)
 #endif /* DECLARE_INSN */
 #ifdef DECLARE_CSR
 /* Unprivileged Counter/Timers CSRs.  */
-DECLARE_CSR(cycle, CSR_CYCLE, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(time, CSR_TIME, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(instret, CSR_INSTRET, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter3, CSR_HPMCOUNTER3, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter4, CSR_HPMCOUNTER4, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter5, CSR_HPMCOUNTER5, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter6, CSR_HPMCOUNTER6, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter7, CSR_HPMCOUNTER7, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter8, CSR_HPMCOUNTER8, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter9, CSR_HPMCOUNTER9, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter10, CSR_HPMCOUNTER10, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter11, CSR_HPMCOUNTER11, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter12, CSR_HPMCOUNTER12, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter13, CSR_HPMCOUNTER13, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter14, CSR_HPMCOUNTER14, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter15, CSR_HPMCOUNTER15, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter16, CSR_HPMCOUNTER16, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter17, CSR_HPMCOUNTER17, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter18, CSR_HPMCOUNTER18, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter19, CSR_HPMCOUNTER19, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter20, CSR_HPMCOUNTER20, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter21, CSR_HPMCOUNTER21, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter22, CSR_HPMCOUNTER22, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter23, CSR_HPMCOUNTER23, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter24, CSR_HPMCOUNTER24, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter25, CSR_HPMCOUNTER25, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter26, CSR_HPMCOUNTER26, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter27, CSR_HPMCOUNTER27, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter28, CSR_HPMCOUNTER28, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter29, CSR_HPMCOUNTER29, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter30, CSR_HPMCOUNTER30, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter31, CSR_HPMCOUNTER31, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(cycleh, CSR_CYCLEH, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(timeh, CSR_TIMEH, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(instreth, CSR_INSTRETH, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter3h, CSR_HPMCOUNTER3H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter4h, CSR_HPMCOUNTER4H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter5h, CSR_HPMCOUNTER5H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter6h, CSR_HPMCOUNTER6H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter7h, CSR_HPMCOUNTER7H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter8h, CSR_HPMCOUNTER8H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter9h, CSR_HPMCOUNTER9H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter10h, CSR_HPMCOUNTER10H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter11h, CSR_HPMCOUNTER11H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter12h, CSR_HPMCOUNTER12H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter13h, CSR_HPMCOUNTER13H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter14h, CSR_HPMCOUNTER14H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter15h, CSR_HPMCOUNTER15H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter16h, CSR_HPMCOUNTER16H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter17h, CSR_HPMCOUNTER17H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter18h, CSR_HPMCOUNTER18H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter19h, CSR_HPMCOUNTER19H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter20h, CSR_HPMCOUNTER20H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter21h, CSR_HPMCOUNTER21H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter22h, CSR_HPMCOUNTER22H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter23h, CSR_HPMCOUNTER23H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter24h, CSR_HPMCOUNTER24H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter25h, CSR_HPMCOUNTER25H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter26h, CSR_HPMCOUNTER26H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter27h, CSR_HPMCOUNTER27H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter28h, CSR_HPMCOUNTER28H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter29h, CSR_HPMCOUNTER29H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter30h, CSR_HPMCOUNTER30H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
-DECLARE_CSR(hpmcounter31h, CSR_HPMCOUNTER31H, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(cycle, CSR_CYCLE, CSR_CLASS_ZICNTR, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(time, CSR_TIME, CSR_CLASS_ZICNTR, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(instret, CSR_INSTRET, CSR_CLASS_ZICNTR, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter3, CSR_HPMCOUNTER3, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter4, CSR_HPMCOUNTER4, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter5, CSR_HPMCOUNTER5, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter6, CSR_HPMCOUNTER6, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter7, CSR_HPMCOUNTER7, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter8, CSR_HPMCOUNTER8, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter9, CSR_HPMCOUNTER9, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter10, CSR_HPMCOUNTER10, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter11, CSR_HPMCOUNTER11, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter12, CSR_HPMCOUNTER12, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter13, CSR_HPMCOUNTER13, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter14, CSR_HPMCOUNTER14, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter15, CSR_HPMCOUNTER15, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter16, CSR_HPMCOUNTER16, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter17, CSR_HPMCOUNTER17, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter18, CSR_HPMCOUNTER18, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter19, CSR_HPMCOUNTER19, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter20, CSR_HPMCOUNTER20, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter21, CSR_HPMCOUNTER21, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter22, CSR_HPMCOUNTER22, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter23, CSR_HPMCOUNTER23, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter24, CSR_HPMCOUNTER24, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter25, CSR_HPMCOUNTER25, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter26, CSR_HPMCOUNTER26, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter27, CSR_HPMCOUNTER27, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter28, CSR_HPMCOUNTER28, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter29, CSR_HPMCOUNTER29, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter30, CSR_HPMCOUNTER30, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter31, CSR_HPMCOUNTER31, CSR_CLASS_ZIHPM, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(cycleh, CSR_CYCLEH, CSR_CLASS_ZICNTR_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(timeh, CSR_TIMEH, CSR_CLASS_ZICNTR_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(instreth, CSR_INSTRETH, CSR_CLASS_ZICNTR_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter3h, CSR_HPMCOUNTER3H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter4h, CSR_HPMCOUNTER4H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter5h, CSR_HPMCOUNTER5H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter6h, CSR_HPMCOUNTER6H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter7h, CSR_HPMCOUNTER7H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter8h, CSR_HPMCOUNTER8H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter9h, CSR_HPMCOUNTER9H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter10h, CSR_HPMCOUNTER10H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter11h, CSR_HPMCOUNTER11H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter12h, CSR_HPMCOUNTER12H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter13h, CSR_HPMCOUNTER13H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter14h, CSR_HPMCOUNTER14H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter15h, CSR_HPMCOUNTER15H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter16h, CSR_HPMCOUNTER16H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter17h, CSR_HPMCOUNTER17H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter18h, CSR_HPMCOUNTER18H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter19h, CSR_HPMCOUNTER19H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter20h, CSR_HPMCOUNTER20H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter21h, CSR_HPMCOUNTER21H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter22h, CSR_HPMCOUNTER22H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter23h, CSR_HPMCOUNTER23H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter24h, CSR_HPMCOUNTER24H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter25h, CSR_HPMCOUNTER25H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter26h, CSR_HPMCOUNTER26H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter27h, CSR_HPMCOUNTER27H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter28h, CSR_HPMCOUNTER28H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter29h, CSR_HPMCOUNTER29H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter30h, CSR_HPMCOUNTER30H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hpmcounter31h, CSR_HPMCOUNTER31H, CSR_CLASS_ZIHPM_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
 /* Privileged Supervisor CSRs.  */
 DECLARE_CSR(sstatus, CSR_SSTATUS, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
 DECLARE_CSR(sie, CSR_SIE, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT)
diff --git a/include/opcode/riscv.h b/include/opcode/riscv.h
index 93dd5169ebce..847a5a04f5ae 100644
--- a/include/opcode/riscv.h
+++ b/include/opcode/riscv.h
@@ -389,6 +389,7 @@ enum riscv_insn_class
   INSN_CLASS_Q,
   INSN_CLASS_F_AND_C,
   INSN_CLASS_D_AND_C,
+  INSN_CLASS_ZICNTR,
   INSN_CLASS_ZICOND,
   INSN_CLASS_ZICSR,
   INSN_CLASS_ZIFENCEI,
diff --git a/opcodes/riscv-opc.c b/opcodes/riscv-opc.c
index 8e0ae85eb064..5da55ab9e322 100644
--- a/opcodes/riscv-opc.c
+++ b/opcodes/riscv-opc.c
@@ -510,12 +510,12 @@ const struct riscv_opcode riscv_opcodes[] =
 {"fence",       0, INSN_CLASS_I, "P,Q",       MATCH_FENCE, MASK_FENCE|MASK_RD|MASK_RS1|(MASK_IMM & ~MASK_PRED & ~MASK_SUCC), match_opcode, 0 },
 {"fence.i",     0, INSN_CLASS_ZIFENCEI, "",   MATCH_FENCE_I, MASK_FENCE|MASK_RD|MASK_RS1|MASK_IMM, match_opcode, 0 },
 {"fence.tso",   0, INSN_CLASS_I, "",          MATCH_FENCE_TSO, MASK_FENCE_TSO|MASK_RD|MASK_RS1, match_opcode, 0 },
-{"rdcycle",     0, INSN_CLASS_I, "d",         MATCH_RDCYCLE, MASK_RDCYCLE, match_opcode, INSN_ALIAS },
-{"rdinstret",   0, INSN_CLASS_I, "d",         MATCH_RDINSTRET, MASK_RDINSTRET, match_opcode, INSN_ALIAS },
-{"rdtime",      0, INSN_CLASS_I, "d",         MATCH_RDTIME, MASK_RDTIME, match_opcode, INSN_ALIAS },
-{"rdcycleh",   32, INSN_CLASS_I, "d",         MATCH_RDCYCLEH, MASK_RDCYCLEH, match_opcode, INSN_ALIAS },
-{"rdinstreth", 32, INSN_CLASS_I, "d",         MATCH_RDINSTRETH, MASK_RDINSTRETH, match_opcode, INSN_ALIAS },
-{"rdtimeh",    32, INSN_CLASS_I, "d",         MATCH_RDTIMEH, MASK_RDTIMEH, match_opcode, INSN_ALIAS },
+{"rdcycle",     0, INSN_CLASS_ZICNTR, "d",    MATCH_RDCYCLE, MASK_RDCYCLE, match_opcode, INSN_ALIAS },
+{"rdinstret",   0, INSN_CLASS_ZICNTR, "d",    MATCH_RDINSTRET, MASK_RDINSTRET, match_opcode, INSN_ALIAS },
+{"rdtime",      0, INSN_CLASS_ZICNTR, "d",    MATCH_RDTIME, MASK_RDTIME, match_opcode, INSN_ALIAS },
+{"rdcycleh",   32, INSN_CLASS_ZICNTR, "d",    MATCH_RDCYCLEH, MASK_RDCYCLEH, match_opcode, INSN_ALIAS },
+{"rdinstreth", 32, INSN_CLASS_ZICNTR, "d",    MATCH_RDINSTRETH, MASK_RDINSTRETH, match_opcode, INSN_ALIAS },
+{"rdtimeh",    32, INSN_CLASS_ZICNTR, "d",    MATCH_RDTIMEH, MASK_RDTIMEH, match_opcode, INSN_ALIAS },
 {"ecall",       0, INSN_CLASS_I, "",          MATCH_SCALL, MASK_SCALL, match_opcode, 0 },
 {"scall",       0, INSN_CLASS_I, "",          MATCH_SCALL, MASK_SCALL, match_opcode, 0 },
 {"xori",        0, INSN_CLASS_I, "d,s,j",     MATCH_XORI, MASK_XORI, match_opcode, 0 },
