public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] aarch64: Ignore -mfake-capability for Morello and +c64
@ 2022-05-05 12:05 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2022-05-05 12:05 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:3f926ec0b770180940af9ab769bbf4067663b8a0

commit 3f926ec0b770180940af9ab769bbf4067663b8a0
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Thu Apr 7 13:25:20 2022 +0100

    aarch64: Ignore -mfake-capability for Morello and +c64
    
    We have three options that affect the choice of aarch64_cap:
    -march, -mabi and -mfake-capability.  This raises the question
    of what should happen if -mfake-capability is used with an
    -march/-mabi combo that selects “real” capabilities.  The obvious
    choices are:
    
    (1) report an error
    (2) use fake capabilities
    (3) use real capabilities
    
    (1) seems unnecessarily fussy given that -mfake-capability is just
    a development option.
    
    (2) is difficult to do.  We don't allow the combination of
    -march=morello and AARCH64_CAPABILITY_NONE, so we currently generate
    “real” capability code if and only if the target either is Morello or
    includes +c64.  (2) would require us to break that link.
    
    (3) therefore seems like the most useful option.  It means that
    morello.exp tests can use -mabi=purecap even if the harness has
    added -mfake-capability to the command line.  Doing this fixes
    the various builtin_* testsuite failures with -mfake-capability.
    
    Also, we still had an error message:
    
      must use %<-march=morello%> or the %<+c64%> extension
      when selecting the Morello %<-mabi=purecap%> ABI option
    
    even though the first possibility isn't allowed any more.
    If we handle the “purecap requires +c64” rule before the switch,
    we can force +c64 on after reporting the message, which should
    give better error recovery.
    
    The patch also runs morello_test.c with the prevailing test flags
    if those flags already select capabilities.  The test is a generic
    CADI one so should work in all capability modes.  (A later patch
    fixes it for hybrid.)

Diff:
---
 gcc/config/aarch64/aarch64.c                       | 53 ++++++++++++----------
 .../gcc.dg/rtl/aarch64/morello/morello_test.c      |  2 +-
 2 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 6853d9004bd..3f48a315824 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -15105,6 +15105,20 @@ aarch64_override_options_internal (struct gcc_options *opts)
   aarch64_tune_params = *(selected_tune->tune);
   aarch64_architecture_version = selected_arch->architecture_version;
 
+  /* We need the extension to be defined so that it gets passed down to the
+     assembler.  The assembler uses the architecture and extension to decide
+     what state the processor should be in (which also defines some parts of
+     the ABI like whether symbol values should have their lowest bit set).
+     If we want to generate purecap code we will need the processor to be in
+     the C64 state.  */
+  if (opts->x_aarch64_abi == AARCH64_ABI_MORELLO_PURECAP
+      && !AARCH64_ISA_C64)
+    {
+      error ("%<-mabi=purecap%> requires the %<+c64%> extension");
+      aarch64_isa_flags |= AARCH64_FL_C64;
+    }
+
+  aarch64_cap = AARCH64_CAPABILITY_NONE;
   if (AARCH64_ISA_C64 || selected_arch->arch == AARCH64_ARCH_MORELLO)
     {
       switch (opts->x_aarch64_abi)
@@ -15113,6 +15127,7 @@ aarch64_override_options_internal (struct gcc_options *opts)
 	    error ("cannot use %<-mabi=ilp32%> with the Morello architecture");
 	    break;
 	  case AARCH64_ABI_MORELLO_PURECAP:
+	    gcc_assert (AARCH64_ISA_C64);
 	    aarch64_cap = AARCH64_CAPABILITY_PURE;
 	    break;
 	  case AARCH64_ABI_LP64:
@@ -15124,30 +15139,18 @@ aarch64_override_options_internal (struct gcc_options *opts)
     }
   else
     {
-      if (opts->x_aarch64_abi == AARCH64_ABI_MORELLO_PURECAP)
-	error ("must use %<-march=morello%> or the %<+c64%> extension "
-	       "when selecting the Morello %<-mabi=purecap%> ABI option");
-      else
-	aarch64_cap = AARCH64_CAPABILITY_NONE;
+      gcc_assert (opts->x_aarch64_abi == AARCH64_ABI_ILP32
+		  || opts->x_aarch64_abi == AARCH64_ABI_LP64);
+      if (aarch64_using_fake_capability)
+	{
+	  if (opts->x_aarch64_abi == AARCH64_ABI_ILP32)
+	    error ("cannot use %<-mfake-capability%> and %<-mabi=ilp32%>"
+		   " together");
+	  else
+	    aarch64_cap = AARCH64_CAPABILITY_FAKE;
+	}
     }
 
-  /*  We need the extension to be defined so that it gets passed down to the
-      assembler.  The assembler uses the architecture and extension to decide
-      what state the processor should be in (which also defines some parts of
-      the ABI like whether symbol values should have their lowest bit set).
-      If we want to generate purecap code we will need the processor to be in
-      the C64 state.  */
-  if (aarch64_cap == AARCH64_CAPABILITY_PURE
-      && ! AARCH64_ISA_C64)
-    error ("%<-mabi=purecap%> requires the %<+c64%> extension");
-
-  if (aarch64_using_fake_capability)
-    aarch64_cap = AARCH64_CAPABILITY_FAKE;
-
-  if (aarch64_using_fake_capability
-      && opts->x_aarch64_abi == AARCH64_ABI_ILP32)
-    error ("Can not use fake_capability and %<-mabi=ilp32%> together");
-
   if (TARGET_CAPABILITY_ANY && opts->x_flag_sanitize)
     /* At the moment we're disabling this.
      * Sanitizers are a feature that are non-essential, can not be required by
@@ -15158,11 +15161,11 @@ aarch64_override_options_internal (struct gcc_options *opts)
      * come back to it later.  */
     error ("MORELLO TODO Disabling sanitizers on Morello for now");
   if (opts->x_flag_openmp && TARGET_CAPABILITY_ANY)
-	  error ("MORELLO TODO OpenMP has not been implemented for Morello");
+    error ("MORELLO TODO OpenMP has not been implemented for Morello");
   if (opts->x_flag_openacc && TARGET_CAPABILITY_ANY)
-	  error ("MORELLO TODO OpenACC has not been implemented for Morello");
+    error ("MORELLO TODO OpenACC has not been implemented for Morello");
   if (!flag_inline_atomics && TARGET_CAPABILITY_ANY)
-	  error ("MORELLO TODO -fno-inline-atomics has not been implemented for Morello");
+    error ("MORELLO TODO -fno-inline-atomics has not been implemented for Morello");
   if (flag_fake_hybrid >= flag_fake_hybrid_init)
     srand (get_random_seed (false));
 
diff --git a/gcc/testsuite/gcc.dg/rtl/aarch64/morello/morello_test.c b/gcc/testsuite/gcc.dg/rtl/aarch64/morello/morello_test.c
index 3b32d559285..4876e0cfc9a 100644
--- a/gcc/testsuite/gcc.dg/rtl/aarch64/morello/morello_test.c
+++ b/gcc/testsuite/gcc.dg/rtl/aarch64/morello/morello_test.c
@@ -1,5 +1,5 @@
 /* { dg-do compile { target aarch64-*-* } } */
-/* { dg-options "-march=morello -mfake-capability" } */
+/* { dg-options "-mfake-capability" { target { ! aarch64_capability_any } } } */
 
 int __RTL (startwith ("final")) f1 ()
 {


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

only message in thread, other threads:[~2022-05-05 12:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-05 12:05 [gcc(refs/vendors/ARM/heads/morello)] aarch64: Ignore -mfake-capability for Morello and +c64 Matthew Malcomson

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