public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-23] RISC-V: Adjust the parsing order of extensions to be consistent with riscv-spec and binutils.
@ 2023-04-18 10:19 Kito Cheng
  0 siblings, 0 replies; only message in thread
From: Kito Cheng @ 2023-04-18 10:19 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:4204ed2dc74390ab3689d1d6a53001761338baf6

commit r14-23-g4204ed2dc74390ab3689d1d6a53001761338baf6
Author: Jin Ma <jinma@linux.alibaba.com>
Date:   Tue Apr 18 17:26:49 2023 +0800

    RISC-V: Adjust the parsing order of extensions to be consistent with riscv-spec and binutils.
    
    The current order of gcc and binutils parsing extensions is inconsistent.
    
    According to latest risc-v spec, the canonical order in which extension names must
    appear in the name string specified in Table 29.1 is different from before.
    
    In the latest table, non-standard extensions must be listed after all standard
    extensions. To keep consistent, we now change the parsing order.
    
    Related llvm patch links:
     https://reviews.llvm.org/D148315
    
    gcc/ChangeLog:
    
            * common/config/riscv/riscv-common.cc (multi_letter_subset_rank): Swap the order
            of z-extensions and s-extensions.
            (riscv_subset_list::parse): Likewise.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/riscv/arch-5.c: Likewise.

Diff:
---
 gcc/common/config/riscv/riscv-common.cc | 12 ++++++------
 gcc/testsuite/gcc.target/riscv/arch-5.c |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index 2fc0f8bffc1..309a52def75 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -398,10 +398,10 @@ multi_letter_subset_rank (const std::string &subset)
   char multiletter_class = subset[0];
   switch (multiletter_class)
     {
-    case 's':
+    case 'z':
       high_order = 0;
       break;
-    case 'z':
+    case 's':
       high_order = 1;
       break;
     case 'x':
@@ -1121,14 +1121,14 @@ riscv_subset_list::parse (const char *arch, location_t loc)
   if (p == NULL)
     goto fail;
 
-  /* Parsing supervisor extension.  */
-  p = subset_list->parse_multiletter_ext (p, "s", "supervisor extension");
+  /* Parsing sub-extensions.  */
+  p = subset_list->parse_multiletter_ext (p, "z", "sub-extension");
 
   if (p == NULL)
     goto fail;
 
-  /* Parsing sub-extensions.  */
-  p = subset_list->parse_multiletter_ext (p, "z", "sub-extension");
+  /* Parsing supervisor extension.  */
+  p = subset_list->parse_multiletter_ext (p, "s", "supervisor extension");
 
   if (p == NULL)
     goto fail;
diff --git a/gcc/testsuite/gcc.target/riscv/arch-5.c b/gcc/testsuite/gcc.target/riscv/arch-5.c
index b945a643cc1..8258552214f 100644
--- a/gcc/testsuite/gcc.target/riscv/arch-5.c
+++ b/gcc/testsuite/gcc.target/riscv/arch-5.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-march=rv32isabc_zfoo_xbar -mabi=ilp32" } */
+/* { dg-options "-march=rv32i_zfoo_sabc_xbar -mabi=ilp32" } */
 int foo()
 {
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-18 10:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18 10:19 [gcc r14-23] RISC-V: Adjust the parsing order of extensions to be consistent with riscv-spec and binutils Kito Cheng

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).