On Tue, Feb 09, 2021 at 02:38:44PM +0100, Andrea Corallo via Gcc-patches wrote:
> >From c8216ed1313d670e79b28141dadd644e698c83cf Mon Sep 17 00:00:00 2001
> From: Andrea Corallo <andrea.cora...@arm.com>
> Date: Wed, 3 Feb 2021 15:21:54 +0100
> Subject: [PATCH] arm: Low overhead loop handle long range branches [PR98931]
> 
> gcc/ChangeLog
> 
> 2021-02-05  Andrea Corallo  <andrea.cora...@arm.com>
> 
>         * config/arm/thumb2.md: Generate alternative sequence to
>       handle long range branches.
> 
> gcc/testsuite/Changelog
> 
> 2021-02-08  Andrea Corallo  <andrea.cora...@arm.com>
> 
>          * gcc.target/arm/pr98931.c: New testcase.
> ---
>  gcc/config/arm/thumb2.md               | 13 ++++++++++++-
>  gcc/testsuite/gcc.target/arm/pr98931.c | 17 +++++++++++++++++
>  2 files changed, 29 insertions(+), 1 deletion(-)
>  create mode 100644 gcc/testsuite/gcc.target/arm/pr98931.c
> 
> diff --git a/gcc/config/arm/thumb2.md b/gcc/config/arm/thumb2.md
> index bd53bf320de..2646926d3c1 100644
> --- a/gcc/config/arm/thumb2.md
> +++ b/gcc/config/arm/thumb2.md
> @@ -1719,7 +1719,18 @@
>                (set (reg:SI LR_REGNUM)
>                     (plus:SI (reg:SI LR_REGNUM) (const_int -1)))])]
>    "TARGET_32BIT && TARGET_HAVE_LOB"
> -  "le\t%|lr, %l0")
> +  "*
> +  if (get_attr_length (insn) == 4)
> +    return \"le\\t%|lr, %l0\";
> +  else
> +    return \"subs\\t%|lr, #1\;bne\\t%l0\";
> +  "

Why not
{
  if (get_attr_length (insn) == 4)
    return "le\t%|lr, %l0";
  else
    return "subs\t%|lr, #1;bne\t%l0";
}
instead?  Seems the arm backend uses "*..." more than the more modern {},
but one needs to backslash prefix a lot which makes it less readable?

        Jakub

Reply via email to