[05/12] RISC-V: Redefine "nop" test

Message ID 6fc2851a4161edc429089bd2bbd9c2bb4c0c118f.1667651354.git.research_trasio@irq.a4lg.com
State Accepted
Headers
Series RISC-V: Test refinements (Batch 1) |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Tsukasa OI Nov. 5, 2022, 12:29 p.m. UTC
  Seemingly, t_insns.[sd] was the first GAS test for RISC-V.  This commit
redefines this test as a template of the new testing utility for
"nop" and "c.nop".

gas/ChangeLog:

	* testsuite/gas/riscv/nop.s: New test.
	* testsuite/gas/riscv/nop.d: New test.
	* testsuite/gas/riscv/nop-noalias.d: New test.
	* testsuite/gas/riscv/nop-noarch.d: New failure test.
	* testsuite/gas/riscv/nop-noarch.l: Likewise.
	* testsuite/gas/riscv/t_insns.d: Removed.
	* testsuite/gas/riscv/t_insns.s: Removed.
---
 gas/testsuite/gas/riscv/nop-noalias.d | 13 +++++++++++++
 gas/testsuite/gas/riscv/nop-noarch.d  |  3 +++
 gas/testsuite/gas/riscv/nop-noarch.l  |  2 ++
 gas/testsuite/gas/riscv/nop.d         | 12 ++++++++++++
 gas/testsuite/gas/riscv/nop.s         |  9 +++++++++
 gas/testsuite/gas/riscv/t_insns.d     | 10 ----------
 gas/testsuite/gas/riscv/t_insns.s     |  2 --
 7 files changed, 39 insertions(+), 12 deletions(-)
 create mode 100644 gas/testsuite/gas/riscv/nop-noalias.d
 create mode 100644 gas/testsuite/gas/riscv/nop-noarch.d
 create mode 100644 gas/testsuite/gas/riscv/nop-noarch.l
 create mode 100644 gas/testsuite/gas/riscv/nop.d
 create mode 100644 gas/testsuite/gas/riscv/nop.s
 delete mode 100644 gas/testsuite/gas/riscv/t_insns.d
 delete mode 100644 gas/testsuite/gas/riscv/t_insns.s
  

Comments

Nelson Chu Nov. 29, 2022, 7:58 a.m. UTC | #1
On Sat, Nov 5, 2022 at 8:30 PM Tsukasa OI <research_trasio@irq.a4lg.com> wrote:
>
> Seemingly, t_insns.[sd] was the first GAS test for RISC-V.  This commit
> redefines this test as a template of the new testing utility for
> "nop" and "c.nop".
>
> gas/ChangeLog:
>
>         * testsuite/gas/riscv/nop.s: New test.
>         * testsuite/gas/riscv/nop.d: New test.
>         * testsuite/gas/riscv/nop-noalias.d: New test.
>         * testsuite/gas/riscv/nop-noarch.d: New failure test.
>         * testsuite/gas/riscv/nop-noarch.l: Likewise.
>         * testsuite/gas/riscv/t_insns.d: Removed.
>         * testsuite/gas/riscv/t_insns.s: Removed.
> ---
>  gas/testsuite/gas/riscv/nop-noalias.d | 13 +++++++++++++
>  gas/testsuite/gas/riscv/nop-noarch.d  |  3 +++
>  gas/testsuite/gas/riscv/nop-noarch.l  |  2 ++
>  gas/testsuite/gas/riscv/nop.d         | 12 ++++++++++++
>  gas/testsuite/gas/riscv/nop.s         |  9 +++++++++
>  gas/testsuite/gas/riscv/t_insns.d     | 10 ----------
>  gas/testsuite/gas/riscv/t_insns.s     |  2 --
>  7 files changed, 39 insertions(+), 12 deletions(-)
>  create mode 100644 gas/testsuite/gas/riscv/nop-noalias.d
>  create mode 100644 gas/testsuite/gas/riscv/nop-noarch.d
>  create mode 100644 gas/testsuite/gas/riscv/nop-noarch.l
>  create mode 100644 gas/testsuite/gas/riscv/nop.d
>  create mode 100644 gas/testsuite/gas/riscv/nop.s
>  delete mode 100644 gas/testsuite/gas/riscv/t_insns.d
>  delete mode 100644 gas/testsuite/gas/riscv/t_insns.s
>
> diff --git a/gas/testsuite/gas/riscv/nop-noalias.d b/gas/testsuite/gas/riscv/nop-noalias.d
> new file mode 100644
> index 00000000000..8dca3c8e01f
> --- /dev/null
> +++ b/gas/testsuite/gas/riscv/nop-noalias.d
> @@ -0,0 +1,13 @@
> +#as: -march=rv32i -I$srcdir/$subdir
> +#source: nop.s
> +#objdump: -d -M no-aliases
> +
> +.*:[   ]+file format .*
> +
> +
> +Disassembly of section .text:
> +
> +0+000 <target>:
> +[      ]+[0-9a-f]+:[   ]+00000013[     ]+addi[         ]+zero,zero,0
> +[      ]+[0-9a-f]+:[   ]+0001[         ]+c\.addi[      ]+zero,0
> +[      ]+[0-9a-f]+:[   ]+0001[         ]+c\.addi[      ]+zero,0
> diff --git a/gas/testsuite/gas/riscv/nop-noarch.d b/gas/testsuite/gas/riscv/nop-noarch.d
> new file mode 100644
> index 00000000000..d3fe5dc763e
> --- /dev/null
> +++ b/gas/testsuite/gas/riscv/nop-noarch.d
> @@ -0,0 +1,3 @@
> +#as: -march=rv32i -I$srcdir/$subdir -defsym NOARCH=1
> +#source: nop.s
> +#error_output: nop-noarch.l
> diff --git a/gas/testsuite/gas/riscv/nop-noarch.l b/gas/testsuite/gas/riscv/nop-noarch.l
> new file mode 100644
> index 00000000000..4e418e1291d
> --- /dev/null
> +++ b/gas/testsuite/gas/riscv/nop-noarch.l
> @@ -0,0 +1,2 @@
> +.*: Assembler messages:
> +.*: Error: unrecognized opcode `c\.nop', extension `c' required
> diff --git a/gas/testsuite/gas/riscv/nop.d b/gas/testsuite/gas/riscv/nop.d
> new file mode 100644
> index 00000000000..19b5fc13b55
> --- /dev/null
> +++ b/gas/testsuite/gas/riscv/nop.d
> @@ -0,0 +1,12 @@
> +#as: -march=rv32i -I$srcdir/$subdir
> +#objdump: -d
> +
> +.*:[   ]+file format .*
> +
> +
> +Disassembly of section .text:
> +
> +0+000 <target>:
> +[      ]+[0-9a-f]+:[   ]+00000013[     ]+nop
> +[      ]+[0-9a-f]+:[   ]+0001[         ]+nop
> +[      ]+[0-9a-f]+:[   ]+0001[         ]+nop
> diff --git a/gas/testsuite/gas/riscv/nop.s b/gas/testsuite/gas/riscv/nop.s
> new file mode 100644
> index 00000000000..1a2dd75f3b1
> --- /dev/null
> +++ b/gas/testsuite/gas/riscv/nop.s
> @@ -0,0 +1,9 @@
> +.include "testutils.inc"
> +
> +target:
> +       nop
> +       # Architecture block: change disabled when NOARCH is defined.
> +       SET_ARCH_START  +c
> +       nop
> +       c.nop
> +       SET_ARCH_END

It should be the ".option arch, +c", so that's why I don't agree with
the related changes.  Please make the test cases simple and don't make
them too complicated.

> diff --git a/gas/testsuite/gas/riscv/t_insns.d b/gas/testsuite/gas/riscv/t_insns.d
> deleted file mode 100644
> index 720f0db2930..00000000000
> --- a/gas/testsuite/gas/riscv/t_insns.d
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -#as:
> -#objdump: -dr
> -
> -.*:[   ]+file format .*
> -
> -
> -Disassembly of section .text:
> -
> -0+000 <target>:
> -[      ]+0:[   ]+00000013[     ]+nop
> diff --git a/gas/testsuite/gas/riscv/t_insns.s b/gas/testsuite/gas/riscv/t_insns.s
> deleted file mode 100644
> index 99456883315..00000000000
> --- a/gas/testsuite/gas/riscv/t_insns.s
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -target:
> -       nop
> --

I prefer to keep the old one.

Nelson

> 2.37.2
>
  

Patch

diff --git a/gas/testsuite/gas/riscv/nop-noalias.d b/gas/testsuite/gas/riscv/nop-noalias.d
new file mode 100644
index 00000000000..8dca3c8e01f
--- /dev/null
+++ b/gas/testsuite/gas/riscv/nop-noalias.d
@@ -0,0 +1,13 @@ 
+#as: -march=rv32i -I$srcdir/$subdir
+#source: nop.s
+#objdump: -d -M no-aliases
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+[0-9a-f]+:[ 	]+00000013[ 	]+addi[ 	]+zero,zero,0
+[ 	]+[0-9a-f]+:[ 	]+0001[ 	]+c\.addi[ 	]+zero,0
+[ 	]+[0-9a-f]+:[ 	]+0001[ 	]+c\.addi[ 	]+zero,0
diff --git a/gas/testsuite/gas/riscv/nop-noarch.d b/gas/testsuite/gas/riscv/nop-noarch.d
new file mode 100644
index 00000000000..d3fe5dc763e
--- /dev/null
+++ b/gas/testsuite/gas/riscv/nop-noarch.d
@@ -0,0 +1,3 @@ 
+#as: -march=rv32i -I$srcdir/$subdir -defsym NOARCH=1
+#source: nop.s
+#error_output: nop-noarch.l
diff --git a/gas/testsuite/gas/riscv/nop-noarch.l b/gas/testsuite/gas/riscv/nop-noarch.l
new file mode 100644
index 00000000000..4e418e1291d
--- /dev/null
+++ b/gas/testsuite/gas/riscv/nop-noarch.l
@@ -0,0 +1,2 @@ 
+.*: Assembler messages:
+.*: Error: unrecognized opcode `c\.nop', extension `c' required
diff --git a/gas/testsuite/gas/riscv/nop.d b/gas/testsuite/gas/riscv/nop.d
new file mode 100644
index 00000000000..19b5fc13b55
--- /dev/null
+++ b/gas/testsuite/gas/riscv/nop.d
@@ -0,0 +1,12 @@ 
+#as: -march=rv32i -I$srcdir/$subdir
+#objdump: -d
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+[0-9a-f]+:[ 	]+00000013[ 	]+nop
+[ 	]+[0-9a-f]+:[ 	]+0001[ 	]+nop
+[ 	]+[0-9a-f]+:[ 	]+0001[ 	]+nop
diff --git a/gas/testsuite/gas/riscv/nop.s b/gas/testsuite/gas/riscv/nop.s
new file mode 100644
index 00000000000..1a2dd75f3b1
--- /dev/null
+++ b/gas/testsuite/gas/riscv/nop.s
@@ -0,0 +1,9 @@ 
+.include "testutils.inc"
+
+target:
+	nop
+	# Architecture block: change disabled when NOARCH is defined.
+	SET_ARCH_START	+c
+	nop
+	c.nop
+	SET_ARCH_END
diff --git a/gas/testsuite/gas/riscv/t_insns.d b/gas/testsuite/gas/riscv/t_insns.d
deleted file mode 100644
index 720f0db2930..00000000000
--- a/gas/testsuite/gas/riscv/t_insns.d
+++ /dev/null
@@ -1,10 +0,0 @@ 
-#as:
-#objdump: -dr
-
-.*:[ 	]+file format .*
-
-
-Disassembly of section .text:
-
-0+000 <target>:
-[ 	]+0:[ 	]+00000013[ 	]+nop
diff --git a/gas/testsuite/gas/riscv/t_insns.s b/gas/testsuite/gas/riscv/t_insns.s
deleted file mode 100644
index 99456883315..00000000000
--- a/gas/testsuite/gas/riscv/t_insns.s
+++ /dev/null
@@ -1,2 +0,0 @@ 
-target:
-	nop