[committed] RISC-V: Replace .option rvc/norvc with .option arch, +c/-c.

Nelson Chu nelson.chu@sifive.com
Mon Nov 22 11:33:27 GMT 2021


Since the .option rvc/norvc directives are obsolete, replace them with
the new proposed diretives: .option arch, +c/-c.  And also reset the
riscv_opts.rvc flag for the .option arch directives.

gas/
	* config/tc-riscv.c (s_riscv_option): Reset the riscv_opts.rvc
	for the .option arch directives.
	* testsuite/gas/riscv/align-1.s: Replace the obsolete .option
	rvc/norvc with .option arch, +c/-c.
	* testsuite/gas/riscv/c-add-addi.s: Likewise.
	* testsuite/gas/riscv/c-nonzero-imm.s: Likewise.
	* testsuite/gas/riscv/c-nonzero-reg.s: Likewise.
	* testsuite/gas/riscv/c-zero-imm-64.s: Likewise.
	* testsuite/gas/riscv/c-zero-imm.s: Likewise.
	* testsuite/gas/riscv/c-zero-reg.s: Likewise.
	* testsuite/gas/riscv/ext.s: Likewise.
	* testsuite/gas/riscv/mapping-01.s: Likewise.
	* testsuite/gas/riscv/mapping-02.s: Likewise.
	* testsuite/gas/riscv/mapping-03.s: Likewise.
	* testsuite/gas/riscv/mapping-04.s: Likewise.
	* testsuite/gas/riscv/no-relax-align-2.s: Likewise.
	* testsuite/gas/riscv/shamt-32.s: Likewise.
	* testsuite/gas/riscv/shamt-64.s: Likewise.
---
 gas/config/tc-riscv.c                      | 4 ++++
 gas/testsuite/gas/riscv/align-1.s          | 2 +-
 gas/testsuite/gas/riscv/c-add-addi.s       | 2 +-
 gas/testsuite/gas/riscv/c-nonzero-imm.s    | 2 +-
 gas/testsuite/gas/riscv/c-nonzero-reg.s    | 2 +-
 gas/testsuite/gas/riscv/c-zero-imm-64.s    | 2 +-
 gas/testsuite/gas/riscv/c-zero-imm.s       | 2 +-
 gas/testsuite/gas/riscv/c-zero-reg.s       | 2 +-
 gas/testsuite/gas/riscv/ext.s              | 4 ++--
 gas/testsuite/gas/riscv/mapping-01.s       | 2 +-
 gas/testsuite/gas/riscv/mapping-02.s       | 2 +-
 gas/testsuite/gas/riscv/mapping-03.s       | 2 +-
 gas/testsuite/gas/riscv/mapping-04.s       | 2 +-
 gas/testsuite/gas/riscv/no-relax-align-2.s | 2 +-
 gas/testsuite/gas/riscv/shamt-32.s         | 4 ++--
 gas/testsuite/gas/riscv/shamt-64.s         | 4 ++--
 16 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index da3d911..e806121 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -3773,6 +3773,10 @@ s_riscv_option (int x ATTRIBUTE_UNUSED)
       if (ISSPACE (*name) && *name != '\0')
 	name++;
       riscv_update_subset (&riscv_rps_as, name);
+
+      riscv_set_rvc (false);
+      if (riscv_subset_supports (&riscv_rps_as, "c"))
+	riscv_set_rvc (true);
     }
   else if (strcmp (name, "push") == 0)
     {
diff --git a/gas/testsuite/gas/riscv/align-1.s b/gas/testsuite/gas/riscv/align-1.s
index ee6a94d..ec28556 100644
--- a/gas/testsuite/gas/riscv/align-1.s
+++ b/gas/testsuite/gas/riscv/align-1.s
@@ -1,3 +1,3 @@
-	.option norvc
+	.option arch, -c
 	.align 2
 	.align 1
diff --git a/gas/testsuite/gas/riscv/c-add-addi.s b/gas/testsuite/gas/riscv/c-add-addi.s
index 5274491..8cfcea1 100644
--- a/gas/testsuite/gas/riscv/c-add-addi.s
+++ b/gas/testsuite/gas/riscv/c-add-addi.s
@@ -1,3 +1,3 @@
-.option rvc
+.option arch, +c
 addi a2, zero, 1
 add a0, zero, a1
diff --git a/gas/testsuite/gas/riscv/c-nonzero-imm.s b/gas/testsuite/gas/riscv/c-nonzero-imm.s
index 1b876ab..75b25ae 100644
--- a/gas/testsuite/gas/riscv/c-nonzero-imm.s
+++ b/gas/testsuite/gas/riscv/c-nonzero-imm.s
@@ -1,3 +1,3 @@
-	.option rvc
+	.option arch, +c
 	c.nop 0
 	c.nop 1
diff --git a/gas/testsuite/gas/riscv/c-nonzero-reg.s b/gas/testsuite/gas/riscv/c-nonzero-reg.s
index 23d51c3..4f9245b 100644
--- a/gas/testsuite/gas/riscv/c-nonzero-reg.s
+++ b/gas/testsuite/gas/riscv/c-nonzero-reg.s
@@ -1,3 +1,3 @@
-	.option rvc
+	.option arch, +c
 	c.addiw x0, 10
 	c.jr x0
diff --git a/gas/testsuite/gas/riscv/c-zero-imm-64.s b/gas/testsuite/gas/riscv/c-zero-imm-64.s
index ffe743e..de75645 100644
--- a/gas/testsuite/gas/riscv/c-zero-imm-64.s
+++ b/gas/testsuite/gas/riscv/c-zero-imm-64.s
@@ -1,4 +1,4 @@
-	.option rvc
+	.option arch, +c
 	# These are valid instructions.
 	addiw a6,a6,0
 	c.addiw a7,0
diff --git a/gas/testsuite/gas/riscv/c-zero-imm.s b/gas/testsuite/gas/riscv/c-zero-imm.s
index 62c3e1a..4c5a5c2 100644
--- a/gas/testsuite/gas/riscv/c-zero-imm.s
+++ b/gas/testsuite/gas/riscv/c-zero-imm.s
@@ -1,4 +1,4 @@
-	.option rvc
+	.option arch, +c
 	# These are valid instructions.
 	li a0,0
 	c.li a1,0
diff --git a/gas/testsuite/gas/riscv/c-zero-reg.s b/gas/testsuite/gas/riscv/c-zero-reg.s
index 4e39030..2d32d44 100644
--- a/gas/testsuite/gas/riscv/c-zero-reg.s
+++ b/gas/testsuite/gas/riscv/c-zero-reg.s
@@ -1,4 +1,4 @@
-	.option rvc
+	.option arch, +c
 	# These are hints.
 	c.li x0, 1
 	c.lui x0, 2
diff --git a/gas/testsuite/gas/riscv/ext.s b/gas/testsuite/gas/riscv/ext.s
index f957134..0268dca 100644
--- a/gas/testsuite/gas/riscv/ext.s
+++ b/gas/testsuite/gas/riscv/ext.s
@@ -1,5 +1,5 @@
 target:
-	.option norvc
+	.option arch, -c
 	zext.b	a0, a0
 	zext.h	a0, a0
 	sext.b	a0, a0
@@ -18,7 +18,7 @@ target:
 	sext.w	a1, a2
 .endif
 
-	.option rvc
+	.option arch, +c
 	zext.b	a0, a0
 	zext.h	a0, a0
 	sext.b	a0, a0
diff --git a/gas/testsuite/gas/riscv/mapping-01.s b/gas/testsuite/gas/riscv/mapping-01.s
index 0002098..989463f 100644
--- a/gas/testsuite/gas/riscv/mapping-01.s
+++ b/gas/testsuite/gas/riscv/mapping-01.s
@@ -1,4 +1,4 @@
-	.option norvc
+	.option arch, -c
 	.text
 	.global	funcA
 funcA:
diff --git a/gas/testsuite/gas/riscv/mapping-02.s b/gas/testsuite/gas/riscv/mapping-02.s
index f8306d0..79468c0 100644
--- a/gas/testsuite/gas/riscv/mapping-02.s
+++ b/gas/testsuite/gas/riscv/mapping-02.s
@@ -1,4 +1,4 @@
-	.option norvc
+	.option arch, -c
 	.text
 	.word	1
 	add	a0, a0, a0
diff --git a/gas/testsuite/gas/riscv/mapping-03.s b/gas/testsuite/gas/riscv/mapping-03.s
index a099eac..88f2601 100644
--- a/gas/testsuite/gas/riscv/mapping-03.s
+++ b/gas/testsuite/gas/riscv/mapping-03.s
@@ -1,4 +1,4 @@
-	.option norvc
+	.option arch, -c
 	.text
 	add	a0, a0, a0
 	.long	0
diff --git a/gas/testsuite/gas/riscv/mapping-04.s b/gas/testsuite/gas/riscv/mapping-04.s
index c597495..804b0397 100644
--- a/gas/testsuite/gas/riscv/mapping-04.s
+++ b/gas/testsuite/gas/riscv/mapping-04.s
@@ -1,5 +1,5 @@
 	.text
-	.option	norvc
+	.option	arch, -c
 	.fill	2, 4, 0x1001
 	.byte	1
 	.word	0
diff --git a/gas/testsuite/gas/riscv/no-relax-align-2.s b/gas/testsuite/gas/riscv/no-relax-align-2.s
index ccd353d..8ed0ed3 100644
--- a/gas/testsuite/gas/riscv/no-relax-align-2.s
+++ b/gas/testsuite/gas/riscv/no-relax-align-2.s
@@ -1,5 +1,5 @@
 	.option norelax
-	.option rvc
+	.option arch, +c
 	.byte 0
 	.align 4
 	nop
diff --git a/gas/testsuite/gas/riscv/shamt-32.s b/gas/testsuite/gas/riscv/shamt-32.s
index 6f1a5ba..a673f88 100644
--- a/gas/testsuite/gas/riscv/shamt-32.s
+++ b/gas/testsuite/gas/riscv/shamt-32.s
@@ -1,4 +1,4 @@
-	.option norvc
+	.option arch, -c
 	slli	a0, a0, 0
 	slli	a0, a0, 31
 	slli	a0, a0, 32
@@ -14,7 +14,7 @@
 	srai	a0, a0, 32
 	srai	a0, a0, 63
 
-	.option rvc
+	.option arch, +c
 	slli	a0, a0, 0
 	slli	a0, a0, 31
 	slli	a0, a0, 32
diff --git a/gas/testsuite/gas/riscv/shamt-64.s b/gas/testsuite/gas/riscv/shamt-64.s
index 703dfb2..8878318 100644
--- a/gas/testsuite/gas/riscv/shamt-64.s
+++ b/gas/testsuite/gas/riscv/shamt-64.s
@@ -1,4 +1,4 @@
-	.option norvc
+	.option arch, -c
 	slli	a0, a0, 0
 	slli	a0, a0, 31
 	slli	a0, a0, 32
@@ -29,7 +29,7 @@
 	sraiw	a0, a0, 32
 	sraiw	a0, a0, 63
 
-	.option rvc
+	.option arch, +c
 	slli	a0, a0, 0
 	slli	a0, a0, 31
 	slli	a0, a0, 32
-- 
2.7.4



More information about the Binutils mailing list