Fix off-by-one when computing VRSAVE on rs6000

Geoffrey Keating gkeating@apple.com
Wed Nov 5 18:15:00 GMT 2003


vregno is the next register to use, so it is not actually in use, so
we do need to have a bit set in the VRSAVE mask if we're going to be
using it.

This usually has no effect on Darwin, because Darwin groups the
registers into sets of 4 when doing the saving.

Bootstrapped & tested on powerpc-darwin.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/rs6000-vrsaveoffbyone.patch===============
2003-11-05  Geoffrey Keating  <geoffk@apple.com>

	* config/rs6000/rs6000.c (compute_vrsave_mask): Correct off-by-one
	error.

Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.541
diff -u -p -u -p -r1.541 rs6000.c
--- config/rs6000/rs6000.c	3 Nov 2003 21:44:08 -0000	1.541
+++ config/rs6000/rs6000.c	5 Nov 2003 18:12:20 -0000
@@ -10109,7 +10128,7 @@ compute_vrsave_mask (void)
      them in again.  More importantly, the mask we compute here is
      used to generate CLOBBERs in the set_vrsave insn, and we do not
      wish the argument registers to die.  */
-  for (i = cfun->args_info.vregno; i >= ALTIVEC_ARG_MIN_REG; --i)
+  for (i = cfun->args_info.vregno - 1; i >= ALTIVEC_ARG_MIN_REG; --i)
     mask &= ~ALTIVEC_REG_BIT (i);
 
   /* Similarly, remove the return value from the set.  */
============================================================



More information about the Gcc-patches mailing list