diff --git a/gas/testsuite/gas/riscv/ext-32.d b/gas/testsuite/gas/riscv/ext-32.d
deleted file mode 100644
index 97daa31d0e9..00000000000
--- a/gas/testsuite/gas/riscv/ext-32.d
+++ /dev/null
@@ -1,39 +0,0 @@
-#as: -march=rv32i
-#source: ext.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+0:[ 	]+0ff57513[ 	]+zext.b[ 	]+a0,a0
-[ 	]+4:[ 	]+01051513[ 	]+sll[ 	]+a0,a0,0x10
-[ 	]+8:[ 	]+01055513[ 	]+srl[ 	]+a0,a0,0x10
-[ 	]+c:[ 	]+01851513[ 	]+sll[ 	]+a0,a0,0x18
-[ 	]+10:[ 	]+41855513[ 	]+sra[ 	]+a0,a0,0x18
-[ 	]+14:[ 	]+01051513[ 	]+sll[ 	]+a0,a0,0x10
-[ 	]+18:[ 	]+41055513[ 	]+sra[ 	]+a0,a0,0x10
-[ 	]+1c:[ 	]+0ff67593[ 	]+zext.b[ 	]+a1,a2
-[ 	]+20:[ 	]+01061593[ 	]+sll[ 	]+a1,a2,0x10
-[ 	]+24:[ 	]+0105d593[ 	]+srl[ 	]+a1,a1,0x10
-[ 	]+28:[ 	]+01861593[ 	]+sll[ 	]+a1,a2,0x18
-[ 	]+2c:[ 	]+4185d593[ 	]+sra[ 	]+a1,a1,0x18
-[ 	]+30:[ 	]+01061593[ 	]+sll[ 	]+a1,a2,0x10
-[ 	]+34:[ 	]+4105d593[ 	]+sra[ 	]+a1,a1,0x10
-[ 	]+38:[ 	]+0ff57513[ 	]+zext.b[ 	]+a0,a0
-[ 	]+3c:[ 	]+0542[ 	]+sll[ 	]+a0,a0,0x10
-[ 	]+3e:[ 	]+8141[ 	]+srl[ 	]+a0,a0,0x10
-[ 	]+40:[ 	]+0562[ 	]+sll[ 	]+a0,a0,0x18
-[ 	]+42:[ 	]+8561[ 	]+sra[ 	]+a0,a0,0x18
-[ 	]+44:[ 	]+0542[ 	]+sll[ 	]+a0,a0,0x10
-[ 	]+46:[ 	]+8541[ 	]+sra[ 	]+a0,a0,0x10
-[ 	]+48:[ 	]+0ff67593[ 	]+zext.b[ 	]+a1,a2
-[ 	]+4c:[ 	]+01061593[ 	]+sll[ 	]+a1,a2,0x10
-[ 	]+50:[ 	]+81c1[ 	]+srl[ 	]+a1,a1,0x10
-[ 	]+52:[ 	]+01861593[ 	]+sll[ 	]+a1,a2,0x18
-[ 	]+56:[ 	]+85e1[ 	]+sra[ 	]+a1,a1,0x18
-[ 	]+58:[ 	]+01061593[ 	]+sll[ 	]+a1,a2,0x10
-[ 	]+5c:[ 	]+85c1[ 	]+sra[ 	]+a1,a1,0x10
-#...
diff --git a/gas/testsuite/gas/riscv/ext-64.d b/gas/testsuite/gas/riscv/ext-64.d
deleted file mode 100644
index 1fe339c4af4..00000000000
--- a/gas/testsuite/gas/riscv/ext-64.d
+++ /dev/null
@@ -1,51 +0,0 @@
-#as: -march=rv64i -defsym __64_bit__=1
-#source: ext.s
-#objdump: -d
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+0:[ 	]+0ff57513[ 	]+zext.b[ 	]+a0,a0
-[ 	]+4:[ 	]+03051513[ 	]+sll[ 	]+a0,a0,0x30
-[ 	]+8:[ 	]+03055513[ 	]+srl[ 	]+a0,a0,0x30
-[ 	]+c:[ 	]+03851513[ 	]+sll[ 	]+a0,a0,0x38
-[ 	]+10:[ 	]+43855513[ 	]+sra[ 	]+a0,a0,0x38
-[ 	]+14:[ 	]+03051513[ 	]+sll[ 	]+a0,a0,0x30
-[ 	]+18:[ 	]+43055513[ 	]+sra[ 	]+a0,a0,0x30
-[ 	]+1c:[ 	]+0ff67593[ 	]+zext.b[ 	]+a1,a2
-[ 	]+20:[ 	]+03061593[ 	]+sll[ 	]+a1,a2,0x30
-[ 	]+24:[ 	]+0305d593[ 	]+srl[ 	]+a1,a1,0x30
-[ 	]+28:[ 	]+03861593[ 	]+s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x20
-[ 	]+78:[ 	]+9101[ 	]+srl[ 	]+a0,a0,0x20
-[ 	]+7a:[ 	]+2501[ 	]+sext.w[ 	]+a0,a0
-[ 	]+7c:[ 	]+02061593[ 	]+sll[ 	]+a1,a2,0x20
-[ 	]+80:[ 	]+9181[ 	]+srl[ 	]+a1,a1,0x20
-[ 	]+82:[ 	]+0006059b[ 	]+sext.w[ 	]+a1,a2
-#...
diff --git a/gas/testsuite/gas/riscv/ext-insn-32-noalias.d b/gas/testsuite/gas/riscv/ext-insn-32-noalias.d
new file mode 100644
index 00000000000..237fcf033d0
--- /dev/null
+++ b/gas/testsuite/gas/riscv/ext-insn-32-noalias.d
@@ -0,0 +1,39 @@
+#as: -march=rv32i -I$srcdir/$subdir -defsym XLEN=32
+#source: ext-insn.s
+#objdump: -d -M no-aliases
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+[0-9a-f]+:[ 	]+0ff57513[ 	]+andi[ 	]+a0,a0,255
+[ 	]+[0-9a-f]+:[ 	]+01051513[ 	]+slli[ 	]+a0,a0,0x10
+[ 	]+[0-9a-f]+:[ 	]+01055513[ 	]+srli[ 	]+a0,a0,0x10
+[ 	]+[0-9a-f]+:[ 	]+01851513[ 	]+slli[ 	]+a0,a0,0x18
+[ 	]+[0-9a-f]+:[ 	]+41855513[ 	]+srai[ 	]+a0,a0,0x18
+[ 	]+[0-9a-f]+:[ 	]+01051513[ 	]+slli[ 	]+a0,a0,0x10
+[ 	]+[0-9a-f]+:[ 	]+41055513[ 	]+srai[ 	]+a0,a0,0x10
+[ 	]+[0-9a-f]+:[ 	]+0ff67593[ 	]+andi[ 	]+a1,a2,255
+[ 	]+[0-9a-f]+:[ 	]+01061593[ 	]+slli[ 	]+a1,a2,0x10
+[ 	]+[0-9a-f]+:[ 	]+0105d593[ 	]+srli[ 	]+a1,a1,0x10
+[ 	]+[0-9a-f]+:[ 	]+01861593[ 	]+slli[ 	]+a1,a2,0x18
+[ 	]+[0-9a-f]+:[ 	]+4185d593[ 	]+srai[ 	]+a1,a1,0x18
+[ 	]+[0-9a-f]+:[ 	]+01061593[ 	]+slli[ 	]+a1,a2,0x10
+[ 	]+[0-9a-f]+:[ 	]+4105d593[ 	]+srai[ 	]+a1,a1,0x10
+[ 	]+[0-9a-f]+:[ 	]+0ff57513[ 	]+andi[ 	]+a0,a0,255
+[ 	]+[0-9a-f]+:[ 	]+0542[ 	]+c\.slli[ 	]+a0,0x10
+[ 	]+[0-9a-f]+:[ 	]+8141[ 	]+c\.srli[ 	]+a0,0x10
+[ 	]+[0-9a-f]+:[ 	]+0562[ 	]+c\.slli[ 	]+a0,0x18
+[ 	]+[0-9a-f]+:[ 	]+8561[ 	]+c\.srai[ 	]+a0,0x18
+[ 	]+[0-9a-f]+:[ 	]+0542[ 	]+c\.slli[ 	]+a0,0x10
+[ 	]+[0-9a-f]+:[ 	]+8541[ 	]+c\.srai[ 	]+a0,0x10
+[ 	]+[0-9a-f]+:[ 	]+0ff67593[ 	]+andi[ 	]+a1,a2,255
+[ 	]+[0-9a-f]+:[ 	]+01061593[ 	]+slli[ 	]+a1,a2,0x10
+[ 	]+[0-9a-f]+:[ 	]+81c1[ 	]+c\.srli[ 	]+a1,0x10
+[ 	]+[0-9a-f]+:[ 	]+01861593[ 	]+slli[ 	]+a1,a2,0x18
+[ 	]+[0-9a-f]+:[ 	]+85e1[ 	]+c\.srai[ 	]+a1,0x18
+[ 	]+[0-9a-f]+:[ 	]+01061593[ 	]+slli[ 	]+a1,a2,0x10
+[ 	]+[0-9a-f]+:[ 	]+85c1[ 	]+c\.srai[ 	]+a1,0x10
+#...
diff --git a/gas/testsuite/gas/riscv/ext-insn-32-noarch.d b/gas/testsuite/gas/riscv/ext-insn-32-noarch.d
new file mode 100644
index 00000000000..7a2f4ddfec2
--- /dev/null
+++ b/gas/testsuite/gas/riscv/ext-insn-32-noarch.d
@@ -0,0 +1,3 @@
+#as: -march=rv32i -I$srcdir/$subdir -defsym XLEN=32 -defsym NOARCH=1
+#source: ext-insn.s
+#error_output: ext-insn-32-noarch.l
diff --git a/gas/testsuite/gas/riscv/ext-insn-32-noarch.l b/gas/testsuite/gas/riscv/ext-insn-32-noarch.l
new file mode 100644
index 00000000000..f5954f207f0
--- /dev/null
+++ b/gas/testsuite/gas/riscv/ext-insn-32-noarch.l
@@ -0,0 +1,9 @@
+.*: Assembler messages:
+.*: Error: unrecognized opcode `zext.w a0,a0'
+.*: Error: unrecognized opcode `sext.w a0,a0'
+.*: Error: unrecognized opcode `zext.w a1,a2'
+.*: Error: unrecognized opcode `sext.w a1,a2'
+.*: Error: unrecognized opcode `zext.w a0,a0'
+.*: Error: unrecognized opcode `sext.w a0,a0'
+.*: Error: unrecognized opcode `zext.w a1,a2'
+.*: Error: unrecognized opcode `sext.w a1,a2'
diff --git a/gas/testsuite/gas/riscv/ext-insn-64-noalias.d b/gas/testsuite/gas/riscv/ext-insn-64-noalias.d
new file mode 100644
index 00000000000..9a273eea0d7
--- /dev/null
+++ b/gas/testsuite/gas/riscv/ext-insn-64-noalias.d
@@ -0,0 +1,51 @@
+#as: -march=rv64i -I$srcdir/$subdir -defsym XLEN=64
+#source: ext-insn.s
+#objdump: -d -M no-aliases
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+[0-9a-f]+:[ 	]+0ff57513[ 	]+andi[ 	]+a0,a0,255
+[ 	]+[0-9a-f]+:[ 	]+03051513[ 	]+slli[ 	]+a0,a0,0x30
+[ 	]+[0-9a-f]+:[ 	]+03055513[ 	]+srli[ 	]+a0,a0,0x30
+[ 	]+[0-9a-f]+:[ 	]+03851513[ 	]+slli[ 	]+a0,a0,0x38
+[ 	]+[0-9a-f]+:[ 	]+43855513[ 	]+srai[ 	]+a0,a0,0x38
+[ 	]+[0-9a-f]+:[ 	]+03051513[ 	]+slli[ 	]+a0,a0,0x30
+[ 	]+[0-9a-f]+:[ 	]+43055513[ 	]+srai[ 	]+a0,a0,0x30
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67593[ 	]+andi[ 	]+a1,a2,255
+[ 	]+[0-9a-f]+:[ 	]+03061593[ 	]+slli[ 	]+a1,a2,0x30
+[ 	]+[0-9a-f]+:[ 	]+91c1[ 	]+c\.srli[ 	]+a1,0x30
+[ 	]+[0-9a-f]+:[ 	]+03861593[ 	]+slli[ 	]+a1,a2,0x38
+[ 	]+[0-9a-f]+:[ 	]+95e1[ 	]+c\.srai[ 	]+a1,0x38
+[ 	]+[0-9a-f]+:[ 	]+03061593[ 	]+slli[ 	]+a1,a2,0x30
+[ 	]+[0-9a-f]+:[ 	]+95c1[ 	]+c\.srai[ 	]+a1,0x30
+[ 	]+[0-9a-f]+:[ 	]+1502[ 	]+c\.slli[ 	]+a0,0x20
+[ 	]+[0-9a-f]+:[ 	]+9101[ 	]+c\.srli[ 	]+a0,0x20
+[ 	]+[0-9a-f]+:[ 	]+2501[ 	]+c\.addiw[ 	]+a0,0
+[ 	]+[0-9a-f]+:[ 	]+02061593[ 	]+slli[ 	]+a1,a2,0x20
+[ 	]+[0-9a-f]+:[ 	]+9181[ 	]+c\.srli[ 	]+a1,0x20
+[ 	]+[0-9a-f]+:[ 	]+0006059b[ 	]+addiw[ 	]+a1,a2,0
+#...
diff --git a/gas/testsuite/gas/riscv/ext-insn-64-noarch.d b/gas/testsuite/gas/riscv/ext-insn-64-noarch.d
new file mode 100644
index 00000000000..6061373bb71
--- /dev/null
+++ b/gas/testsuite/gas/riscv/ext-insn-64-noarch.d
@@ -0,0 +1,5 @@
+#as: -march=rv64i -I$srcdir/$subdir -defsym XLEN=64 -defsym NOARCH=1
+#source: ext-insn.s
+#objdump: -d -M no-aliases
+
+#...
diff --git a/gas/testsuite/gas/riscv/ext-insn-zba-32-noalias.d b/gas/testsuite/gas/riscv/ext-insn-zba-32-noalias.d
new file mode 100644
index 00000000000..ccea949debc
--- /dev/null
+++ b/gas/testsuite/gas/riscv/ext-insn-zba-32-noalias.d
@@ -0,0 +1,39 @@
+#as: -march=rv32i_zba -I$srcdir/$subdir -defsym XLEN=32
+#source: ext-insn.s
+#objdump: -d -M no-aliases
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+[0-9a-f]+:[ 	]+0ff57513[ 	]+andi[ 	]+a0,a0,255
+[ 	]+[0-9a-f]+:[ 	]+01051513[ 	]+slli[ 	]+a0,a0,0x10
+[ 	]+[0-9a-f]+:[ 	]+01055513[ 	]+srli[ 	]+a0,a0,0x10
+[ 	]+[0-9a-f]+:[ 	]+01851513[ 	]+slli[ 	]+a0,a0,0x18
+[ 	]+[0-9a-f]+:[ 	]+41855513[ 	]+srai[ 	]+a0,a0,0x18
+[ 	]+[0-9a-f]+:[ 	]+01051513[ 	]+slli[ 	]+a0,a0,0x10
+[ 	]+[0-9a-f]+:[ 	]+41055513[ 	]+srai[ 	]+a0,a0,0x10
+[ 	]+[0-9a-f]+:[ 	]+0ff67593[ 	]+andi[ 	]+a1,a2,255
+[ 	]+[0-9a-f]+:[ 	]+01061593[ 	]+slli[ 	]+a1,a2,0x10
+[ 	]+[0-9a-f]+:[ 	]+0105d593[ 	]+srli[ 	]+a1,a1,0x10
+[ 	]+[0-9a-f]+:[ 	]+01861593[ 	]+slli[ 	]+a1,a2,0x18
+[ 	]+[0-9a-f]+:[ 	]+4185d593[ 	]+srai[ 	]+a1,a1,0x18
+[ 	]+[0-9a-f]+:[ 	]+01061593[ 	]+slli[ 	]+a1,a2,0x10
+[ 	]+[0-9a-f]+:[ 	]+4105d593[ 	]+srai[ 	]+a1,a1,0x10
+[ 	]+[0-9a-f]+:[ 	]+0ff57513[ 	]+andi[ 	]+a0,a0,255
+[ 	]+[0-9a-f]+:[ 	]+0542[ 	]+c\.slli[ 	]+a0,0x10
+[ 	]+[0-9a-f]+:[ 	]+8141[ 	]+c\.srli[ 	]+a0,0x10
+[ 	]+[0-9a-f]+:[ 	]+0562[ 	]+c\.slli[ 	]+a0,0x18
+[ 	]+[0-9a-f]+:[ 	]+8561[ 	]+c\.srai[ 	]+a0,0x18
+[ 	]+[0-9a-f]+:[ 	]+0542[ 	]+c\.slli[ 	]+a0,0x10
+[ 	]+[0-9a-f]+:[ 	]+8541[ 	]+c\.srai[ 	]+a0,0x10
+[ 	]+[0-9a-f]+:[ 	]+0ff67593[ 	]+andi[ 	]+a1,a2,255
+[ 	]+[0-9a-f]+:[ 	]+01061593[ 	]+slli[ 	]+a1,a2,0x10
+[ 	]+[0-9a-f]+:[ 	]+81c1[ 	]+c\.srli[ 	]+a1,0x10
+[ 	]+[0-9a-f]+:[ 	]+01861593[ 	]+slli[ 	]+a1,a2,0x18
+[ 	]+[0-9a-f]+:[ 	]+85e1[ 	]+c\.srai[ 	]+a1,0x18
+[ 	]+[0-9a-f]+:[ 	]+01061593[ 	]+slli[ 	]+a1,a2,0x10
+[ 	]+[0-9a-f]+:[ 	]+85c1[ 	]+c\.srai[ 	]+a1,0x10
+#...
diff --git a/gas/testsuite/gas/riscv/ext-insn-zba-64-noalias.d b/gas/testsuite/gas/riscv/ext-insn-zba-64-noalias.d
new file mode 100644
index 00000000000..a9e191a7449
--- /dev/null
+++ b/gas/testsuite/gas/riscv/ext-insn-zba-64-noalias.d
@@ -0,0 +1,47 @@
+#as: -march=rv64i_zba -I$srcdir/$subdir -defsym XLEN=64
+#source: ext-insn.s
+#objdump: -d -M no-aliases
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+[0-9a-f]+:[ 	]+0ff57513[ 	]+andi[ 	]+a0,a0,255
+[ 	]+[0-9a-f]+:[ 	]+03051513[ 	]+slli[ 	]+a0,a0,0x30
+[ 	]+[0-9a-f]+:[ 	]+03055513[ 	]+srli[ 	]+a0,a0,0x30
+[ 	]+[0-9a-f]+:[ 	]+03851513[ 	]+slli[ 	]+a0,a0,0x38
+[ 	]+[0-9a-f]+:[ 	]+43855513[ 	]+srai[ 	]+a0,a0,0x38
+[ 	]+[0-9a-f]+:[ 	]+03051513[ 	]+slli[ 	]+a0,a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+:[ 	]+03061593[ 	]+slli[ 	]+a1,a2,0x30
+[ 	]+[0-9a-f]+:[ 	]+91c1[ 	]+c\.srli[ 	]+a1,0x30
+[ 	]+[0-9a-f]+:[ 	]+03861593[ 	]+slli[ 	]+a1,a2,0x38
+[ 	]+[0-9a-f]+:[ 	]+95e1[ 	]+c\.srai[ 	]+a1,0x38
+[ 	]+[0-9a-f]+:[ 	]+03061593[ 	]+slli[ 	]+a1,a2,0x30
+[ 	]+[0-9a-f]+:[ 	]+95c1[ 	]+c\.srai[ 	]+a1,0x30
+[ 	]+[0-9a-f]+:[ 	]+0805053b[ 	]+add\.uw[ 	]+a0,a0,zero
+[ 	]+[0-9a-f]+:[ 	]+2501[ 	]+c\.addiw[ 	]+a0,0
+[ 	]+[0-9a-f]+:[ 	]+080605bb[ 	]+add\.uw[ 	]+a1,a2,zero
+[ 	]+[0-9a-f]+:[ 	]+0006059b[ 	]+addiw[ 	]+a1,a2,0
+#...
diff --git a/gas/testsuite/gas/riscv/ext-insn-zbb-32-noalias.d b/gas/testsuite/gas/riscv/ext-insn-zbb-32-noalias.d
new file mode 100644
index 00000000000..edb2dcde2cf
--- /dev/null
+++ b/gas/testsuite/gas/riscv/ext-insn-zbb-32-noalias.d
@@ -0,0 +1,27 @@
+#as: -march=rv32i_zbb -I$srcdir/$subdir -defsym XLEN=32
+#source: ext-insn.s
+#objdump: -d -M no-aliases
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+[0-9a-f]+:[ 	]+0ff57513[ 	]+andi[ 	]+a0,a0,255
+[ 	]+[0-9a-f]+:[ 	]+08054533[ 	]+zext\.h[ 	]+a0,a0
+[ 	]+[0-9a-f]+:[ 	]+60451513[ 	]+sext\.b[ 	]+a0,a0
+[ 	]+[0-9a-f]+:[ 	]+60551513[ 	]+sext\.h[ 	]+a0,a0
+[ 	]+[0-9a-f]+:[ 	]+0ff67593[ 	]+andi[ 	]+a1,a2,255
+[ 	]+[0-9a-f]+:[ 	]+080645b3[ 	]+zext\.h[ 	]+a1,a2
+[ 	]+[0-9a-f]+:[ 	]+60461593[ 	]+sext\.b[ 	]+a1,a2
+[ 	]+[0-9a-f]+:[ 	]+60561593[ 	]+sext\.h[ 	]+a1,a2
+[ 	]+[0-9a-f]+:[ 	]+0ff57513[ 	]+andi[ 	]+a0,a0,255
+[ 	]+[0-9a-f]+:[ 	]+08054533[ 	]+zext\.h[ 	]+a0,a0
+[ 	]+[0-9a-f]+:[ 	]+60451513[ 	]+sext\.b[ 	]+a0,a0
+[ 	]+[0-9a-f]+:[ 	]+60551513[ 	]+sext\.h[ 	]+a0,a0
+[ 	]+[0-9a-f]+:[ 	]+0ff67593[ 	]+andi[ 	]+a1,a2,255
+[ 	]+[0-9a-f]+:[ 	]+080645b3[ 	]+zext\.h[ 	]+a1,a2
+[ 	]+[0-9a-f]+:[ 	]+60461593[ 	]+sext\.b[ 	]+a1,a2
+[ 	]+[0-9a-f]+:[ 	]+60561593[ 	]+sext\.h[ 	]+a1,a2
+#...
diff --git a/gas/testsuite/gas/riscv/ext-insn-zbb-64-noalias.d b/gas/testsuite/gas/riscv/ext-insn-zbb-64-noalias.d
new file mode 100644
index 00000000000..bc7b6145e59
--- /dev/null
+++ b/gas/testsuite/gas/riscv/ext-insn-zbb-64-noalias.d
@@ -0,0 +1,39 @@
+#as: -march=rv64i_zbb -I$srcdir/$subdir -defsym XLEN=64
+#source: ext-insn.s
+#objdump: -d -M no-aliases
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+[0-9a-f]+:[ 	]+0ff57513[ 	]+andi[ 	]+a0,a0,255
+[ 	]+[0-9a-f]+:[ 	]+0805453b[ 	]+zext\.h[ 	]+a0,a0
+[ 	]+[0-9a-f]+:[ 	]+60451513[ 	]+sext\.b[ 	]+a0,a0
+[ 	]+[0-9a-f]+:[ 	]+60551513[ 	]+sext\.h[ 	]+a0,a0
+[ 	]+[0-9a-f]+:[ 	]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]+[0-9a-f]+:[ 	]+02061593[ 	]+slli[ 	]+a1,a2,0x20
+[ 	]+[0-9a-f]+:[ 	]+9181[ 	]+c\.srli[ 	]+a1,0x20
+[ 	]+[0-9a-f]+:[ 	]+0006059b[ 	]+addiw[ 	]+a1,a2,0
+#...
diff --git a/gas/testsuite/gas/riscv/ext-insn.s b/gas/testsuite/gas/riscv/ext-insn.s
new file mode 100644
index 00000000000..2e4dc1ed850
--- /dev/null
+++ b/gas/testsuite/gas/riscv/ext-insn.s
@@ -0,0 +1,23 @@
+.include "testutils.inc"
+
+.macro	INSN_SEQ
+	zext.b	a0, a0		# andi (I)
+	zext.h	a0, a0		# Zbb (RV32!=RV64) / shifts (I/C)
+	sext.b	a0, a0		# Zbb / shifts (I/C)
+	sext.h	a0, a0		# Zbb / shifts (I/C)
+	zext.b	a1, a2		# andi (I)
+	zext.h	a1, a2		# Zbb (RV32!=RV64) / shifts (I/C)
+	sext.b	a1, a2		# Zbb / shifts (I/C)
+	sext.h	a1, a2		# Zbb / shifts (I/C)
+.if	XLEN_GE_64
+	zext.w	a0, a0		# add.uw (RV64_Zba) / shifts (I/C)
+	sext.w	a0, a0		# addiw (I) / c.addiw (C)
+	zext.w	a1, a2		# add.uw (RV64_Zba) / shifts (I/C)
+	sext.w	a1, a2		# addiw (I/C)
+.endif
+.endm
+
+target:
+	INSN_SEQ
+	.option	arch, +c
+	INSN_SEQ
diff --git a/gas/testsuite/gas/riscv/ext.s b/gas/testsuite/gas/riscv/ext.s
deleted file mode 100644
index 0268dcafc1d..00000000000
--- a/gas/testsuite/gas/riscv/ext.s
+++ /dev/null
@@ -1,38 +0,0 @@
-target:
-	.option arch, -c
-	zext.b	a0, a0
-	zext.h	a0, a0
-	sext.b	a0, a0
-	sext.h	a0, a0
-
-	zext.b	a1, a2
-	zext.h	a1, a2
-	sext.b	a1, a2
-	sext.h	a1, a2
-
-.ifdef __64_bit__
-	zext.w	a0, a0
-	sext.w	a0, a0
-
-	zext.w	a1, a2
-	sext.w	a1, a2
-.endif
-
-	.option arch, +c
-	zext.b	a0, a0
-	zext.h	a0, a0
-	sext.b	a0, a0
-	sext.h	a0, a0
-
-	zext.b	a1, a2
-	zext.h	a1, a2
-	sext.b	a1, a2
-	sext.h	a1, a2
-
-.ifdef __64_bit__
-	zext.w	a0, a0
-	sext.w	a0, a0
-
-	zext.w	a1, a2
-	sext.w	a1, a2
-.endif
