stor-layout.c (get_mode_alignment): make it work when BITS_PER_UNIT is not a power...
authorLars Brinkhoff <lars@nocrew.org>
Wed, 25 Jul 2001 01:19:23 +0000 (01:19 +0000)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 25 Jul 2001 01:19:23 +0000 (18:19 -0700)
        * 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

gcc/ChangeLog
gcc/builtins.c
gcc/stor-layout.c

index 819ee9b8a78c54664ca911e2ea4899e94854054d..e7b06d2a3ffd2f4a69edf8ad9c69387121890f71 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
        * simplify-rtx.c (avoid_constant_pool_reference): Coerce
index 8a44a7c679864898cf438b6c66a2fbaf60faf1ad..c2ce7c8d49b2cc971d256e98231fea5b2e9cd84f 100644 (file)
@@ -186,8 +186,8 @@ get_pointer_alignment (exp, max_align)
          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))
+         while (((tree_low_cst (TREE_OPERAND (exp, 1), 1))
+                 & (max_align / BITS_PER_UNIT - 1))
                 != 0)
            max_align >>= 1;
 
index 3e7fb19073d7e0ef987d04a28e3ab8d2ff12f57c..2ac72e38f255725f01ffb49e86311e2677945b91 100644 (file)
@@ -1866,10 +1866,11 @@ unsigned int
 get_mode_alignment (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.  */
   alignment = alignment & -alignment;
+  alignment *= BITS_PER_UNIT;
 
   alignment = MIN (BIGGEST_ALIGNMENT, MAX (1, alignment));
   return alignment;