gcc/expmed.c 1.63->1.64

Richard Henderson rth@cygnus.com
Mon Sep 25 00:09:00 GMT 2000


On Sun, Sep 24, 2000 at 09:08:39PM -0400, Craig Newell wrote:
> 2000-09-15  Richard Henderson  <rth@cygnus.com>
> 
>         * expmed.c (store_bit_field): Consider naturally aligned
>         memory for direct reference.
[...]
>   This will generate a word store at a non-aligned address no matter what
> options you give gcc.

Indeed.  I've checked in your packed structure test case;
here is the fix.


r~


        * expmed.c (store_bit_field): Adjust last change to not consider
        any word-sized field naturally aligned.

Index: expmed.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/expmed.c,v
retrieving revision 1.64
diff -c -p -d -r1.64 expmed.c
*** expmed.c	2000/09/15 11:13:04	1.64
--- expmed.c	2000/09/25 07:05:31
*************** store_bit_field (str_rtx, bitsize, bitnu
*** 305,316 ****
       memory, any naturally sized, unit aligned field can be done directly.  */
       
    if (bitsize == GET_MODE_BITSIZE (fieldmode)
!       && (GET_MODE_SIZE (fieldmode) >= UNITS_PER_WORD
! 	  || GET_MODE_SIZE (GET_MODE (op0)) == GET_MODE_SIZE (fieldmode)
! 	  || (GET_CODE (op0) == MEM
! 	      && (! SLOW_UNALIGNED_ACCESS (fieldmode, align)
! 		  || (offset * BITS_PER_UNIT % bitsize == 0
! 		      && align % GET_MODE_BITSIZE (fieldmode) == 0))))
        && (BYTES_BIG_ENDIAN ? bitpos + bitsize == unit : bitpos == 0))
      {
        if (GET_MODE (op0) != fieldmode)
--- 305,316 ----
       memory, any naturally sized, unit aligned field can be done directly.  */
       
    if (bitsize == GET_MODE_BITSIZE (fieldmode)
!       && (GET_CODE (op0) != MEM
! 	  ? (GET_MODE_SIZE (fieldmode) >= UNITS_PER_WORD
! 	     || GET_MODE_SIZE (GET_MODE (op0)) == GET_MODE_SIZE (fieldmode))
! 	  : (! SLOW_UNALIGNED_ACCESS (fieldmode, align)
! 	     || (offset * BITS_PER_UNIT % bitsize == 0
! 		 && align % GET_MODE_BITSIZE (fieldmode) == 0)))
        && (BYTES_BIG_ENDIAN ? bitpos + bitsize == unit : bitpos == 0))
      {
        if (GET_MODE (op0) != fieldmode)


More information about the Gcc-bugs mailing list