This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: get_mode_alignment fix
- To: gcc-patches at gcc dot gnu dot org
- Subject: Re: PATCH: get_mode_alignment fix
- From: Lars Brinkhoff <lars dot spam at nocrew dot org>
- Date: 27 Apr 2001 14:19:08 +0200
- Organization: nocrew
- References: <85itjt9yso.fsf@junk.nocrew.org>
Forgot the subject line, sorry about that.
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 the size, in bits, of a storage unit is a power of two.
>
> Bootstrapped on powerpc-unknown-linux-gnu and checked without regressions.
2001-04-25 Lars Brinkhoff <lars@nocrew.org>
* stor-layout.c (get_mode_alignment): remove the restriction
that machine mode sizes must be powers of two.
Index: stor-layout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stor-layout.c,v
retrieving revision 1.96
diff -c -3 -p -r1.96 stor-layout.c
*** stor-layout.c 2001/03/23 16:59:56 1.96
--- stor-layout.c 2001/04/25 07:49:49
*************** unsigned int
*** 1844,1855 ****
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,1855 ----
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 = MIN (BIGGEST_ALIGNMENT, MAX (1, alignment * BITS_PER_UNIT));
return alignment;
}