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

commit dbb0bf3c552de9cfb09cd52c4136ffcca044e56b
Author: Michael Meissner <meiss...@linux.ibm.com>
Date:   Thu May 9 14:48:20 2024 -0400

    Limit SPR registers to hold only small integer modes.
    
    2024-05-08  Michael Meissner  <meiss...@linux.ibm.com>
    
            * config/rs6000/rs6000.cc (rs6000_hard_regno_mode_ok_uncached): 
Limit
            SPR registers to only hold only small integer modes.

Diff:
---
 gcc/config/rs6000/rs6000.cc | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 6bfcfdfb22c5..9f9f942a7860 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -1930,8 +1930,11 @@ rs6000_hard_regno_mode_ok_uncached (int regno, 
machine_mode mode)
   if (CR_REGNO_P (regno))
     return GET_MODE_CLASS (mode) == MODE_CC;
 
+  if (CA_REGNO_P (regno))
+    return mode == Pmode || mode == SImode;
+
   /* Limit SPR registers to integer modes that can fit in a single register.
-     Do not allow complex modes or modes that need sign/zero extension.  */
+     Do not allow complex modes.  */
   switch (regno)
     {
     case LR_REGNO:
@@ -1939,8 +1942,10 @@ rs6000_hard_regno_mode_ok_uncached (int regno, 
machine_mode mode)
     case TAR_REGNO:
     case VRSAVE_REGNO:
     case VSCR_REGNO:
-    case CA_REGNO:
-      return (orig_mode == Pmode || orig_mode == SImode);
+      return (orig_mode == Pmode
+             || orig_mode == SImode
+             || orig_mode == HImode
+             || orig_mode == QImode);
 
     default:
       break;

Reply via email to