public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] Morello PCS avoid rounding NGRN to even number for capabilities
@ 2021-09-21  9:15 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2021-09-21  9:15 UTC (permalink / raw)
  To: gcc-cvs

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

commit fd5470c6be6be66be38f43f5831eea168d09819b
Author: Matthew Malcomson <matthew.malcomson@arm.com>
Date:   Thu Sep 16 11:33:57 2021 +0100

    Morello PCS avoid rounding NGRN to even number for capabilities
    
    Rule C.9 about rounding NGRN up to an even number if the argument has an
    alignment of 16 explicitly excludes capability types and composite types
    containing capability types.
    
    This patch avoids doing such a round up in those cases.  This can be
    seen in the registers that pass the structure argument in the below
    testcase:
    
    struct alt_v { void *a; unsigned short int b; };
    extern struct alt_v check_alt_v (int x, struct alt_v);
    struct alt_v altv;
    size_t test_alt_v ()
    {
      struct alt_v ret = check_alt_v (10, altv);
      return sizeof (struct alt_v) + ret.b;
    }
    
    Testcases added in another patch.

Diff:
---
 gcc/config/aarch64/aarch64.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 7044286cdd9..ad4e2739576 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -6027,12 +6027,6 @@ static unsigned int
 aarch64_function_arg_alignment (machine_mode mode, const_tree type,
 				bool *abi_break)
 {
-  /* MORELLO TODO Account for CADImode here.
-     Will need to return 128 bits for TARGET_MORELLO and 64 bits for
-     TARGET_CAPABILITY_FAKE.
-     Here would need to handle `mode_base_align` definition.
-     Would also want to check that the alignment of capability typed values is
-     indeed 16.  */
   *abi_break = false;
   if (!type)
     return GET_MODE_ALIGNMENT (mode);
@@ -6251,6 +6245,7 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg)
 	 is rounded up to the next even number.  */
       if (nregs == 2
 	  && ncrn % 2
+	  && !in_cap_regs
 	  /* The == 16 * BITS_PER_UNIT instead of >= 16 * BITS_PER_UNIT
 	     comparison is there because for > 16 * BITS_PER_UNIT
 	     alignment nregs should be > 2 and therefore it should be


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

only message in thread, other threads:[~2021-09-21  9:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-21  9:15 [gcc(refs/vendors/ARM/heads/morello)] Morello PCS avoid rounding NGRN to even number for capabilities 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).