From: Mike Stump Date: Mon, 17 Aug 2015 09:39:58 +0000 (+0000) Subject: [ARM] arm memcpy of aligned data X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=48efbbe8a0b37d7da6a8bae0e28fccdeeaa82c63;p=gcc.git [ARM] arm memcpy of aligned data 2015-08-17 Mike Stump * config/arm/arm.c (arm_block_move_unaligned_straight): Emit normal move instead of unaligned load when source or destination are appropriately aligned. 2015-08-17 Mike Stump Kyrylo Tkachov * gcc.target/arm/memcpy-aligned-1.c: New test. Co-Authored-By: Kyrylo Tkachov From-SVN: r226935 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 20b87d7cae9..66bfd50a546 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-08-17 Mike Stump + + * config/arm/arm.c (arm_block_move_unaligned_straight): + Emit normal move instead of unaligned load when source or destination + are appropriately aligned. + 2015-08-17 Richard Biener Naveen H.S diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 6e15bf272aa..8ded4946a6a 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -14412,7 +14412,10 @@ arm_block_move_unaligned_straight (rtx dstbase, rtx srcbase, srcoffset + j * UNITS_PER_WORD - src_autoinc); mem = adjust_automodify_address (srcbase, SImode, addr, srcoffset + j * UNITS_PER_WORD); - emit_insn (gen_unaligned_loadsi (regs[j], mem)); + if (src_aligned) + emit_move_insn (regs[j], mem); + else + emit_insn (gen_unaligned_loadsi (regs[j], mem)); } srcoffset += words * UNITS_PER_WORD; } @@ -14431,7 +14434,10 @@ arm_block_move_unaligned_straight (rtx dstbase, rtx srcbase, dstoffset + j * UNITS_PER_WORD - dst_autoinc); mem = adjust_automodify_address (dstbase, SImode, addr, dstoffset + j * UNITS_PER_WORD); - emit_insn (gen_unaligned_storesi (mem, regs[j])); + if (dst_aligned) + emit_move_insn (mem, regs[j]); + else + emit_insn (gen_unaligned_storesi (mem, regs[j])); } dstoffset += words * UNITS_PER_WORD; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 28a231cc935..394a42fafdd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-08-17 Mike Stump + Kyrylo Tkachov + + * gcc.target/arm/memcpy-aligned-1.c: New test. + 2015-08-16 Francois-Xavier Coudert PR fortran/54656 diff --git a/gcc/testsuite/gcc.target/arm/memcpy-aligned-1.c b/gcc/testsuite/gcc.target/arm/memcpy-aligned-1.c new file mode 100644 index 00000000000..852b391388b --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/memcpy-aligned-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -save-temps" } */ + +void *memcpy (void *dest, const void *src, unsigned int n); + +void foo (char *dst, int i) +{ + memcpy (dst, &i, sizeof (i)); +} + +/* { dg-final { scan-assembler-times "str\t" 1 } } */ +/* { dg-final { scan-assembler-not "ldr\t" } } */