public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>
Subject: Re: [PATCH v2] AArch64: Improve GOT addressing
Date: Wed, 26 May 2021 10:09:58 +0100	[thread overview]
Message-ID: <mptim353lp5.fsf@arm.com> (raw)
In-Reply-To: <VE1PR08MB5599595E70F412CA6CD86F2E83269@VE1PR08MB5599.eurprd08.prod.outlook.com> (Wilco Dijkstra's message of "Mon, 24 May 2021 13:12:16 +0100")

Wilco Dijkstra <Wilco.Dijkstra@arm.com> writes:
> @@ -23746,6 +23767,24 @@ aarch_macro_fusion_pair_p (rtx_insn *prev, rtx_insn *curr)
>          }
>      }
>
> +  /* Always treat GOT accesses as a pair to ensure they can be easily
> +     identified and optimized in linkers.  */

Sorry, I guess I'd not given enough weight to this part from your
earlier reply.  I was focusing too much on “Well there are no
optimizations that benefit from them being split, and there is
no gain from scheduling them independently.”

Are we actually planning to do any linker relaxations here, or is this
purely theoretical?  If doing relaxations is a realistic possiblity then
I agree that would be a good/legitimate reason to use a single define_insn
for both instructions.  In that case though, there should be a comment
above the define_insn explaining that linker relaxation is the reason
for keeping the instructions together.

If the relaxations aren't a realistic possibilty then I don't think we
want this fusion change either.

Thanks,
Richard

> +  if (simple_sets_p)
> +    {
> +      /*  We're trying to match:
> +         prev (adrp) == (set (reg r1) (high (symbol_ref ("SYM"))))
> +         curr (add) == (set (reg r0)
> +                       (unspec [(mem (lo_sum (reg r1) (symbol_ref ("SYM"))))]
> +                        UNSPEC_GOTSMALLPIC))  */
> +
> +      if (satisfies_constraint_Ush (SET_SRC (prev_set))
> +         && REG_P (SET_DEST (prev_set))
> +         && REG_P (SET_DEST (curr_set))
> +         && GET_CODE (SET_SRC (curr_set)) == UNSPEC
> +         && XINT (SET_SRC (curr_set), 1) == UNSPEC_GOTSMALLPIC)
> +       return true;
> +    }
> +
>    if (simple_sets_p && aarch64_fusion_enabled_p (AARCH64_FUSE_MOVK_MOVK))
>      {
>
> diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
> index abfd84526745d029ad4953eabad6dd17b159a218..2527c96576a78f2071da20721143a27adeb1551b 100644
> --- a/gcc/config/aarch64/aarch64.md
> +++ b/gcc/config/aarch64/aarch64.md
> @@ -1283,8 +1283,11 @@ (define_insn_and_split "*movsi_aarch64"
>     fmov\\t%w0, %s1
>     fmov\\t%s0, %s1
>     * return aarch64_output_scalar_simd_mov_immediate (operands[1], SImode);"
> -  "CONST_INT_P (operands[1]) && !aarch64_move_imm (INTVAL (operands[1]), SImode)
> -    && REG_P (operands[0]) && GP_REGNUM_P (REGNO (operands[0]))"
> +  "(CONST_INT_P (operands[1]) && !aarch64_move_imm (INTVAL (operands[1]), SImode)
> +    && REG_P (operands[0]) && GP_REGNUM_P (REGNO (operands[0])))
> +    || (reload_completed
> +       && (aarch64_classify_symbolic_expression (operands[1])
> +           == SYMBOL_SMALL_GOT_4G))"
>     [(const_int 0)]
>     "{
>         aarch64_expand_mov_immediate (operands[0], operands[1]);
> @@ -1319,8 +1322,11 @@ (define_insn_and_split "*movdi_aarch64"
>     fmov\\t%x0, %d1
>     fmov\\t%d0, %d1
>     * return aarch64_output_scalar_simd_mov_immediate (operands[1], DImode);"
> -   "(CONST_INT_P (operands[1]) && !aarch64_move_imm (INTVAL (operands[1]), DImode))
> -    && REG_P (operands[0]) && GP_REGNUM_P (REGNO (operands[0]))"
> +   "(CONST_INT_P (operands[1]) && !aarch64_move_imm (INTVAL (operands[1]), DImode)
> +    && REG_P (operands[0]) && GP_REGNUM_P (REGNO (operands[0])))
> +    || (reload_completed
> +       && (aarch64_classify_symbolic_expression (operands[1])
> +           == SYMBOL_SMALL_GOT_4G))"
>     [(const_int 0)]
>     "{
>         aarch64_expand_mov_immediate (operands[0], operands[1]);

  reply	other threads:[~2021-05-26  9:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-24 12:12 Wilco Dijkstra
2021-05-26  9:09 ` Richard Sandiford [this message]
2021-05-26 12:24   ` Wilco Dijkstra

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=mptim353lp5.fsf@arm.com \
    --to=richard.sandiford@arm.com \
    --cc=Kyrylo.Tkachov@arm.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=gcc-patches@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).