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]

Unreviewed patch: get_mode_alignment fix


This patch is unreviewed since April 27.  Updated to current mainline
and bootstrapped on powerpc-unknown-linux-gnu.

Lars Brinkhoff <lars@nocrew.org> writes:
> get_mode_alignment() in stor-layout.c forces the alignment, in bits,
> to a power of two.  That works fine on 8/16/32-bit machines, but not
> on, say, a 36-bit machine.  This patch makes the alignment be a
> power of two in storage units, which makes no difference at all on
> machines where BITS_PER_UNIT is a power of two.
> 
> Bootstrapped on powerpc-unknown-linux-gnu and checked without regressions.

2001-05-27  Lars Brinkhoff  <lars@nocrew.org>

	* stor-layout.c (get_mode_alignment): make it work when
	BITS_PER_UNIT is not a power of two.

Index: stor-layout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stor-layout.c,v
retrieving revision 1.97
diff -c -3 -p -r1.97 stor-layout.c
*** stor-layout.c	2001/05/02 14:31:45	1.97
--- stor-layout.c	2001/05/27 12:07:30
*************** unsigned int
*** 1844,1853 ****
  get_mode_alignment (mode)
       enum machine_mode mode;
  {
!   unsigned int alignment = GET_MODE_UNIT_SIZE (mode) * BITS_PER_UNIT;
    
    /* Extract the LSB of the size.  */
    alignment = alignment & -alignment;
  
    alignment = MIN (BIGGEST_ALIGNMENT, MAX (1, alignment));
    return alignment;
--- 1844,1854 ----
  get_mode_alignment (mode)
       enum machine_mode mode;
  {
!   unsigned int alignment = GET_MODE_UNIT_SIZE (mode);
    
    /* Extract the LSB of the size.  */
    alignment = alignment & -alignment;
+   alignment *= BITS_PER_UNIT;
  
    alignment = MIN (BIGGEST_ALIGNMENT, MAX (1, alignment));
    return alignment;


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