This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Unreviewed patch: get_mode_alignment fix
- To: gcc-patches at gcc dot gnu dot org
- Subject: Unreviewed patch: get_mode_alignment fix
- From: Lars Brinkhoff <lars dot spam at nocrew dot org>
- Date: 27 May 2001 14:28:12 +0200
- Organization: nocrew
- References: <85itjt9yso.fsf@junk.nocrew.org> <857l06ilhf.fsf@junk.nocrew.org>
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;