Commit f64d6991 by David Edelsohn Committed by David Edelsohn

expr.c (move_by_pieces): Set alignment for move to minimum of MOVE_MAX_PIECES…

expr.c (move_by_pieces): Set alignment for move to minimum of MOVE_MAX_PIECES mode alignment and the...

        * expr.c (move_by_pieces): Set alignment for move to minimum of
        MOVE_MAX_PIECES mode alignment and the largest non-slow mode
        alignment, but not less than the original alignment.
        (move_by_pieces_ninsns): Same.
        (can_store_by_pieces): Similar for store with STORE_MAX_PIECES.
        (store_by_pieces_1): Same.

From-SVN: r85875
parent c597ef4e
2004-08-12 David Edelsohn <edelsohn@gnu.org>
* expr.c (move_by_pieces): Set alignment for move to minimum of
MOVE_MAX_PIECES mode alignment and the largest non-slow mode
alignment, but not less than the original alignment.
(move_by_pieces_ninsns): Same.
(can_store_by_pieces): Similar for store with STORE_MAX_PIECES.
(store_by_pieces_1): Same.
2004-08-12 Diego Novillo <dnovillo@redhat.com> 2004-08-12 Diego Novillo <dnovillo@redhat.com>
PR tree-optimization/16867 PR tree-optimization/16867
......
...@@ -925,9 +925,22 @@ move_by_pieces (rtx to, rtx from, unsigned HOST_WIDE_INT len, ...@@ -925,9 +925,22 @@ move_by_pieces (rtx to, rtx from, unsigned HOST_WIDE_INT len,
data.to_addr = copy_addr_to_reg (to_addr); data.to_addr = copy_addr_to_reg (to_addr);
} }
if (! SLOW_UNALIGNED_ACCESS (word_mode, align) tmode = mode_for_size (MOVE_MAX_PIECES * BITS_PER_UNIT, MODE_INT, 1);
|| align > MOVE_MAX * BITS_PER_UNIT || align >= BIGGEST_ALIGNMENT) if (align >= GET_MODE_ALIGNMENT (tmode))
align = MOVE_MAX * BITS_PER_UNIT; align = GET_MODE_ALIGNMENT (tmode);
else
{
enum machine_mode xmode;
for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT), xmode = tmode;
tmode != VOIDmode;
xmode = tmode, tmode = GET_MODE_WIDER_MODE (tmode))
if (GET_MODE_SIZE (tmode) > MOVE_MAX_PIECES
|| SLOW_UNALIGNED_ACCESS (tmode, align))
break;
align = MAX (align, GET_MODE_ALIGNMENT (xmode));
}
/* First move what we can in the largest integer mode, then go to /* First move what we can in the largest integer mode, then go to
successively smaller modes. */ successively smaller modes. */
...@@ -992,14 +1005,28 @@ move_by_pieces_ninsns (unsigned HOST_WIDE_INT l, unsigned int align, ...@@ -992,14 +1005,28 @@ move_by_pieces_ninsns (unsigned HOST_WIDE_INT l, unsigned int align,
unsigned int max_size) unsigned int max_size)
{ {
unsigned HOST_WIDE_INT n_insns = 0; unsigned HOST_WIDE_INT n_insns = 0;
enum machine_mode tmode;
if (! SLOW_UNALIGNED_ACCESS (word_mode, align) tmode = mode_for_size (MOVE_MAX_PIECES * BITS_PER_UNIT, MODE_INT, 1);
|| align > MOVE_MAX * BITS_PER_UNIT || align >= BIGGEST_ALIGNMENT) if (align >= GET_MODE_ALIGNMENT (tmode))
align = MOVE_MAX * BITS_PER_UNIT; align = GET_MODE_ALIGNMENT (tmode);
else
{
enum machine_mode tmode, xmode;
for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT), xmode = tmode;
tmode != VOIDmode;
xmode = tmode, tmode = GET_MODE_WIDER_MODE (tmode))
if (GET_MODE_SIZE (tmode) > MOVE_MAX_PIECES
|| SLOW_UNALIGNED_ACCESS (tmode, align))
break;
align = MAX (align, GET_MODE_ALIGNMENT (xmode));
}
while (max_size > 1) while (max_size > 1)
{ {
enum machine_mode mode = VOIDmode, tmode; enum machine_mode mode = VOIDmode;
enum insn_code icode; enum insn_code icode;
for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT); for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT);
...@@ -1999,9 +2026,22 @@ can_store_by_pieces (unsigned HOST_WIDE_INT len, ...@@ -1999,9 +2026,22 @@ can_store_by_pieces (unsigned HOST_WIDE_INT len,
if (! STORE_BY_PIECES_P (len, align)) if (! STORE_BY_PIECES_P (len, align))
return 0; return 0;
if (! SLOW_UNALIGNED_ACCESS (word_mode, align) tmode = mode_for_size (STORE_MAX_PIECES * BITS_PER_UNIT, MODE_INT, 1);
|| align > MOVE_MAX * BITS_PER_UNIT || align >= BIGGEST_ALIGNMENT) if (align >= GET_MODE_ALIGNMENT (tmode))
align = MOVE_MAX * BITS_PER_UNIT; align = GET_MODE_ALIGNMENT (tmode);
else
{
enum machine_mode xmode;
for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT), xmode = tmode;
tmode != VOIDmode;
xmode = tmode, tmode = GET_MODE_WIDER_MODE (tmode))
if (GET_MODE_SIZE (tmode) > STORE_MAX_PIECES
|| SLOW_UNALIGNED_ACCESS (tmode, align))
break;
align = MAX (align, GET_MODE_ALIGNMENT (xmode));
}
/* We would first store what we can in the largest integer mode, then go to /* We would first store what we can in the largest integer mode, then go to
successively smaller modes. */ successively smaller modes. */
...@@ -2201,9 +2241,22 @@ store_by_pieces_1 (struct store_by_pieces *data ATTRIBUTE_UNUSED, ...@@ -2201,9 +2241,22 @@ store_by_pieces_1 (struct store_by_pieces *data ATTRIBUTE_UNUSED,
data->to_addr = copy_addr_to_reg (to_addr); data->to_addr = copy_addr_to_reg (to_addr);
} }
if (! SLOW_UNALIGNED_ACCESS (word_mode, align) tmode = mode_for_size (STORE_MAX_PIECES * BITS_PER_UNIT, MODE_INT, 1);
|| align > MOVE_MAX * BITS_PER_UNIT || align >= BIGGEST_ALIGNMENT) if (align >= GET_MODE_ALIGNMENT (tmode))
align = MOVE_MAX * BITS_PER_UNIT; align = GET_MODE_ALIGNMENT (tmode);
else
{
enum machine_mode xmode;
for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT), xmode = tmode;
tmode != VOIDmode;
xmode = tmode, tmode = GET_MODE_WIDER_MODE (tmode))
if (GET_MODE_SIZE (tmode) > STORE_MAX_PIECES
|| SLOW_UNALIGNED_ACCESS (tmode, align))
break;
align = MAX (align, GET_MODE_ALIGNMENT (xmode));
}
/* First store what we can in the largest integer mode, then go to /* First store what we can in the largest integer mode, then go to
successively smaller modes. */ successively smaller modes. */
......
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