public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Matthew Malcomson <matmal01@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/ARM/heads/morello)] aarch64: Generalise FORCE_TO_MEM expansion
Date: Thu,  5 May 2022 12:08:48 +0000 (GMT)	[thread overview]
Message-ID: <20220505120848.4CBBE3856279@sourceware.org> (raw)

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

commit aee49731bcd5e639f0a5d10ef1404b195c2415ac
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Wed Apr 13 09:55:01 2022 +0100

    aarch64: Generalise FORCE_TO_MEM expansion
    
    After forcing a constant to memory, aarch64_expand_mov_immediate
    would test whether the address of the constant pool entry needs
    to be “legitimised” or not.  The condition for this was:
    
        if (!aarch64_pcrelative_literal_loads)
    
    As things stand, that is a correct simplification of the
    condition “is the memory not already legitimate?”, due to:
    
              return (GET_CODE (sym) == LABEL_REF
                       || (GET_CODE (sym) == SYMBOL_REF
                           && CONSTANT_POOL_ADDRESS_P (sym)
                           && aarch64_pcrelative_literal_loads
                           /* Disallow direct loading of symbols in pure capability
                              unless that symbol is already an indirection symbol.
                              Disallow other symbols since we always want to
                              enforce indirection.
    
                              Allow indirection symbols since while this function
                              is used in many places where such a direct symbol
                              could not be used for PureCap ABI, these are also
                              places a direct symbol could not be used in the
                              instruction for stock AArch64.
    
                              The only place we belive that this would end up
                              getting used is in the Usa alternative of
                              movcadi_aarch64 patterns, where we would use an `adr`
                              with it.  We believe this is valid.  */
                           && (!TARGET_CAPABILITY_PURE
                               || SYMBOL_REF_INDIRECTION_P (sym))));
    
    in aarch64_classify_address.  However, the legitimacy
    rules aren't so simple with later patches, so we'll need
    to check explicitly for a valid memory operand.

Diff:
---
 gcc/config/aarch64/aarch64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 9488204124e..58f08b623a5 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5568,7 +5568,7 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
 	     we need to expand the literal pool access carefully.
 	     This is something that needs to be done in a number
 	     of places, so could well live as a separate function.  */
-	  if (!aarch64_pcrelative_literal_loads)
+	  if (!memory_operand (mem, ptr_mode))
 	    {
 	      gcc_assert (can_create_pseudo_p ());
 	      if (TARGET_CAPABILITY_PURE && SYMBOL_REF_P (base))


                 reply	other threads:[~2022-05-05 12:08 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=20220505120848.4CBBE3856279@sourceware.org \
    --to=matmal01@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).