]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Fix costing of move to/from MOVEABLE_SYSREGS
authorAndrew Carlotti <andrew.carlotti@arm.com>
Thu, 22 Aug 2024 10:59:33 +0000 (11:59 +0100)
committerAndrew Carlotti <andrew.carlotti@arm.com>
Mon, 21 Oct 2024 14:00:48 +0000 (15:00 +0100)
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.

gcc/config/aarch64/aarch64.cc

index 0dbc2aaa99ff0b0602c12e44546c7616bae68c73..21d9a6b5a20e6dbdd502252438308f5399f9ddff 100644 (file)
@@ -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))