https://gcc.gnu.org/g:8193e71a07de010c041175e7a8acf62eeae5b336

commit r15-4520-g8193e71a07de010c041175e7a8acf62eeae5b336
Author: Andrew Carlotti <andrew.carlo...@arm.com>
Date:   Thu Aug 22 11:59:33 2024 +0100

    aarch64: Fix costing of move to/from MOVEABLE_SYSREGS
    
    This is necessary to prevent reload assuming that a direct FP->FPMR move
    is valid.
    
    gcc/ChangeLog:
    
            * config/aarch64/aarch64.cc (aarch64_register_move_cost):
            Increase costs involving MOVEABLE_SYSREGS.

Diff:
---
 gcc/config/aarch64/aarch64.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 0dbc2aaa99ff..21d9a6b5a20e 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -15565,6 +15565,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))

Reply via email to