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

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


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

only message in thread, other threads:[~2022-05-05 12:08 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:08 [gcc(refs/vendors/ARM/heads/morello)] aarch64: Generalise FORCE_TO_MEM expansion 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).