diff --git a/gas/testsuite/gas/riscv/k-ext-64.d b/gas/testsuite/gas/riscv/k-ext-64.d
deleted file mode 100644
index d56e0354a37..00000000000
--- a/gas/testsuite/gas/riscv/k-ext-64.d
+++ /dev/null
@@ -1,47 +0,0 @@
-#as: -march=rv64i_zbkb_zbkc_zbkx_zknd_zkne_zknh_zkr_zksed_zksh_zkt
-#source: k-ext-64.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+60c5d533[ 	]+ror[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+60c59533[ 	]+rol[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+6025d513[ 	]+ror[ 	]+a0,a1,0x2
-[ 	]+[0-9a-f]+:[ 	]+60c5d53b[ 	]+rorw[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+60c5953b[ 	]+rolw[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+6025d51b[ 	]+rorw[ 	]+a0,a1,0x2
-[ 	]+[0-9a-f]+:[ 	]+40c5f533[ 	]+andn[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+40c5e533[ 	]+orn[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+40c5c533[ 	]+xnor[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+08c5c533[ 	]+pack[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+08c5f533[ 	]+packh[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+08c5c53b[ 	]+packw[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+68755513[ 	]+brev8[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+6b855513[ 	]+rev8[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+0ac59533[ 	]+clmul[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+0ac5b533[ 	]+clmulh[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+28c5a533[ 	]+xperm4[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+28c5c533[ 	]+xperm8[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+3ac58533[ 	]+aes64ds[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+3ec58533[ 	]+aes64dsm[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+30051513[ 	]+aes64im[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+31459513[ 	]+aes64ks1i[ 	]+a0,a1,0x4
-[ 	]+[0-9a-f]+:[ 	]+7ec58533[ 	]+aes64ks2[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+32c58533[ 	]+aes64es[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+36c58533[ 	]+aes64esm[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+10251513[ 	]+sha256sig0[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10351513[ 	]+sha256sig1[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10051513[ 	]+sha256sum0[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10151513[ 	]+sha256sum1[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10651513[ 	]+sha512sig0[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10751513[ 	]+sha512sig1[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10451513[ 	]+sha512sum0[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10551513[ 	]+sha512sum1[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+b0c58533[ 	]+sm4ed[ 	]+a0,a1,a2,0x2
-[ 	]+[0-9a-f]+:[ 	]+b4c58533[ 	]+sm4ks[ 	]+a0,a1,a2,0x2
-[ 	]+[0-9a-f]+:[ 	]+10851513[ 	]+sm3p0[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10951513[ 	]+sm3p1[ 	]+a0,a0
diff --git a/gas/testsuite/gas/riscv/k-ext-64.s b/gas/testsuite/gas/riscv/k-ext-64.s
deleted file mode 100644
index 302b82ea005..00000000000
--- a/gas/testsuite/gas/riscv/k-ext-64.s
+++ /dev/null
@@ -1,38 +0,0 @@
-target:
-        ror     a0, a1, a2
-        rol     a0, a1, a2
-        rori    a0, a1, 2
-        rorw    a0, a1, a2
-        rolw    a0, a1, a2
-        roriw   a0, a1, 2
-        andn    a0, a1, a2
-        orn     a0, a1, a2
-        xnor    a0, a1, a2
-        pack    a0, a1, a2
-        packh   a0, a1, a2
-        packw   a0, a1, a2
-        brev8   a0, a0
-        rev8    a0, a0
-        clmul   a0, a1, a2
-        clmulh  a0, a1, a2
-        xperm4  a0, a1, a2
-        xperm8  a0, a1, a2
-        aes64ds     a0, a1, a2
-        aes64dsm    a0, a1, a2
-        aes64im     a0, a0
-        aes64ks1i   a0, a1, 4
-        aes64ks2    a0, a1, a2
-        aes64es     a0, a1, a2
-        aes64esm    a0, a1, a2
-        sha256sig0  a0, a0
-        sha256sig1  a0, a0
-        sha256sum0  a0, a0
-        sha256sum1  a0, a0
-        sha512sig0  a0, a0
-        sha512sig1  a0, a0
-        sha512sum0  a0, a0
-        sha512sum1  a0, a0
-        sm4ed   a0, a1, a2, 2
-        sm4ks   a0, a1, a2, 2
-        sm3p0   a0, a0
-        sm3p1   a0, a0
diff --git a/gas/testsuite/gas/riscv/k-ext.d b/gas/testsuite/gas/riscv/k-ext.d
deleted file mode 100644
index b00a1c959c2..00000000000
--- a/gas/testsuite/gas/riscv/k-ext.d
+++ /dev/null
@@ -1,44 +0,0 @@
-#as: -march=rv32i_zbkb_zbkc_zbkx_zknd_zkne_zknh_zkr_zksed_zksh_zkt
-#source: k-ext.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+60c5d533[ 	]+ror[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+60c59533[ 	]+rol[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+6025d513[ 	]+ror[ 	]+a0,a1,0x2
-[ 	]+[0-9a-f]+:[ 	]+40c5f533[ 	]+andn[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+40c5e533[ 	]+orn[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+40c5c533[ 	]+xnor[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+08c5c533[ 	]+pack[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+08c5f533[ 	]+packh[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+68755513[ 	]+brev8[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+69855513[ 	]+rev8[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+08f51513[ 	]+zip[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+08f55513[ 	]+unzip[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+0ac59533[ 	]+clmul[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+0ac5b533[ 	]+clmulh[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+28c5a533[ 	]+xperm4[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+28c5c533[ 	]+xperm8[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+aac58533[ 	]+aes32dsi[ 	]+a0,a1,a2,0x2
-[ 	]+[0-9a-f]+:[ 	]+aec58533[ 	]+aes32dsmi[ 	]+a0,a1,a2,0x2
-[ 	]+[0-9a-f]+:[ 	]+a2c58533[ 	]+aes32esi[ 	]+a0,a1,a2,0x2
-[ 	]+[0-9a-f]+:[ 	]+a6c58533[ 	]+aes32esmi[ 	]+a0,a1,a2,0x2
-[ 	]+[0-9a-f]+:[ 	]+10251513[ 	]+sha256sig0[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10351513[ 	]+sha256sig1[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10051513[ 	]+sha256sum0[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10151513[ 	]+sha256sum1[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+5cc58533[ 	]+sha512sig0h[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+54c58533[ 	]+sha512sig0l[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+5ec58533[ 	]+sha512sig1h[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+56c58533[ 	]+sha512sig1l[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+50c58533[ 	]+sha512sum0r[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+52c58533[ 	]+sha512sum1r[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+b0c58533[ 	]+sm4ed[ 	]+a0,a1,a2,0x2
-[ 	]+[0-9a-f]+:[ 	]+b4c58533[ 	]+sm4ks[ 	]+a0,a1,a2,0x2
-[ 	]+[0-9a-f]+:[ 	]+10851513[ 	]+sm3p0[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10951513[ 	]+sm3p1[ 	]+a0,a0
diff --git a/gas/testsuite/gas/riscv/k-ext.s b/gas/testsuite/gas/riscv/k-ext.s
deleted file mode 100644
index 8eb27684710..00000000000
--- a/gas/testsuite/gas/riscv/k-ext.s
+++ /dev/null
@@ -1,35 +0,0 @@
-target:
-        ror     a0, a1, a2
-        rol     a0, a1, a2
-        rori    a0, a1, 2
-        andn    a0, a1, a2
-        orn     a0, a1, a2
-        xnor    a0, a1, a2
-        pack    a0, a1, a2
-        packh   a0, a1, a2
-        brev8   a0, a0
-        rev8    a0, a0
-        zip     a0, a0
-        unzip   a0, a0
-        clmul   a0, a1, a2
-        clmulh  a0, a1, a2
-        xperm4  a0, a1, a2
-        xperm8  a0, a1, a2
-        aes32dsi    a0, a1, a2, 2
-        aes32dsmi   a0, a1, a2, 2
-        aes32esi    a0, a1, a2, 2
-        aes32esmi   a0, a1, a2, 2
-        sha256sig0  a0, a0
-        sha256sig1  a0, a0
-        sha256sum0  a0, a0
-        sha256sum1  a0, a0
-        sha512sig0h    a0, a1, a2
-        sha512sig0l    a0, a1, a2
-        sha512sig1h    a0, a1, a2
-        sha512sig1l    a0, a1, a2
-        sha512sum0r    a0, a1, a2
-        sha512sum1r    a0, a1, a2
-        sm4ed   a0, a1, a2, 2
-        sm4ks   a0, a1, a2, 2
-        sm3p0   a0, a0
-        sm3p1   a0, a0
diff --git a/gas/testsuite/gas/riscv/zbk-ext-32-noalias.d b/gas/testsuite/gas/riscv/zbk-ext-32-noalias.d
new file mode 100644
index 00000000000..bbbd0caefc2
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zbk-ext-32-noalias.d
@@ -0,0 +1,26 @@
+#as: -march=rv32i -I$srcdir/$subdir -defsym XLEN=32
+#source: zbk-ext.s
+#objdump: -d -M no-aliases
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+[0-9a-f]+:[ 	]+60c5d533[ 	]+ror[ 		]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+60c59533[ 	]+rol[ 		]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+6025d513[ 	]+rori[ 	]+a0,a1,0x2
+[ 	]+[0-9a-f]+:[ 	]+40c5f533[ 	]+andn[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+40c5e533[ 	]+orn[ 		]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+40c5c533[ 	]+xnor[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+08c5c533[ 	]+pack[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+08c5f533[ 	]+packh[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+6875d513[ 	]+brev8[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+6985d513[ 	]+rev8[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+08f59513[ 	]+zip[ 		]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+08f5d513[ 	]+unzip[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+0ac59533[ 	]+clmul[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+0ac5b533[ 	]+clmulh[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+28c5a533[ 	]+xperm4[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+28c5c533[ 	]+xperm8[ 	]+a0,a1,a2
diff --git a/gas/testsuite/gas/riscv/zbk-ext-32-noarch.d b/gas/testsuite/gas/riscv/zbk-ext-32-noarch.d
new file mode 100644
index 00000000000..be2c8bd653b
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zbk-ext-32-noarch.d
@@ -0,0 +1,3 @@
+#as: -march=rv32i -I$srcdir/$subdir -defsym XLEN=32 -defsym NOARCH=1
+#source: zbk-ext.s
+#error_output: zbk-ext-32-noarch.l
diff --git a/gas/testsuite/gas/riscv/zbk-ext-32-noarch.l b/gas/testsuite/gas/riscv/zbk-ext-32-noarch.l
new file mode 100644
index 00000000000..0a9c603e7db
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zbk-ext-32-noarch.l
@@ -0,0 +1,21 @@
+.*: Assembler messages:
+.*: Error: unrecognized opcode `ror a0,a1,a2', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `rol a0,a1,a2', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `rori a0,a1,2', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `rorw a0,a1,a2'
+.*: Error: unrecognized opcode `rolw a0,a1,a2'
+.*: Error: unrecognized opcode `roriw a0,a1,2'
+.*: Error: unrecognized opcode `andn a0,a1,a2', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `orn a0,a1,a2', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `xnor a0,a1,a2', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `pack a0,a1,a2', extension `zbkb' required
+.*: Error: unrecognized opcode `packh a0,a1,a2', extension `zbkb' required
+.*: Error: unrecognized opcode `packw a0,a1,a2'
+.*: Error: unrecognized opcode `brev8 a0,a1', extension `zbkb' required
+.*: Error: unrecognized opcode `rev8 a0,a1', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `zip a0,a1', extension `zbkb' required
+.*: Error: unrecognized opcode `unzip a0,a1', extension `zbkb' required
+.*: Error: unrecognized opcode `clmul a0,a1,a2', extension `zbc' or `zbkc' required
+.*: Error: unrecognized opcode `clmulh a0,a1,a2', extension `zbc' or `zbkc' required
+.*: Error: unrecognized opcode `xperm4 a0,a1,a2', extension `zbkx' required
+.*: Error: unrecognized opcode `xperm8 a0,a1,a2', extension `zbkx' required
diff --git a/gas/testsuite/gas/riscv/zbk-ext-32.d b/gas/testsuite/gas/riscv/zbk-ext-32.d
new file mode 100644
index 00000000000..05c6fddaef4
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zbk-ext-32.d
@@ -0,0 +1,26 @@
+#as: -march=rv32i -I$srcdir/$subdir -defsym XLEN=32
+#source: zbk-ext.s
+#objdump: -d
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+[0-9a-f]+:[ 	]+60c5d533[ 	]+ror[ 		]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+60c59533[ 	]+rol[ 		]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+6025d513[ 	]+ror[ 		]+a0,a1,0x2
+[ 	]+[0-9a-f]+:[ 	]+40c5f533[ 	]+andn[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+40c5e533[ 	]+orn[ 		]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+40c5c533[ 	]+xnor[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+08c5c533[ 	]+pack[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+08c5f533[ 	]+packh[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+6875d513[ 	]+brev8[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+6985d513[ 	]+rev8[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+08f59513[ 	]+zip[ 		]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+08f5d513[ 	]+unzip[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+0ac59533[ 	]+clmul[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+0ac5b533[ 	]+clmulh[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+28c5a533[ 	]+xperm4[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+28c5c533[ 	]+xperm8[ 	]+a0,a1,a2
diff --git a/gas/testsuite/gas/riscv/zbk-ext-64-noalias.d b/gas/testsuite/gas/riscv/zbk-ext-64-noalias.d
new file mode 100644
index 00000000000..03ee8c809b0
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zbk-ext-64-noalias.d
@@ -0,0 +1,28 @@
+#as: -march=rv64i -I$srcdir/$subdir -defsym XLEN=64
+#source: zbk-ext.s
+#objdump: -d -M no-aliases
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+[0-9a-f]+:[ 	]+60c5d533[ 	]+ror[ 		]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+60c59533[ 	]+rol[ 		]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+6025d513[ 	]+rori[ 	]+a0,a1,0x2
+[ 	]+[0-9a-f]+:[ 	]+60c5d53b[ 	]+rorw[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+60c5953b[ 	]+rolw[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+6025d51b[ 	]+roriw[ 	]+a0,a1,0x2
+[ 	]+[0-9a-f]+:[ 	]+40c5f533[ 	]+andn[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+40c5e533[ 	]+orn[ 		]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+40c5c533[ 	]+xnor[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+08c5c533[ 	]+pack[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+08c5f533[ 	]+packh[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+08c5c53b[ 	]+packw[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+6875d513[ 	]+brev8[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+6b85d513[ 	]+rev8[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+0ac59533[ 	]+clmul[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+0ac5b533[ 	]+clmulh[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+28c5a533[ 	]+xperm4[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+28c5c533[ 	]+xperm8[ 	]+a0,a1,a2
diff --git a/gas/testsuite/gas/riscv/zbk-ext-64-noarch.d b/gas/testsuite/gas/riscv/zbk-ext-64-noarch.d
new file mode 100644
index 00000000000..de1c854b808
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zbk-ext-64-noarch.d
@@ -0,0 +1,3 @@
+#as: -march=rv64i -I$srcdir/$subdir -defsym XLEN=64 -defsym NOARCH=1
+#source: zbk-ext.s
+#error_output: zbk-ext-64-noarch.l
diff --git a/gas/testsuite/gas/riscv/zbk-ext-64-noarch.l b/gas/testsuite/gas/riscv/zbk-ext-64-noarch.l
new file mode 100644
index 00000000000..e0759ac4b7a
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zbk-ext-64-noarch.l
@@ -0,0 +1,21 @@
+.*: Assembler messages:
+.*: Error: unrecognized opcode `ror a0,a1,a2', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `rol a0,a1,a2', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `rori a0,a1,2', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `rorw a0,a1,a2', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `rolw a0,a1,a2', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `roriw a0,a1,2', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `andn a0,a1,a2', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `orn a0,a1,a2', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `xnor a0,a1,a2', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `pack a0,a1,a2', extension `zbkb' required
+.*: Error: unrecognized opcode `packh a0,a1,a2', extension `zbkb' required
+.*: Error: unrecognized opcode `packw a0,a1,a2', extension `zbkb' required
+.*: Error: unrecognized opcode `brev8 a0,a1', extension `zbkb' required
+.*: Error: unrecognized opcode `rev8 a0,a1', extension `zbb' or `zbkb' required
+.*: Error: unrecognized opcode `zip a0,a1'
+.*: Error: unrecognized opcode `unzip a0,a1'
+.*: Error: unrecognized opcode `clmul a0,a1,a2', extension `zbc' or `zbkc' required
+.*: Error: unrecognized opcode `clmulh a0,a1,a2', extension `zbc' or `zbkc' required
+.*: Error: unrecognized opcode `xperm4 a0,a1,a2', extension `zbkx' required
+.*: Error: unrecognized opcode `xperm8 a0,a1,a2', extension `zbkx' required
diff --git a/gas/testsuite/gas/riscv/zbk-ext-64.d b/gas/testsuite/gas/riscv/zbk-ext-64.d
new file mode 100644
index 00000000000..2c2a0098cac
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zbk-ext-64.d
@@ -0,0 +1,28 @@
+#as: -march=rv64i -I$srcdir/$subdir -defsym XLEN=64
+#source: zbk-ext.s
+#objdump: -d
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+[0-9a-f]+:[ 	]+60c5d533[ 	]+ror[ 		]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+60c59533[ 	]+rol[ 		]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+6025d513[ 	]+ror[ 		]+a0,a1,0x2
+[ 	]+[0-9a-f]+:[ 	]+60c5d53b[ 	]+rorw[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+60c5953b[ 	]+rolw[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+6025d51b[ 	]+rorw[ 	]+a0,a1,0x2
+[ 	]+[0-9a-f]+:[ 	]+40c5f533[ 	]+andn[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+40c5e533[ 	]+orn[ 		]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+40c5c533[ 	]+xnor[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+08c5c533[ 	]+pack[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+08c5f533[ 	]+packh[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+08c5c53b[ 	]+packw[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+6875d513[ 	]+brev8[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+6b85d513[ 	]+rev8[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+0ac59533[ 	]+clmul[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+0ac5b533[ 	]+clmulh[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+28c5a533[ 	]+xperm4[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+28c5c533[ 	]+xperm8[ 	]+a0,a1,a2
diff --git a/gas/testsuite/gas/riscv/zbk-ext.s b/gas/testsuite/gas/riscv/zbk-ext.s
new file mode 100644
index 00000000000..d839513d592
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zbk-ext.s
@@ -0,0 +1,37 @@
+.include "testutils.inc"
+
+target:
+	SET_ARCH_START	+zbkb
+	ror	a0, a1, a2
+	rol	a0, a1, a2
+	rori	a0, a1, 2
+.if	XLEN_GE_64
+	rorw	a0, a1, a2
+	rolw	a0, a1, a2
+	roriw	a0, a1, 2
+.endif
+	andn	a0, a1, a2
+	orn	a0, a1, a2
+	xnor	a0, a1, a2
+	pack	a0, a1, a2
+	packh	a0, a1, a2
+.if	XLEN_GE_64
+	packw	a0, a1, a2
+.endif
+	brev8	a0, a1
+	rev8	a0, a1
+.if	XLEN_EQ_32
+	zip	a0, a1
+	unzip	a0, a1
+.endif
+	SET_ARCH_END
+
+	SET_ARCH_START	+zbkc
+	clmul	a0, a1, a2
+	clmulh	a0, a1, a2
+	SET_ARCH_END
+
+	SET_ARCH_START	+zbkx
+	xperm4	a0, a1, a2
+	xperm8	a0, a1, a2
+	SET_ARCH_END
diff --git a/gas/testsuite/gas/riscv/zbkb-32-na.d b/gas/testsuite/gas/riscv/zbkb-32-na.d
deleted file mode 100644
index a7b67ca4468..00000000000
--- a/gas/testsuite/gas/riscv/zbkb-32-na.d
+++ /dev/null
@@ -1,23 +0,0 @@
-#as: -march=rv32i_zbkb
-#source: zbkb-32.s
-#objdump: -d -Mno-aliases
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+60c5d533[ 	]+ror[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+60c59533[ 	]+rol[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+6025d513[ 	]+rori[ 	]+a0,a1,0x2
-[ 	]+[0-9a-f]+:[ 	]+40c5f533[ 	]+andn[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+40c5e533[ 	]+orn[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+40c5c533[ 	]+xnor[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+08c5c533[ 	]+pack[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+08c5f533[ 	]+packh[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+68755513[ 	]+brev8[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+69855513[ 	]+rev8[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+08f51513[ 	]+zip[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+08f55513[ 	]+unzip[ 	]+a0,a0
-#pass
diff --git a/gas/testsuite/gas/riscv/zbkb-32.d b/gas/testsuite/gas/riscv/zbkb-32.d
deleted file mode 100644
index 1ab233c7778..00000000000
--- a/gas/testsuite/gas/riscv/zbkb-32.d
+++ /dev/null
@@ -1,22 +0,0 @@
-#as: -march=rv32i_zbkb
-#source: zbkb-32.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+60c5d533[ 	]+ror[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+60c59533[ 	]+rol[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+6025d513[ 	]+ror[ 	]+a0,a1,0x2
-[ 	]+[0-9a-f]+:[ 	]+40c5f533[ 	]+andn[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+40c5e533[ 	]+orn[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+40c5c533[ 	]+xnor[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+08c5c533[ 	]+pack[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+08c5f533[ 	]+packh[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+68755513[ 	]+brev8[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+69855513[ 	]+rev8[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+08f51513[ 	]+zip[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+08f55513[ 	]+unzip[ 	]+a0,a0
diff --git a/gas/testsuite/gas/riscv/zbkb-32.s b/gas/testsuite/gas/riscv/zbkb-32.s
deleted file mode 100644
index 6f917154517..00000000000
--- a/gas/testsuite/gas/riscv/zbkb-32.s
+++ /dev/null
@@ -1,13 +0,0 @@
-target:
-        ror     a0, a1, a2
-        rol     a0, a1, a2
-        rori    a0, a1, 2
-        andn    a0, a1, a2
-        orn     a0, a1, a2
-        xnor    a0, a1, a2
-        pack    a0, a1, a2
-        packh   a0, a1, a2
-        brev8   a0, a0
-        rev8    a0, a0
-        zip     a0, a0
-        unzip     a0, a0
diff --git a/gas/testsuite/gas/riscv/zbkb-64.d b/gas/testsuite/gas/riscv/zbkb-64.d
deleted file mode 100644
index e942bc6f1f0..00000000000
--- a/gas/testsuite/gas/riscv/zbkb-64.d
+++ /dev/null
@@ -1,24 +0,0 @@
-#as: -march=rv64i_zbkb
-#source: zbkb-64.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+60c5d533[ 	]+ror[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+60c59533[ 	]+rol[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+6025d513[ 	]+ror[ 	]+a0,a1,0x2
-[ 	]+[0-9a-f]+:[ 	]+60c5d53b[ 	]+rorw[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+60c5953b[ 	]+rolw[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+6025d51b[ 	]+rorw[ 	]+a0,a1,0x2
-[ 	]+[0-9a-f]+:[ 	]+40c5f533[ 	]+andn[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+40c5e533[ 	]+orn[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+40c5c533[ 	]+xnor[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+08c5c533[ 	]+pack[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+08c5f533[ 	]+packh[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+08c5c53b[ 	]+packw[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+68755513[ 	]+brev8[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+6b855513[ 	]+rev8[ 	]+a0,a0
diff --git a/gas/testsuite/gas/riscv/zbkb-64.s b/gas/testsuite/gas/riscv/zbkb-64.s
deleted file mode 100644
index b5cf79f890e..00000000000
--- a/gas/testsuite/gas/riscv/zbkb-64.s
+++ /dev/null
@@ -1,15 +0,0 @@
-target:
-        ror     a0, a1, a2
-        rol     a0, a1, a2
-        rori    a0, a1, 2
-        rorw    a0, a1, a2
-        rolw    a0, a1, a2
-        roriw   a0, a1, 2
-        andn    a0, a1, a2
-        orn     a0, a1, a2
-        xnor    a0, a1, a2
-        pack    a0, a1, a2
-        packh   a0, a1, a2
-        packw   a0, a1, a2
-        brev8   a0, a0
-        rev8    a0, a0
diff --git a/gas/testsuite/gas/riscv/zbkc-32.d b/gas/testsuite/gas/riscv/zbkc-32.d
deleted file mode 100644
index 69d89875652..00000000000
--- a/gas/testsuite/gas/riscv/zbkc-32.d
+++ /dev/null
@@ -1,12 +0,0 @@
-#as: -march=rv32i_zbkc
-#source: zbkc.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+0ac59533[ 	]+clmul[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+0ac5b533[ 	]+clmulh[ 	]+a0,a1,a2
diff --git a/gas/testsuite/gas/riscv/zbkc-64.d b/gas/testsuite/gas/riscv/zbkc-64.d
deleted file mode 100644
index 26cdf7014c9..00000000000
--- a/gas/testsuite/gas/riscv/zbkc-64.d
+++ /dev/null
@@ -1,12 +0,0 @@
-#as: -march=rv64i_zbkc
-#source: zbkc.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+0ac59533[ 	]+clmul[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+0ac5b533[ 	]+clmulh[ 	]+a0,a1,a2
diff --git a/gas/testsuite/gas/riscv/zbkc.s b/gas/testsuite/gas/riscv/zbkc.s
deleted file mode 100644
index 2a987746e7b..00000000000
--- a/gas/testsuite/gas/riscv/zbkc.s
+++ /dev/null
@@ -1,3 +0,0 @@
-target:
-        clmul   a0, a1, a2
-        clmulh  a0, a1, a2
diff --git a/gas/testsuite/gas/riscv/zbkx-32.d b/gas/testsuite/gas/riscv/zbkx-32.d
deleted file mode 100644
index b1f7fc017bf..00000000000
--- a/gas/testsuite/gas/riscv/zbkx-32.d
+++ /dev/null
@@ -1,12 +0,0 @@
-#as: -march=rv32i_zbkx
-#source: zbkx.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+28c5a533[ 	]+xperm4[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+28c5c533[ 	]+xperm8[ 	]+a0,a1,a2
diff --git a/gas/testsuite/gas/riscv/zbkx-64.d b/gas/testsuite/gas/riscv/zbkx-64.d
deleted file mode 100644
index 3ab8bf69c75..00000000000
--- a/gas/testsuite/gas/riscv/zbkx-64.d
+++ /dev/null
@@ -1,12 +0,0 @@
-#as: -march=rv64i_zbkx
-#source: zbkx.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+28c5a533[ 	]+xperm4[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+28c5c533[ 	]+xperm8[ 	]+a0,a1,a2
diff --git a/gas/testsuite/gas/riscv/zbkx.s b/gas/testsuite/gas/riscv/zbkx.s
deleted file mode 100644
index 8c3077105fe..00000000000
--- a/gas/testsuite/gas/riscv/zbkx.s
+++ /dev/null
@@ -1,3 +0,0 @@
-target:
-        xperm4  a0, a1, a2
-        xperm8  a0, a1, a2
diff --git a/gas/testsuite/gas/riscv/zk-ext-32-noarch.d b/gas/testsuite/gas/riscv/zk-ext-32-noarch.d
new file mode 100644
index 00000000000..7a489dedbac
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zk-ext-32-noarch.d
@@ -0,0 +1,3 @@
+#as: -march=rv32i -mcsr-check -I$srcdir/$subdir -defsym NOARCH=1
+#source: zk-ext-32.s
+#error_output: zk-ext-32-noarch.l
diff --git a/gas/testsuite/gas/riscv/zk-ext-32-noarch.l b/gas/testsuite/gas/riscv/zk-ext-32-noarch.l
new file mode 100644
index 00000000000..372dc523276
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zk-ext-32-noarch.l
@@ -0,0 +1,20 @@
+.*: Assembler messages:
+.*: Error: unrecognized opcode `aes32dsi a0,a1,a2,2', extension `zknd' required
+.*: Error: unrecognized opcode `aes32dsmi a0,a1,a2,2', extension `zknd' required
+.*: Error: unrecognized opcode `aes32esi a0,a1,a2,2', extension `zkne' required
+.*: Error: unrecognized opcode `aes32esmi a0,a1,a2,2', extension `zkne' required
+.*: Error: unrecognized opcode `sha256sig0 a0,a1', extension `zknh' required
+.*: Error: unrecognized opcode `sha256sig1 a0,a1', extension `zknh' required
+.*: Error: unrecognized opcode `sha256sum0 a0,a1', extension `zknh' required
+.*: Error: unrecognized opcode `sha256sum1 a0,a1', extension `zknh' required
+.*: Error: unrecognized opcode `sha512sig0h a0,a1,a2', extension `zknh' required
+.*: Error: unrecognized opcode `sha512sig0l a0,a1,a2', extension `zknh' required
+.*: Error: unrecognized opcode `sha512sig1h a0,a1,a2', extension `zknh' required
+.*: Error: unrecognized opcode `sha512sig1l a0,a1,a2', extension `zknh' required
+.*: Error: unrecognized opcode `sha512sum0r a0,a1,a2', extension `zknh' required
+.*: Error: unrecognized opcode `sha512sum1r a0,a1,a2', extension `zknh' required
+.*: Error: unrecognized opcode `sm4ed a0,a1,a2,2', extension `zksed' required
+.*: Error: unrecognized opcode `sm4ks a0,a1,a2,2', extension `zksed' required
+.*: Error: unrecognized opcode `sm3p0 a0,a1', extension `zksh' required
+.*: Error: unrecognized opcode `sm3p1 a0,a1', extension `zksh' required
+.*: Warning: invalid CSR `seed', needs `zkr' extension
diff --git a/gas/testsuite/gas/riscv/zk-ext-32.d b/gas/testsuite/gas/riscv/zk-ext-32.d
new file mode 100644
index 00000000000..03cd158ab43
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zk-ext-32.d
@@ -0,0 +1,28 @@
+#as: -march=rv32i -mcsr-check -I$srcdir/$subdir
+#objdump: -d
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+[0-9a-f]+:[ 	]+aac58533[ 	]+aes32dsi[ 	]+a0,a1,a2,0x2
+[ 	]+[0-9a-f]+:[ 	]+aec58533[ 	]+aes32dsmi[ 	]+a0,a1,a2,0x2
+[ 	]+[0-9a-f]+:[ 	]+a2c58533[ 	]+aes32esi[ 	]+a0,a1,a2,0x2
+[ 	]+[0-9a-f]+:[ 	]+a6c58533[ 	]+aes32esmi[ 	]+a0,a1,a2,0x2
+[ 	]+[0-9a-f]+:[ 	]+10259513[ 	]+sha256sig0[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+10359513[ 	]+sha256sig1[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+10059513[ 	]+sha256sum0[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+10159513[ 	]+sha256sum1[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+5cc58533[ 	]+sha512sig0h[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+54c58533[ 	]+sha512sig0l[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+5ec58533[ 	]+sha512sig1h[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+56c58533[ 	]+sha512sig1l[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+50c58533[ 	]+sha512sum0r[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+52c58533[ 	]+sha512sum1r[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+b0c58533[ 	]+sm4ed[ 	]+a0,a1,a2,0x2
+[ 	]+[0-9a-f]+:[ 	]+b4c58533[ 	]+sm4ks[ 	]+a0,a1,a2,0x2
+[ 	]+[0-9a-f]+:[ 	]+10859513[ 	]+sm3p0[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+10959513[ 	]+sm3p1[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+01502573[ 	]+csrr[ 	]+a0,seed
diff --git a/gas/testsuite/gas/riscv/zk-ext-32.s b/gas/testsuite/gas/riscv/zk-ext-32.s
new file mode 100644
index 00000000000..892644c054a
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zk-ext-32.s
@@ -0,0 +1,41 @@
+.include "testutils.inc"
+
+target:
+	SET_ARCH_START	+zknd
+	aes32dsi	a0, a1, a2, 2
+	aes32dsmi	a0, a1, a2, 2
+	SET_ARCH_END
+
+	SET_ARCH_START	+zkne
+	aes32esi	a0, a1, a2, 2
+	aes32esmi	a0, a1, a2, 2
+	SET_ARCH_END
+
+	SET_ARCH_START	+zknh
+	sha256sig0	a0, a1
+	sha256sig1	a0, a1
+	sha256sum0	a0, a1
+	sha256sum1	a0, a1
+	sha512sig0h	a0, a1, a2
+	sha512sig0l	a0, a1, a2
+	sha512sig1h	a0, a1, a2
+	sha512sig1l	a0, a1, a2
+	sha512sum0r	a0, a1, a2
+	sha512sum1r	a0, a1, a2
+	SET_ARCH_END
+
+	SET_ARCH_START	+zksed
+	sm4ed		a0, a1, a2, 2
+	sm4ks		a0, a1, a2, 2
+	SET_ARCH_END
+
+	SET_ARCH_START	+zksh
+	sm3p0		a0, a1
+	sm3p1		a0, a1
+	SET_ARCH_END
+
+	SET_ARCH_START_FORCE	+zicsr
+	SET_ARCH_START		+zkr
+	csrr		a0, seed
+	SET_ARCH_END
+	SET_ARCH_END
diff --git a/gas/testsuite/gas/riscv/zk-ext-64-noarch.d b/gas/testsuite/gas/riscv/zk-ext-64-noarch.d
new file mode 100644
index 00000000000..e83e4b17a81
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zk-ext-64-noarch.d
@@ -0,0 +1,3 @@
+#as: -march=rv64i -mcsr-check -I$srcdir/$subdir -defsym NOARCH=1
+#source: zk-ext-64.s
+#error_output: zk-ext-64-noarch.l
diff --git a/gas/testsuite/gas/riscv/zk-ext-64-noarch.l b/gas/testsuite/gas/riscv/zk-ext-64-noarch.l
new file mode 100644
index 00000000000..38362f54465
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zk-ext-64-noarch.l
@@ -0,0 +1,23 @@
+.*: Assembler messages:
+.*: Error: unrecognized opcode `aes64ds a0,a1,a2', extension `zknd' required
+.*: Error: unrecognized opcode `aes64dsm a0,a1,a2', extension `zknd' required
+.*: Error: unrecognized opcode `aes64im a0,a1', extension `zknd' required
+.*: Error: unrecognized opcode `aes64ks1i a0,a1,4', extension `zknd' or `zkne' required
+.*: Error: unrecognized opcode `aes64ks2 a0,a1,a2', extension `zknd' or `zkne' required
+.*: Error: unrecognized opcode `aes64es a0,a1,a2', extension `zkne' required
+.*: Error: unrecognized opcode `aes64esm a0,a1,a2', extension `zkne' required
+.*: Error: unrecognized opcode `aes64ks1i a0,a1,4', extension `zknd' or `zkne' required
+.*: Error: unrecognized opcode `aes64ks2 a0,a1,a2', extension `zknd' or `zkne' required
+.*: Error: unrecognized opcode `sha256sig0 a0,a1', extension `zknh' required
+.*: Error: unrecognized opcode `sha256sig1 a0,a1', extension `zknh' required
+.*: Error: unrecognized opcode `sha256sum0 a0,a1', extension `zknh' required
+.*: Error: unrecognized opcode `sha256sum1 a0,a1', extension `zknh' required
+.*: Error: unrecognized opcode `sha512sig0 a0,a1', extension `zknh' required
+.*: Error: unrecognized opcode `sha512sig1 a0,a1', extension `zknh' required
+.*: Error: unrecognized opcode `sha512sum0 a0,a1', extension `zknh' required
+.*: Error: unrecognized opcode `sha512sum1 a0,a1', extension `zknh' required
+.*: Error: unrecognized opcode `sm4ed a0,a1,a2,2', extension `zksed' required
+.*: Error: unrecognized opcode `sm4ks a0,a1,a2,2', extension `zksed' required
+.*: Error: unrecognized opcode `sm3p0 a0,a1', extension `zksh' required
+.*: Error: unrecognized opcode `sm3p1 a0,a1', extension `zksh' required
+.*: Warning: invalid CSR `seed', needs `zkr' extension
diff --git a/gas/testsuite/gas/riscv/zk-ext-64.d b/gas/testsuite/gas/riscv/zk-ext-64.d
new file mode 100644
index 00000000000..ee134f6cdf0
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zk-ext-64.d
@@ -0,0 +1,31 @@
+#as: -march=rv64i -mcsr-check -I$srcdir/$subdir
+#objdump: -d
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+[0-9a-f]+:[ 	]+3ac58533[ 	]+aes64ds[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+3ec58533[ 	]+aes64dsm[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+30059513[ 	]+aes64im[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+31459513[ 	]+aes64ks1i[ 	]+a0,a1,0x4
+[ 	]+[0-9a-f]+:[ 	]+7ec58533[ 	]+aes64ks2[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+32c58533[ 	]+aes64es[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+36c58533[ 	]+aes64esm[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+31459513[ 	]+aes64ks1i[ 	]+a0,a1,0x4
+[ 	]+[0-9a-f]+:[ 	]+7ec58533[ 	]+aes64ks2[ 	]+a0,a1,a2
+[ 	]+[0-9a-f]+:[ 	]+10259513[ 	]+sha256sig0[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+10359513[ 	]+sha256sig1[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+10059513[ 	]+sha256sum0[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+10159513[ 	]+sha256sum1[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+10659513[ 	]+sha512sig0[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+10759513[ 	]+sha512sig1[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+10459513[ 	]+sha512sum0[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+10559513[ 	]+sha512sum1[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+b0c58533[ 	]+sm4ed[ 	]+a0,a1,a2,0x2
+[ 	]+[0-9a-f]+:[ 	]+b4c58533[ 	]+sm4ks[ 	]+a0,a1,a2,0x2
+[ 	]+[0-9a-f]+:[ 	]+10859513[ 	]+sm3p0[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+10959513[ 	]+sm3p1[ 	]+a0,a1
+[ 	]+[0-9a-f]+:[ 	]+01502573[ 	]+csrr[ 	]+a0,seed
diff --git a/gas/testsuite/gas/riscv/zk-ext-64.s b/gas/testsuite/gas/riscv/zk-ext-64.s
new file mode 100644
index 00000000000..9d8104908a9
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zk-ext-64.s
@@ -0,0 +1,44 @@
+.include "testutils.inc"
+
+target:
+	SET_ARCH_START	+zknd
+	aes64ds		a0, a1, a2
+	aes64dsm	a0, a1, a2
+	aes64im		a0, a1
+	aes64ks1i	a0, a1, 4
+	aes64ks2	a0, a1, a2
+	SET_ARCH_END
+
+	SET_ARCH_START	+zkne
+	aes64es		a0, a1, a2
+	aes64esm	a0, a1, a2
+	aes64ks1i	a0, a1, 4
+	aes64ks2	a0, a1, a2
+	SET_ARCH_END
+
+	SET_ARCH_START	+zknh
+	sha256sig0	a0, a1
+	sha256sig1	a0, a1
+	sha256sum0	a0, a1
+	sha256sum1	a0, a1
+	sha512sig0	a0, a1
+	sha512sig1	a0, a1
+	sha512sum0	a0, a1
+	sha512sum1	a0, a1
+	SET_ARCH_END
+
+	SET_ARCH_START	+zksed
+	sm4ed		a0, a1, a2, 2
+	sm4ks		a0, a1, a2, 2
+	SET_ARCH_END
+
+	SET_ARCH_START	+zksh
+	sm3p0		a0, a1
+	sm3p1		a0, a1
+	SET_ARCH_END
+
+	SET_ARCH_START_FORCE	+zicsr
+	SET_ARCH_START		+zkr
+	csrr		a0, seed
+	SET_ARCH_END
+	SET_ARCH_END
diff --git a/gas/testsuite/gas/riscv/zknd-32.d b/gas/testsuite/gas/riscv/zknd-32.d
deleted file mode 100644
index a6995bf6f1c..00000000000
--- a/gas/testsuite/gas/riscv/zknd-32.d
+++ /dev/null
@@ -1,12 +0,0 @@
-#as: -march=rv32i_zknd
-#source: zknd-32.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+aac58533[ 	]+aes32dsi[ 	]+a0,a1,a2,0x2
-[ 	]+[0-9a-f]+:[ 	]+aec58533[ 	]+aes32dsmi[ 	]+a0,a1,a2,0x2
diff --git a/gas/testsuite/gas/riscv/zknd-32.s b/gas/testsuite/gas/riscv/zknd-32.s
deleted file mode 100644
index 0d09badd1c6..00000000000
--- a/gas/testsuite/gas/riscv/zknd-32.s
+++ /dev/null
@@ -1,3 +0,0 @@
-target:
-        aes32dsi    a0, a1, a2, 2
-        aes32dsmi   a0, a1, a2, 2
diff --git a/gas/testsuite/gas/riscv/zknd-64.d b/gas/testsuite/gas/riscv/zknd-64.d
deleted file mode 100644
index ba4c91ceb34..00000000000
--- a/gas/testsuite/gas/riscv/zknd-64.d
+++ /dev/null
@@ -1,15 +0,0 @@
-#as: -march=rv64i_zknd
-#source: zknd-64.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+3ac58533[ 	]+aes64ds[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+3ec58533[ 	]+aes64dsm[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+30051513[ 	]+aes64im[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+31459513[ 	]+aes64ks1i[ 	]+a0,a1,0x4
-[ 	]+[0-9a-f]+:[ 	]+7ec58533[ 	]+aes64ks2[ 	]+a0,a1,a2
diff --git a/gas/testsuite/gas/riscv/zknd-64.s b/gas/testsuite/gas/riscv/zknd-64.s
deleted file mode 100644
index 4846e93c16f..00000000000
--- a/gas/testsuite/gas/riscv/zknd-64.s
+++ /dev/null
@@ -1,6 +0,0 @@
-target:
-        aes64ds     a0, a1, a2
-        aes64dsm    a0, a1, a2
-        aes64im     a0, a0
-        aes64ks1i   a0, a1, 4
-        aes64ks2    a0, a1, a2
diff --git a/gas/testsuite/gas/riscv/zkne-32.d b/gas/testsuite/gas/riscv/zkne-32.d
deleted file mode 100644
index 4950e748800..00000000000
--- a/gas/testsuite/gas/riscv/zkne-32.d
+++ /dev/null
@@ -1,12 +0,0 @@
-#as: -march=rv32i_zkne
-#source: zkne-32.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+a2c58533[ 	]+aes32esi[ 	]+a0,a1,a2,0x2
-[ 	]+[0-9a-f]+:[ 	]+a6c58533[ 	]+aes32esmi[ 	]+a0,a1,a2,0x2
diff --git a/gas/testsuite/gas/riscv/zkne-32.s b/gas/testsuite/gas/riscv/zkne-32.s
deleted file mode 100644
index f864fc1778b..00000000000
--- a/gas/testsuite/gas/riscv/zkne-32.s
+++ /dev/null
@@ -1,3 +0,0 @@
-target:
-        aes32esi    a0, a1, a2, 2
-        aes32esmi   a0, a1, a2, 2
diff --git a/gas/testsuite/gas/riscv/zkne-64.d b/gas/testsuite/gas/riscv/zkne-64.d
deleted file mode 100644
index 31bc084a807..00000000000
--- a/gas/testsuite/gas/riscv/zkne-64.d
+++ /dev/null
@@ -1,14 +0,0 @@
-#as: -march=rv64i_zkne
-#source: zkne-64.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+32c58533[ 	]+aes64es[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+36c58533[ 	]+aes64esm[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+31459513[ 	]+aes64ks1i[ 	]+a0,a1,0x4
-[ 	]+[0-9a-f]+:[ 	]+7ec58533[ 	]+aes64ks2[ 	]+a0,a1,a2
diff --git a/gas/testsuite/gas/riscv/zkne-64.s b/gas/testsuite/gas/riscv/zkne-64.s
deleted file mode 100644
index 9b5612001af..00000000000
--- a/gas/testsuite/gas/riscv/zkne-64.s
+++ /dev/null
@@ -1,5 +0,0 @@
-target:
-        aes64es     a0, a1, a2
-        aes64esm    a0, a1, a2
-        aes64ks1i   a0, a1, 4
-        aes64ks2    a0, a1, a2
diff --git a/gas/testsuite/gas/riscv/zknh-32.d b/gas/testsuite/gas/riscv/zknh-32.d
deleted file mode 100644
index c8ef70d67f4..00000000000
--- a/gas/testsuite/gas/riscv/zknh-32.d
+++ /dev/null
@@ -1,20 +0,0 @@
-#as: -march=rv32i_zknh
-#source: zknh-32.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+10251513[ 	]+sha256sig0[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10351513[ 	]+sha256sig1[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10051513[ 	]+sha256sum0[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10151513[ 	]+sha256sum1[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+5cc58533[ 	]+sha512sig0h[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+54c58533[ 	]+sha512sig0l[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+5ec58533[ 	]+sha512sig1h[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+56c58533[ 	]+sha512sig1l[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+50c58533[ 	]+sha512sum0r[ 	]+a0,a1,a2
-[ 	]+[0-9a-f]+:[ 	]+52c58533[ 	]+sha512sum1r[ 	]+a0,a1,a2
diff --git a/gas/testsuite/gas/riscv/zknh-32.s b/gas/testsuite/gas/riscv/zknh-32.s
deleted file mode 100644
index dc2cd3c6657..00000000000
--- a/gas/testsuite/gas/riscv/zknh-32.s
+++ /dev/null
@@ -1,11 +0,0 @@
-target:
-        sha256sig0  a0, a0
-        sha256sig1  a0, a0
-        sha256sum0  a0, a0
-        sha256sum1  a0, a0
-        sha512sig0h    a0, a1, a2
-        sha512sig0l    a0, a1, a2
-        sha512sig1h    a0, a1, a2
-        sha512sig1l    a0, a1, a2
-        sha512sum0r    a0, a1, a2
-        sha512sum1r    a0, a1, a2
diff --git a/gas/testsuite/gas/riscv/zknh-64.d b/gas/testsuite/gas/riscv/zknh-64.d
deleted file mode 100644
index b72e31e3547..00000000000
--- a/gas/testsuite/gas/riscv/zknh-64.d
+++ /dev/null
@@ -1,18 +0,0 @@
-#as: -march=rv64i_zknh
-#source: zknh-64.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+10251513[ 	]+sha256sig0[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10351513[ 	]+sha256sig1[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10051513[ 	]+sha256sum0[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10151513[ 	]+sha256sum1[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10651513[ 	]+sha512sig0[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10751513[ 	]+sha512sig1[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10451513[ 	]+sha512sum0[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10551513[ 	]+sha512sum1[ 	]+a0,a0
diff --git a/gas/testsuite/gas/riscv/zknh-64.s b/gas/testsuite/gas/riscv/zknh-64.s
deleted file mode 100644
index 897dc0ba32e..00000000000
--- a/gas/testsuite/gas/riscv/zknh-64.s
+++ /dev/null
@@ -1,9 +0,0 @@
-target:
-        sha256sig0  a0, a0
-        sha256sig1  a0, a0
-        sha256sum0  a0, a0
-        sha256sum1  a0, a0
-        sha512sig0  a0, a0
-        sha512sig1  a0, a0
-        sha512sum0  a0, a0
-        sha512sum1  a0, a0
diff --git a/gas/testsuite/gas/riscv/zksed-32.d b/gas/testsuite/gas/riscv/zksed-32.d
deleted file mode 100644
index 3c84c0f31ce..00000000000
--- a/gas/testsuite/gas/riscv/zksed-32.d
+++ /dev/null
@@ -1,12 +0,0 @@
-#as: -march=rv32i_zksed
-#source: zksed.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+b0c58533[ 	]+sm4ed[ 	]+a0,a1,a2,0x2
-[ 	]+[0-9a-f]+:[ 	]+b4c58533[ 	]+sm4ks[ 	]+a0,a1,a2,0x2
diff --git a/gas/testsuite/gas/riscv/zksed-64.d b/gas/testsuite/gas/riscv/zksed-64.d
deleted file mode 100644
index 29d828a9009..00000000000
--- a/gas/testsuite/gas/riscv/zksed-64.d
+++ /dev/null
@@ -1,12 +0,0 @@
-#as: -march=rv64i_zksed
-#source: zksed.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+b0c58533[ 	]+sm4ed[ 	]+a0,a1,a2,0x2
-[ 	]+[0-9a-f]+:[ 	]+b4c58533[ 	]+sm4ks[ 	]+a0,a1,a2,0x2
diff --git a/gas/testsuite/gas/riscv/zksed.s b/gas/testsuite/gas/riscv/zksed.s
deleted file mode 100644
index ee95c7a8584..00000000000
--- a/gas/testsuite/gas/riscv/zksed.s
+++ /dev/null
@@ -1,3 +0,0 @@
-target:
-        sm4ed   a0, a1, a2, 2
-        sm4ks   a0, a1, a2, 2
diff --git a/gas/testsuite/gas/riscv/zksh-32.d b/gas/testsuite/gas/riscv/zksh-32.d
deleted file mode 100644
index 14ac63d95e6..00000000000
--- a/gas/testsuite/gas/riscv/zksh-32.d
+++ /dev/null
@@ -1,12 +0,0 @@
-#as: -march=rv32i_zksh
-#source: zksh.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+10851513[ 	]+sm3p0[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10951513[ 	]+sm3p1[ 	]+a0,a0
diff --git a/gas/testsuite/gas/riscv/zksh-64.d b/gas/testsuite/gas/riscv/zksh-64.d
deleted file mode 100644
index 2d13e38dd37..00000000000
--- a/gas/testsuite/gas/riscv/zksh-64.d
+++ /dev/null
@@ -1,12 +0,0 @@
-#as: -march=rv64i_zksh
-#source: zksh.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+[0-9a-f]+:[ 	]+10851513[ 	]+sm3p0[ 	]+a0,a0
-[ 	]+[0-9a-f]+:[ 	]+10951513[ 	]+sm3p1[ 	]+a0,a0
diff --git a/gas/testsuite/gas/riscv/zksh.s b/gas/testsuite/gas/riscv/zksh.s
deleted file mode 100644
index b321c26f2b2..00000000000
--- a/gas/testsuite/gas/riscv/zksh.s
+++ /dev/null
@@ -1,3 +0,0 @@
-target:
-        sm3p0   a0, a0
-        sm3p1   a0, a0
diff --git a/gas/testsuite/gas/riscv/zkt.d b/gas/testsuite/gas/riscv/zkt.d
new file mode 100644
index 00000000000..feca41b64fa
--- /dev/null
+++ b/gas/testsuite/gas/riscv/zkt.d
@@ -0,0 +1,5 @@
+#as: -march=rv32i_zkt
+#source: empty.s
+#objdump: -d
+
+#...
