This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
> I use arm-ecos-elf-gcc v. 3.1 to compile C++ code. The compiler options are > > -g -Os -mthumb -Wall -Wstrict-prototypes -nostartfiles -Wa,-ahlms=$test.lst > -fno-rtti -fno-exceptions > > For the function: > > static void bcpy( char* to, const char* from, int length ) > { > for( int i = 0; i < length; i++ ) > to[i] = from[i]; > } > > I have got the next compilation result: > > 63 0018 10B5 push {r4, lr} > 64 001a 041C mov r4, r0 > 65 001c 081C mov r0, r1 > 66 001e 111C mov r1, r2 > 67 .LM5: > 68 .LBB3: > 69 .LBB4: > 70 0020 0022 mov r2, #0 > 71 0022 8A42 cmp r2, r1 > 72 0024 04DA bge .L9 > 73 .L7: > 74 .LM6: > 75 0026 835C ldrb r3, [r0, r2] > 76 0028 A354 strb r3, [r4, r2] > 77 .LM7: > 78 002a 0132 add r2, r2, #1 > 79 002c 8A42 cmp r2, r1 > 80 002e FADB blt .L7 > 81 .L9: > 82 .LM8: > 83 @ sp needed for prologue > 84 0030 10BD pop {r4, pc} > > The result is very strange from my point of view: there are a few excessive > register copying which should be avoided by register scheduler. What do you > think: the gcc register scheduler has some bug or the machine description is > guilty? It's the register allocator. The new allocator in the current sources does much better: ~/gnu/egcs/arm-elf/gcc/cc1plus -O2 -fnew-ra -mthumb foo.c _Z4bcpyPcPKci: push {r4, lr} mov r4, #0 cmp r4, r2 bge .L8 .L6: ldrb r3, [r1, r4] strb r3, [r0, r4] add r4, r4, #1 cmp r4, r2 blt .L6 .L8: @ sp needed for prologue pop {r4, pc} R. ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |