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]

Re: i960 and -mstrict-align


Sorry, I posted that patch too soon: I didn't allow for BLKmode.

This one is better, and	bootstrapped x86.  It's clearer too, I think.

Andrew.

2001-07-03  Andrew Haley  <aph@cambridge.redhat.com>

	* expmed.c (store_fixed_bit_field): Don't use a mode bigger than
	the mode of the memory location.

Index: expmed.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expmed.c,v
retrieving revision 1.76.2.1
diff -c -2 -p -r1.76.2.1 expmed.c
*** expmed.c	2001/05/12 20:32:26	1.76.2.1
--- expmed.c	2001/07/04 12:54:04
*************** store_fixed_bit_field (op0, offset, bits
*** 670,677 ****
        /* Get the proper mode to use for this field.  We want a mode that
  	 includes the entire field.  If such a mode would be larger than
! 	 a word, we won't be doing the extraction the normal way.  */
  
        mode = get_best_mode (bitsize, bitpos + offset * BITS_PER_UNIT,
! 			    struct_align, word_mode,
  			    GET_CODE (op0) == MEM && MEM_VOLATILE_P (op0));
  
--- 670,682 ----
        /* Get the proper mode to use for this field.  We want a mode that
  	 includes the entire field.  If such a mode would be larger than
! 	 a word, we won't be doing the extraction the normal way.  
! 	 We don't want a mode bigger than the destination.  */
  
+       mode = GET_MODE (op0);
+       if (GET_MODE_BITSIZE (mode) == 0
+           || GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (word_mode))
+         mode = word_mode;
        mode = get_best_mode (bitsize, bitpos + offset * BITS_PER_UNIT,
! 			    struct_align, mode,
  			    GET_CODE (op0) == MEM && MEM_VOLATILE_P (op0));
  


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