This reverts commit 79b8f23a709.

Revert temporarily due to compatibility issues discussed in:
https://github.com/riscv-non-isa/riscv-c-api-doc/pull/128

We will wait for this Pull Request to reach consensus and be merged before 
resubmitting a new patch.

gcc/ChangeLog:

        * common/config/riscv/riscv-common.cc 
(riscv_subset_list::get_profile_name):
        Revert.
        * config/riscv/riscv-c.cc (riscv_cpu_cpp_builtins): Revert.
        * config/riscv/riscv-subset.h (riscv_subset_list::get_profile_name): 
Revert.

gcc/testsuite/ChangeLog:

        * gcc.target/riscv/predef-profiles-1.c: Remove.
        * gcc.target/riscv/predef-profiles-2.c: Remove.
        * gcc.target/riscv/predef-profiles-3.c: Remove.
        * gcc.target/riscv/predef-profiles-4.c: Remove.
        * gcc.target/riscv/predef-profiles-5.c: Remove.
        * gcc.target/riscv/predef-profiles-6.c: Remove.
        * gcc.target/riscv/predef-profiles-7.c: Remove.
        * gcc.target/riscv/predef-profiles-8.c: Remove.

Signed-off-by: Zhongyao Chen <[email protected]>
---
 gcc/common/config/riscv/riscv-common.cc       | 41 -------------------
 gcc/config/riscv/riscv-c.cc                   |  9 ----
 gcc/config/riscv/riscv-subset.h               |  2 -
 .../gcc.target/riscv/predef-profiles-1.c      | 11 -----
 .../gcc.target/riscv/predef-profiles-2.c      | 11 -----
 .../gcc.target/riscv/predef-profiles-3.c      | 11 -----
 .../gcc.target/riscv/predef-profiles-4.c      | 11 -----
 .../gcc.target/riscv/predef-profiles-5.c      | 11 -----
 .../gcc.target/riscv/predef-profiles-6.c      | 11 -----
 .../gcc.target/riscv/predef-profiles-7.c      | 11 -----
 .../gcc.target/riscv/predef-profiles-8.c      | 11 -----
 11 files changed, 140 deletions(-)
 delete mode 100644 gcc/testsuite/gcc.target/riscv/predef-profiles-1.c
 delete mode 100644 gcc/testsuite/gcc.target/riscv/predef-profiles-2.c
 delete mode 100644 gcc/testsuite/gcc.target/riscv/predef-profiles-3.c
 delete mode 100644 gcc/testsuite/gcc.target/riscv/predef-profiles-4.c
 delete mode 100644 gcc/testsuite/gcc.target/riscv/predef-profiles-5.c
 delete mode 100644 gcc/testsuite/gcc.target/riscv/predef-profiles-6.c
 delete mode 100644 gcc/testsuite/gcc.target/riscv/predef-profiles-7.c
 delete mode 100644 gcc/testsuite/gcc.target/riscv/predef-profiles-8.c

diff --git a/gcc/common/config/riscv/riscv-common.cc 
b/gcc/common/config/riscv/riscv-common.cc
index adfd22019a9..efa2a45a640 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -1404,47 +1404,6 @@ fail:
   return NULL;
 }
 
-/* Get the profile that best matches the current architecture string,
-   where best is defined as the most expansive profile.  */
-
-const char *
-riscv_subset_list::get_profile_name () const
-{
-  const char *best_profile = NULL;
-  int max_ext_count = -1;
-
-  for (int i = 0; riscv_profiles_table[i].profile_name != nullptr; ++i)
-    {
-      riscv_subset_list *subset_list = riscv_subset_list::parse (
-      riscv_profiles_table[i].profile_string, NULL);
-      if (!subset_list)
-       continue;
-      if (subset_list->xlen () == this->xlen ())
-       {
-         int ext_count = 0;
-         bool all_found = true;
-         for (riscv_subset_t *p = subset_list->m_head; p != NULL;
-               p = p->next, ++ext_count)
-           {
-             if (!this->lookup (p->name.c_str (),
-                       p->major_version,
-                       p->minor_version))
-               {
-                 all_found = false;
-                 break;
-               }
-           }
-         if (all_found && ext_count > max_ext_count)
-           {
-             max_ext_count = ext_count;
-             best_profile = riscv_profiles_table[i].profile_name;
-           }
-       }
-      delete subset_list;
-    }
-  return best_profile;
-}
-
 /* Clone whole subset list.  */
 
 riscv_subset_list *
diff --git a/gcc/config/riscv/riscv-c.cc b/gcc/config/riscv/riscv-c.cc
index d497326e061..4fc05281782 100644
--- a/gcc/config/riscv/riscv-c.cc
+++ b/gcc/config/riscv/riscv-c.cc
@@ -165,15 +165,6 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile)
   if (!subset_list)
     return;
 
-  /* Define profile macro if a profile was used.  */
-  const char *profile_name = subset_list->get_profile_name ();
-  if (profile_name)
-    {
-      char *profile_macro = (char *)alloca (strlen (profile_name) + 10);
-      sprintf (profile_macro, "__riscv_%s", profile_name);
-      builtin_define (profile_macro);
-    }
-
   size_t max_ext_len = 0;
 
   /* Figure out the max length of extension name for reserving buffer.   */
diff --git a/gcc/config/riscv/riscv-subset.h b/gcc/config/riscv/riscv-subset.h
index 1887ed7cc1c..4cd860fee59 100644
--- a/gcc/config/riscv/riscv-subset.h
+++ b/gcc/config/riscv/riscv-subset.h
@@ -105,8 +105,6 @@ public:
 
   unsigned xlen () const {return m_xlen;};
 
-  const char *get_profile_name () const;
-
   riscv_subset_list *clone () const;
 
   static riscv_subset_list *parse (const char *, location_t *);
diff --git a/gcc/testsuite/gcc.target/riscv/predef-profiles-1.c 
b/gcc/testsuite/gcc.target/riscv/predef-profiles-1.c
deleted file mode 100644
index 5fc17abf118..00000000000
--- a/gcc/testsuite/gcc.target/riscv/predef-profiles-1.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-march=rvi20u64 -mabi=lp64" } */
-
-int main () {
-
-#ifndef __riscv_rvi20u64
-#error "__riscv_rvi20u64"
-#endif
-
-  return 0;
-}
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/predef-profiles-2.c 
b/gcc/testsuite/gcc.target/riscv/predef-profiles-2.c
deleted file mode 100644
index 86f2771edef..00000000000
--- a/gcc/testsuite/gcc.target/riscv/predef-profiles-2.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-march=rvi20u32 -mabi=ilp32" } */
-
-int main () {
-
-#ifndef __riscv_rvi20u32
-#error "__riscv_rvi20u32"
-#endif
-
-  return 0;
-}
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/predef-profiles-3.c 
b/gcc/testsuite/gcc.target/riscv/predef-profiles-3.c
deleted file mode 100644
index 7787549c79f..00000000000
--- a/gcc/testsuite/gcc.target/riscv/predef-profiles-3.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-march=rva20u64 -mabi=lp64d" } */
-
-int main () {
-
-#ifndef __riscv_rva20u64
-#error "__riscv_rva20u64"
-#endif
-
-  return 0;
-}
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/predef-profiles-4.c 
b/gcc/testsuite/gcc.target/riscv/predef-profiles-4.c
deleted file mode 100644
index abb20b7d14f..00000000000
--- a/gcc/testsuite/gcc.target/riscv/predef-profiles-4.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-march=rva22u64 -mabi=lp64d" } */
-
-int main () {
-
-#ifndef __riscv_rva22u64
-#error "__riscv_rva22u64"
-#endif
-
-  return 0;
-}
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/predef-profiles-5.c 
b/gcc/testsuite/gcc.target/riscv/predef-profiles-5.c
deleted file mode 100644
index 0840cdc3de0..00000000000
--- a/gcc/testsuite/gcc.target/riscv/predef-profiles-5.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-march=rva23u64 -mabi=lp64d" } */
-
-int main () {
-
-#ifndef __riscv_rva23u64
-#error "__riscv_rva23u64"
-#endif
-
-  return 0;
-}
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/predef-profiles-6.c 
b/gcc/testsuite/gcc.target/riscv/predef-profiles-6.c
deleted file mode 100644
index 71597804c99..00000000000
--- a/gcc/testsuite/gcc.target/riscv/predef-profiles-6.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-march=rva23s64 -mabi=lp64d" } */
-
-int main () {
-
-#ifndef __riscv_rva23s64
-#error "__riscv_rva23s64"
-#endif
-
-  return 0;
-}
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/predef-profiles-7.c 
b/gcc/testsuite/gcc.target/riscv/predef-profiles-7.c
deleted file mode 100644
index 1366159e9d3..00000000000
--- a/gcc/testsuite/gcc.target/riscv/predef-profiles-7.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-march=rvb23u64 -mabi=lp64d" } */
-
-int main () {
-
-#ifndef __riscv_rvb23u64
-#error "__riscv_rvb23u64"
-#endif
-
-  return 0;
-}
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/riscv/predef-profiles-8.c 
b/gcc/testsuite/gcc.target/riscv/predef-profiles-8.c
deleted file mode 100644
index c0c50034b6c..00000000000
--- a/gcc/testsuite/gcc.target/riscv/predef-profiles-8.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-march=rvb23s64 -mabi=lp64d" } */
-
-int main () {
-
-#ifndef __riscv_rvb23s64
-#error "__riscv_rvb23s64"
-#endif
-
-  return 0;
-}
\ No newline at end of file
-- 
2.43.0

Reply via email to