From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2049) id 4CBBE3856279; Thu, 5 May 2022 12:08:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4CBBE3856279 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Matthew Malcomson To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/morello)] aarch64: Generalise FORCE_TO_MEM expansion X-Act-Checkin: gcc X-Git-Author: Richard Sandiford X-Git-Refname: refs/vendors/ARM/heads/morello X-Git-Oldrev: 221fc4613527f40b230d0776d727b864340a126f X-Git-Newrev: aee49731bcd5e639f0a5d10ef1404b195c2415ac Message-Id: <20220505120848.4CBBE3856279@sourceware.org> Date: Thu, 5 May 2022 12:08:48 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2022 12:08:48 -0000 https://gcc.gnu.org/g:aee49731bcd5e639f0a5d10ef1404b195c2415ac commit aee49731bcd5e639f0a5d10ef1404b195c2415ac Author: Richard Sandiford 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))