[PATCH V2] aarch64: Do not alter force_reg returned rtx expanding pauth builtins

2020-09-28 Thread Andrea Corallo
Hi all,

here the reworked patch addressing Richard's suggestions.

Regtested and bootsraped on aarch64-linux-gnu.

Okay for trunk?

Thanks!

  Andrea

>From 946d22aa247f2d1bb0c6b10a6e6db415b34feff2 Mon Sep 17 00:00:00 2001
From: Andrea Corallo 
Date: Mon, 21 Sep 2020 13:52:45 +0100
Subject: [PATCH] aarch64: Do not alter force_reg returned rtx expanding pauth
 builtins

2020-09-21  Andrea Corallo  

* config/aarch64/aarch64-builtins.c
(aarch64_general_expand_builtin): Do not alter value on a
force_reg returned rtx.
---
 gcc/config/aarch64/aarch64-builtins.c | 13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/gcc/config/aarch64/aarch64-builtins.c 
b/gcc/config/aarch64/aarch64-builtins.c
index b787719cf5e..d7eb8772b14 100644
--- a/gcc/config/aarch64/aarch64-builtins.c
+++ b/gcc/config/aarch64/aarch64-builtins.c
@@ -2079,20 +2079,13 @@ aarch64_general_expand_builtin (unsigned int fcode, 
tree exp, rtx target,
   arg0 = CALL_EXPR_ARG (exp, 0);
   op0 = force_reg (Pmode, expand_normal (arg0));
 
-  if (!target)
-   target = gen_reg_rtx (Pmode);
-  else
-   target = force_reg (Pmode, target);
-
-  emit_move_insn (target, op0);
-
   if (fcode == AARCH64_PAUTH_BUILTIN_XPACLRI)
{
  rtx lr = gen_rtx_REG (Pmode, R30_REGNUM);
  icode = CODE_FOR_xpaclri;
  emit_move_insn (lr, op0);
  emit_insn (GEN_FCN (icode) ());
- emit_move_insn (target, lr);
+ return lr;
}
   else
{
@@ -2122,11 +2115,9 @@ aarch64_general_expand_builtin (unsigned int fcode, tree 
exp, rtx target,
  emit_move_insn (x17_reg, op0);
  emit_move_insn (x16_reg, op1);
  emit_insn (GEN_FCN (icode) ());
- emit_move_insn (target, x17_reg);
+ return x17_reg;
}
 
-  return target;
-
 case AARCH64_JSCVT:
   {
expand_operand ops[2];
-- 
2.17.1



Re: [PATCH V2] aarch64: Do not alter force_reg returned rtx expanding pauth builtins

2020-09-28 Thread Richard Sandiford
Andrea Corallo  writes:
> Hi all,
>
> here the reworked patch addressing Richard's suggestions.
>
> Regtested and bootsraped on aarch64-linux-gnu.
>
> Okay for trunk?

OK, thanks.

Richard


Re: [PATCH V2] aarch64: Do not alter force_reg returned rtx expanding pauth builtins

2020-09-28 Thread Andrea Corallo
Richard Sandiford  writes:

> Andrea Corallo  writes:
>> Hi all,
>>
>> here the reworked patch addressing Richard's suggestions.
>>
>> Regtested and bootsraped on aarch64-linux-gnu.
>>
>> Okay for trunk?
>
> OK, thanks.
>
> Richard

Into trunk as 92f0d3d03a7.

Thanks!

  Andrea