This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Unreviewed^4 patch: allow BITS_PER_UNIT != 2^n
- To: gcc-patches at gcc dot gnu dot org
- Subject: Unreviewed^4 patch: allow BITS_PER_UNIT != 2^n
- From: Lars Brinkhoff <lars at nocrew dot org>
- Date: 23 Jul 2001 15:03:48 +0200
- Organization: nocrew
- References: <85itjt9yso.fsf@junk.nocrew.org> <857l06ilhf.fsf@junk.nocrew.org><85bsof2cyr.fsf_-_@junk.nocrew.org>
This patch against mainline removes the restriction that BITS_PER_UNIT
must be a power of two. It has been bootstrapped and checked without
regressions on powerpc-unknown-linux-gnu.
Unreviewed versions of this patch:
http://gcc.gnu.org/ml/gcc-patches/2001-01/msg01244.html
http://gcc.gnu.org/ml/gcc-patches/2001-02/msg00721.html
http://gcc.gnu.org/ml/gcc-patches/2001-04/msg01333.html
http://gcc.gnu.org/ml/gcc-patches/2001-05/msg01913.html
2001-07-23 Lars Brinkhoff <lars@nocrew.org>
* stor-layout.c (get_mode_alignment): make it work when
BITS_PER_UNIT is not a power of two.
* builtins.c (get_pointer_alignment): Likewise.
Index: stor-layout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stor-layout.c,v
retrieving revision 1.99
diff -c -3 -p -r1.99 stor-layout.c
*** stor-layout.c 2001/07/02 10:27:17 1.99
--- stor-layout.c 2001/07/23 12:52:22
*************** unsigned int
*** 1866,1875 ****
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;
--- 1866,1876 ----
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: builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.c,v
retrieving revision 1.106
diff -c -3 -p -r1.106 builtins.c
*** builtins.c 2001/07/18 03:24:53 1.106
--- builtins.c 2001/07/23 12:52:21
*************** get_pointer_alignment (exp, max_align)
*** 186,193 ****
if (! host_integerp (TREE_OPERAND (exp, 1), 1))
return align;
! while (((tree_low_cst (TREE_OPERAND (exp, 1), 1) * BITS_PER_UNIT)
! & (max_align - 1))
!= 0)
max_align >>= 1;
--- 186,193 ----
if (! host_integerp (TREE_OPERAND (exp, 1), 1))
return align;
! while (((tree_low_cst (TREE_OPERAND (exp, 1), 1))
! & (max_align / BITS_PER_UNIT - 1))
!= 0)
max_align >>= 1;