public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Kito Cheng <kito@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-6946] RISC-V: Fix -march option parsing when extension exists.
Date: Thu, 28 Jan 2021 03:26:58 +0000 (GMT)	[thread overview]
Message-ID: <20210128032658.98018398BC39@sourceware.org> (raw)

https://gcc.gnu.org/g:f76d0d86454baf99ada0748c73a29816854e1b91

commit r11-6946-gf76d0d86454baf99ada0748c73a29816854e1b91
Author: Xing GUO <higuoxing@gmail.com>
Date:   Thu Jan 28 11:22:40 2021 +0800

    RISC-V: Fix -march option parsing when  extension exists.
    
    This patch fixes -march option parsing when `p` extension exists,
    e.g., -march=rv64imafdcp should produce
    
    .attribute arch, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0_p"
    
    rather than
    
    .attribute arch, "rv64i2p0_m2p0_a2p0_f2p0_d2p0_c_p"
    
    gcc/ChangeLog:
    
            * common/config/riscv/riscv-common.c
            (riscv_subset_list::parsing_subset_version): Fix -march option parsing
            when `p` extension exists.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/riscv/attribute-18.c: New test.

Diff:
---
 gcc/common/config/riscv/riscv-common.c        | 4 +---
 gcc/testsuite/gcc.target/riscv/attribute-18.c | 4 ++++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/gcc/common/config/riscv/riscv-common.c b/gcc/common/config/riscv/riscv-common.c
index b3f5c07c819..6bbe25dba89 100644
--- a/gcc/common/config/riscv/riscv-common.c
+++ b/gcc/common/config/riscv/riscv-common.c
@@ -527,9 +527,7 @@ riscv_subset_list::parsing_subset_version (const char *ext,
 	      /* Might be beginning of `p` extension.  */
 	      if (std_ext_p)
 		{
-		  *major_version = version;
-		  *minor_version = 0;
-		  *explicit_version_p = true;
+		  get_default_version (ext, major_version, minor_version);
 		  return p;
 		}
 	      else
diff --git a/gcc/testsuite/gcc.target/riscv/attribute-18.c b/gcc/testsuite/gcc.target/riscv/attribute-18.c
new file mode 100644
index 00000000000..1fd80fed51b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/attribute-18.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64imafdcp -mabi=lp64d -misa-spec=2.2" } */
+int foo() {}
+/* { dg-final { scan-assembler ".attribute arch, \"rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0_p\"" } } */


                 reply	other threads:[~2021-01-28  3:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210128032658.98018398BC39@sourceware.org \
    --to=kito@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).