https://gcc.gnu.org/g:d1a7529aaec43878cc0d0a5e754d894a1857d18a

commit d1a7529aaec43878cc0d0a5e754d894a1857d18a
Author: Michael Meissner <meiss...@linux.ibm.com>
Date:   Thu Apr 25 18:10:35 2024 -0400

    Make moves from SPRs higher in cost.
    
    2024-04-25  Michael Meissner  <meiss...@linux.ibm.com>
    
    gcc/
    
            * config/rs6000/rs6000.cc (rs6000_register_move_cost): Make moves 
from
            SPRs more expensive.

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

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 908ad5dcb58..d498f62be7a 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -22813,6 +22813,16 @@ rs6000_register_move_cost (machine_mode mode,
       ret = 2 * hard_regno_nregs (reg, mode);
     }
 
+  /* Make moves from SPR registers (LR, CTR, TAR) more expensive so that the
+     register allocator does not think of these registers are useful for saving
+     results.  */
+  else if (reg_classes_intersect_p (from, SPECIAL_REGS)
+          && reg_classes_intersect_p (to, GENERAL_REGS))
+    {
+      rclass = from;
+      ret = 6;
+    }
+
   /*  Moves from/to GENERAL_REGS.  */
   else if ((rclass = from, reg_classes_intersect_p (to, GENERAL_REGS))
           || (rclass = to, reg_classes_intersect_p (from, GENERAL_REGS)))

Reply via email to