Handling large vector modes in store_bit_field

Richard Sandiford rsandifo@redhat.com
Fri Sep 26 14:11:00 GMT 2003


Richard Henderson <rth@redhat.com> writes:
> On Wed, Sep 24, 2003 at 09:27:30PM +0100, Richard Sandiford wrote:
> > +      if (GET_MODE (value) == VOIDmode)
> > +	fieldmode = smallest_mode_for_size (nwords * BITS_PER_WORD, MODE_INT);
> 
> Seems like it would be better to do
> 
> 	fieldmode = GET_MODE (value);
> 	if (fieldmode == VOIDmode)
> 	  fieldmode = smallest_mode_for_size (...)
> 
> and then remove the conditional from its use in the loop.

Doh!  yes, indeed.

> Ok with that change.

Thanks.  For the record, here's what I checked in.  Tested on
i686-pc-linux-gnu and mipsisa64-elf.

Richard


	* expmed.c (store_bit_field): Don't search for an integer mode
	unless we need the result.

Index: expmed.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expmed.c,v
retrieving revision 1.141
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.141 expmed.c
--- expmed.c	5 Sep 2003 18:28:48 -0000	1.141
+++ expmed.c	26 Sep 2003 06:28:05 -0000
@@ -461,7 +461,9 @@ store_bit_field (rtx str_rtx, unsigned H
 	 VOIDmode, because that is what store_field uses to indicate that this
 	 is a bit field, but passing VOIDmode to operand_subword_force will
 	 result in an abort.  */
-      fieldmode = smallest_mode_for_size (nwords * BITS_PER_WORD, MODE_INT);
+      fieldmode = GET_MODE (value);
+      if (fieldmode == VOIDmode)
+	fieldmode = smallest_mode_for_size (nwords * BITS_PER_WORD, MODE_INT);
 
       for (i = 0; i < nwords; i++)
 	{
@@ -477,10 +479,7 @@ store_bit_field (rtx str_rtx, unsigned H
 	  store_bit_field (op0, MIN (BITS_PER_WORD,
 				     bitsize - i * BITS_PER_WORD),
 			   bitnum + bit_offset, word_mode,
-			   operand_subword_force (value, wordnum,
-						  (GET_MODE (value) == VOIDmode
-						   ? fieldmode
-						   : GET_MODE (value))),
+			   operand_subword_force (value, wordnum, fieldmode),
 			   total_size);
 	}
       return value;



More information about the Gcc-patches mailing list