Andrea Corallo <andrea.cora...@arm.com> writes:
> Hi all,
>
> second version of the patch here implementing the suggestion of using
> create_output_operand and the expand_insn machinery.
>
> Regtested and bootsraped on aarch64-linux-gnu.
>
> Okay for trunk?
>
> Thanks
>
>   Andrea
>
> From bb35b56810f908c575fec11435071d1c37f6f1a3 Mon Sep 17 00:00:00 2001
> From: Andrea Corallo <andrea.cora...@arm.com>
> Date: Mon, 14 Sep 2020 14:47:24 +0100
> Subject: [PATCH] aarch64: Fix ICE on fpsr fpcr getters [PR96968]
>
> gcc/ChangeLog
>
> 2020-09-14  Andrea Corallo  <andrea.cora...@arm.com>
>
>       PR target/96968
>       * config/aarch64/aarch64-builtins.c
>       (aarch64_expand_fpsr_fpcr_setter): Fix comment nit.
>       (aarch64_expand_fpsr_fpcr_getter): New function, expand these
>       getters using expand_insn machinery.
>       (aarch64_general_expand_builtin): Make use of.
>
> gcc/testsuite/ChangeLog
>
> 2020-09-14  Andrea Corallo  <andrea.cora...@arm.com>
>
>       PR target/96968
>       * gcc.target/aarch64/pr96968.c: New test.
> ---
>  gcc/config/aarch64/aarch64-builtins.c      | 30 +++++++++++++++-------
>  gcc/testsuite/gcc.target/aarch64/pr96968.c | 28 ++++++++++++++++++++
>  2 files changed, 49 insertions(+), 9 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.target/aarch64/pr96968.c
>
> diff --git a/gcc/config/aarch64/aarch64-builtins.c 
> b/gcc/config/aarch64/aarch64-builtins.c
> index 4f33dd936c7..7bb93f3b0cd 100644
> --- a/gcc/config/aarch64/aarch64-builtins.c
> +++ b/gcc/config/aarch64/aarch64-builtins.c
> @@ -2024,7 +2024,7 @@ aarch64_expand_builtin_memtag (int fcode, tree exp, rtx 
> target)
>    return target;
>  }
>  
> -/* Expand an expression EXP as fpsr or cpsr setter (depending on
> +/* Expand an expression EXP as fpsr or fpcr setter (depending on
>     UNSPEC) using MODE.  */
>  static void
>  aarch64_expand_fpsr_fpcr_setter (int unspec, machine_mode mode, tree exp)
> @@ -2034,6 +2034,18 @@ aarch64_expand_fpsr_fpcr_setter (int unspec, 
> machine_mode mode, tree exp)
>    emit_insn (gen_aarch64_set (unspec, mode, op));
>  }
>  
> +/* Expand a fpsr or fpcr getter (depending on UNSPEC) using MODE.
> +   Return the target.  */
> +static rtx
> +aarch64_expand_fpsr_fpcr_getter (enum insn_code icode, machine_mode mode,
> +                              rtx target)
> +{
> +  expand_operand op;
> +  create_output_operand (&op, target, mode);
> +  expand_insn (icode, 1, &op);
> +  return target;

This needs to be:

  return op[0].value;

so that we use whatever target the expand machinery chose.

OK with that change, thanks.

Richard

Reply via email to