This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bit shifting CQImode values


On Mon, Aug 04, 2003 at 07:17:59PM -0700, Jim Wilson wrote:
> I noticed that your patch puts the argument in RI when it is shifted. 
> Then at the end of the function we put REG into CALL_FUSAGE.  So the
> function call usage info is different than where the function arguments
> actually are.  It isn't clear if this is a problem or not.  For a
> WORDS_REGISTER_OPERATION target, (reg:QI) indicates that the entire
> register is used, so it doesn't matter if the argument is in the upper
> bits rather than the lower bits.  Targets which don't use
> WORD_REGISTER_OPERATIONS are unlikely to be shifting arguments around. 
> So in practice I don't think there is a problem here.  Also, I don't
> think that anyone uses the function call usage info for anything other
> than identifying whole registers that contain arguments.

As you say, there didn't seem to be a problem with the usage info, but
I'd like to correct this to avoid potential future problems.  We really
are using the other end of the register, so I think it would be wiser to
mark the whole reg as used.

	* calls.c (load_register_parameters): Arrange for call_fusage to
	report the whole register as used when shifting to the msb.

Regtesting powerpc64-linux.  OK to install assuming no regressions?

Index: calls.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/calls.c,v
retrieving revision 1.291
diff -u -p -r1.291 calls.c
--- calls.c	30 Jul 2003 07:30:16 -0000	1.291
+++ calls.c	5 Aug 2003 06:32:38 -0000
@@ -1633,13 +1633,18 @@ load_register_parameters (struct arg_dat
 		  && (args[i].locate.where_pad
 		      == (BYTES_BIG_ENDIAN ? upward : downward)))
 		{
-		  rtx ri = gen_rtx_REG (word_mode, REGNO (reg));
 		  rtx x;
 		  int shift = (UNITS_PER_WORD - size) * BITS_PER_UNIT;
-		  x = expand_binop (word_mode, ashl_optab, ri,
-				    GEN_INT (shift), ri, 1, OPTAB_WIDEN);
-		  if (x != ri)
-		    emit_move_insn (ri, x);
+
+		  /* Assigning REG here rather than a temp makes CALL_FUSAGE
+		     report the whole reg as used.  Strictly speaking, the
+		     call only uses SIZE bytes at the msb end, but it doesn't
+		     seem worth generating rtl to say that.  */
+		  reg = gen_rtx_REG (word_mode, REGNO (reg));
+		  x = expand_binop (word_mode, ashl_optab, reg,
+				    GEN_INT (shift), reg, 1, OPTAB_WIDEN);
+		  if (x != reg)
+		    emit_move_insn (reg, x);
 		}
 #endif
 	    }

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]