This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, committed] PowerPC block move alignment
- From: David Edelsohn <dje at watson dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 27 Aug 2005 11:56:38 -0400
- Subject: [PATCH, committed] PowerPC block move alignment
The decision tree for expand_block_clear() and expand_block_move()
test the bytes remaining against powers of 2 load sizes. All but the last
test for HImode use >= test. If the last iterations have 3 byte
remaining, this means that the functions will move a byte and then a
halfword, destroying the natural alignment. This patch makes the tests
uniform so that the natural alignment of the loads is preserved.
Bootstrapped and regression tested on powerpc-ibm-aix5.2.0.0.
Committed to mainline and 4.0. I would like to apply this to 3.4 as well.
David
PR target/23539
* config/rs6000/rs6000.c (expand_block_clear): Use HImode when
bytes >= 2 not bytes == 2.
(expand_block_move): Same.
Index: rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.862
diff -c -p -r1.862 rs6000.c
*** rs6000.c 23 Aug 2005 02:39:50 -0000 1.862
--- rs6000.c 26 Aug 2005 23:50:09 -0000
*************** expand_block_clear (rtx operands[])
*** 9133,9139 ****
clear_bytes = 4;
mode = SImode;
}
! else if (bytes == 2 && (align >= 16 || !STRICT_ALIGNMENT))
{ /* move 2 bytes */
clear_bytes = 2;
mode = HImode;
--- 9133,9139 ----
clear_bytes = 4;
mode = SImode;
}
! else if (bytes >= 2 && (align >= 16 || !STRICT_ALIGNMENT))
{ /* move 2 bytes */
clear_bytes = 2;
mode = HImode;
*************** expand_block_move (rtx operands[])
*** 9269,9275 ****
mode = SImode;
gen_func.mov = gen_movsi;
}
! else if (bytes == 2 && (align >= 16 || !STRICT_ALIGNMENT))
{ /* move 2 bytes */
move_bytes = 2;
mode = HImode;
--- 9269,9275 ----
mode = SImode;
gen_func.mov = gen_movsi;
}
! else if (bytes >= 2 && (align >= 16 || !STRICT_ALIGNMENT))
{ /* move 2 bytes */
move_bytes = 2;
mode = HImode;