Commit 0c237688 by Lars Brinkhoff Committed by Richard Henderson

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

        * 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.

From-SVN: r44322
parent 5a2aa3bd
2001-07-24 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.
2001-07-24 Richard Henderson <rth@redhat.com> 2001-07-24 Richard Henderson <rth@redhat.com>
* simplify-rtx.c (avoid_constant_pool_reference): Coerce * simplify-rtx.c (avoid_constant_pool_reference): Coerce
......
...@@ -186,8 +186,8 @@ get_pointer_alignment (exp, max_align) ...@@ -186,8 +186,8 @@ get_pointer_alignment (exp, max_align)
if (! host_integerp (TREE_OPERAND (exp, 1), 1)) if (! host_integerp (TREE_OPERAND (exp, 1), 1))
return align; return align;
while (((tree_low_cst (TREE_OPERAND (exp, 1), 1) * BITS_PER_UNIT) while (((tree_low_cst (TREE_OPERAND (exp, 1), 1))
& (max_align - 1)) & (max_align / BITS_PER_UNIT - 1))
!= 0) != 0)
max_align >>= 1; max_align >>= 1;
......
...@@ -1866,10 +1866,11 @@ unsigned int ...@@ -1866,10 +1866,11 @@ unsigned int
get_mode_alignment (mode) get_mode_alignment (mode)
enum machine_mode mode; enum machine_mode mode;
{ {
unsigned int alignment = GET_MODE_UNIT_SIZE (mode) * BITS_PER_UNIT; unsigned int alignment = GET_MODE_UNIT_SIZE (mode);
/* Extract the LSB of the size. */ /* Extract the LSB of the size. */
alignment = alignment & -alignment; alignment = alignment & -alignment;
alignment *= BITS_PER_UNIT;
alignment = MIN (BIGGEST_ALIGNMENT, MAX (1, alignment)); alignment = MIN (BIGGEST_ALIGNMENT, MAX (1, alignment));
return alignment; return alignment;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment