PR54814 causes spill fails because reload.c:find_valid_class_1 tests only one
hard register instead of all hard registers of regno:mode in rclass:

http://gcc.gnu.org/PR54814


The patch was originally worked out by Bernd Schmidt and fixed a problem
introduced in

http://gcc.gnu.org/r190252

The patch is bootstrapped and tested on x86_64-linux and also fixes the spill
fails that originally occured on avr-unknown-one.

Ok to apply?


        PR other/54814
        * reload.c (find_valid_class_1): Use in_hard_reg_set_p instead of
        TEST_HARD_REG_BIT.
Index: gcc/reload.c
===================================================================
--- gcc/reload.c	(revision 194553)
+++ gcc/reload.c	(working copy)
@@ -709,7 +709,7 @@ find_valid_class (enum machine_mode oute
 }
 
 /* We are trying to reload a subreg of something that is not a register.
-   Find the largest class which has at least one register valid in
+   Find the largest class which contains only registers valid in
    mode MODE.  OUTER is the mode of the subreg, DEST_CLASS the class in
    which we would eventually like to obtain the object.  */
 
@@ -729,10 +729,12 @@ find_valid_class_1 (enum machine_mode ou
     {
       int bad = 0;
       for (regno = 0; regno < FIRST_PSEUDO_REGISTER && !bad; regno++)
-	if (TEST_HARD_REG_BIT (reg_class_contents[rclass], regno)
-	    && !HARD_REGNO_MODE_OK (regno, mode))
-	  bad = 1;
-
+	{
+	  if (in_hard_reg_set_p (reg_class_contents[rclass], mode, regno)
+	      && !HARD_REGNO_MODE_OK (regno, mode))
+	    bad = 1;
+	}
+      
       if (bad)
 	continue;
 

Reply via email to