diff mbox series

aarch64: Fix costing of move to/from MOVEABLE_SYSREGS

Message ID 304a06e3-e037-6467-6606-d08a2d4d1ce1@e124511.cambridge.arm.com
State New
Headers show
Series aarch64: Fix costing of move to/from MOVEABLE_SYSREGS | expand

Commit Message

Andrew Carlotti Oct. 1, 2024, 1:57 p.m. UTC
This is necessary to prevent reload assuming that a direct FP->FPMR move
is valid.

Bootstrapped and regression tested; ok for master?

gcc/ChangeLog:

	* config/aarch64/aarch64.cc (aarch64_register_move_cost):
	Increase costs involving MOVEABLE_SYSREGS.

Comments

Richard Sandiford Oct. 1, 2024, 2:11 p.m. UTC | #1
Andrew Carlotti <andrew.carlotti@arm.com> writes:
> This is necessary to prevent reload assuming that a direct FP->FPMR move
> is valid.
>
> Bootstrapped and regression tested; ok for master?
>
> gcc/ChangeLog:
>
> 	* config/aarch64/aarch64.cc (aarch64_register_move_cost):
> 	Increase costs involving MOVEABLE_SYSREGS.
>
>
> diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
> index c03ca2c24ed702803989024193dae07155445978..73a555d61cfb4c150cb5a0e7b9d09f3075f0c0b4 100644
> --- a/gcc/config/aarch64/aarch64.cc
> +++ b/gcc/config/aarch64/aarch64.cc
> @@ -15500,6 +15500,12 @@ aarch64_register_move_cost (machine_mode mode,
>  				reg_class_contents[FFR_REGS]))
>      return 80;
>  
> +  /* Moves to/from sysregs are expensive, and must go via GPR.  */
> +  if (from == MOVEABLE_SYSREGS)
> +    return 80 + aarch64_register_move_cost (mode, GENERAL_REGS, to);
> +  if (to == MOVEABLE_SYSREGS)
> +    return 80 + aarch64_register_move_cost (mode, from, GENERAL_REGS);
> +

LGTM.  There's precedent for hard-coding a very large value (for FFR)
and I agree that this case is similarly problematic.  And it doesn't
seem like a useful tuning parameter.

OK if there are no objections before Thursday local time.

Thanks,
Richard


>    /* Moving between GPR and stack cost is the same as GP2GP.  */
>    if ((from == GENERAL_REGS && to == STACK_REG)
>        || (to == GENERAL_REGS && from == STACK_REG))
diff mbox series

Patch

diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index c03ca2c24ed702803989024193dae07155445978..73a555d61cfb4c150cb5a0e7b9d09f3075f0c0b4 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -15500,6 +15500,12 @@  aarch64_register_move_cost (machine_mode mode,
 				reg_class_contents[FFR_REGS]))
     return 80;
 
+  /* Moves to/from sysregs are expensive, and must go via GPR.  */
+  if (from == MOVEABLE_SYSREGS)
+    return 80 + aarch64_register_move_cost (mode, GENERAL_REGS, to);
+  if (to == MOVEABLE_SYSREGS)
+    return 80 + aarch64_register_move_cost (mode, from, GENERAL_REGS);
+
   /* Moving between GPR and stack cost is the same as GP2GP.  */
   if ((from == GENERAL_REGS && to == STACK_REG)
       || (to == GENERAL_REGS && from == STACK_REG))