------- Comment #1 from carrot at google dot com 2009-06-16 09:11 ------- Created an attachment (id=18005) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18005&action=view) test case
For this function void foo(int* p) { p[0] = 1; p[1] = 2; } gcc generates: mov r1, #1 mov r3, #2 str r1, [r0] str r3, [r0, #4] bx lr We use one stm instruction to replace two str instructions. For the second case: int bar(int* p) { int x = p[0] + p[1]; return x; } gcc generates: ldr r2, [r0, #4] ldr r3, [r0] add r0, r2, r3 bx lr In this case we can use on ldm to replace the two ldr instructions. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40457