From e7e599a156fe24631f313e95818dfc79fb3112d7 Mon Sep 17 00:00:00 2001 From: Nelson Chu Date: Mon, 22 Nov 2021 18:21:15 +0800 Subject: [PATCH] RISC-V: Replace .option rvc/norvc with .option arch, +c/-c. 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 da3d9115667..e8061217e7c 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 ee6a94dea78..ec28556e7be 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 527449111dc..8cfcea103db 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 1b876ab56ba..75b25ae465b 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 23d51c31b72..4f9245b7ff3 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 ffe743e92d8..de7564595a1 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 62c3e1a1cd5..4c5a5c276f8 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 4e3903039e5..2d32d4445e9 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 f95713422a2..0268dcafc1d 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 000209886e2..989463f91ee 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 f8306d0643e..79468c0d14f 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 a099eacc7f7..88f2601568d 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 c597495b915..804b0397737 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 ccd353ddcf3..8ed0ed3b44d 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 6f1a5ba4d82..a673f8810dc 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 703dfb211bd..8878318f4a7 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.30.2