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]

Re: arm-ecos-elf-gcc strange optimization


> With -Os:
> 
>   21 0000 38309FE5 		ldr	r3, .L2
>   22 0004 4120A0E3 		mov	r2, #65
>   23 0008 002083E5 		str	r2, [r3, #0]
>   24              	.LM3:
>   25 000c 232DA0E3 		mov	r2, #2240
>   26 0010 1C3043E2 		sub	r3, r3, #28
>   27 0014 002083E5 		str	r2, [r3, #0]
>   28              	.LM4:
>   29 0018 2820A0E3 		mov	r2, #40
>   30 001c 243083E2 		add	r3, r3, #36
>   31 0020 002083E5 		str	r2, [r3, #0]
>   32              	.LM5:
>   33 0024 4D2F82E2 		add	r2, r2, #308
>   34 0028 283043E2 		sub	r3, r3, #40
>   35 002c 002083E5 		str	r2, [r3, #0]
>   36              	.LM6:
>   37 0030 0C309FE5 		ldr	r3, .L2+4
>   38 0034 0329A0E3 		mov	r2, #49152
>   39              	.LM7:
>   40              		@ lr needed for prologue
>   41              	.LM8:
>   42 0038 002083E5 		str	r2, [r3, #0]
>   43 003c 0EF0A0E1 		mov	pc, lr
>   44              	.L3:
>   45              		.align	2
>   46              	.L2:
>   47 0040 2000FDFF 		.word	-196576
>   48 0044 0400FFFF 		.word	-65532
> 
> Any thoughts?

I think the front-end optimizer is interacting badly with the back-end in 
this case, because your addresses are absolute constants.

Of course the compiler should be producing something like

 		ldr	r3, .L2
 		mov	r2, #65
 		str	r2, [r3, #0]
       	.LM3:
 		mov	r2, #2240
 		str	r2, [r3, #-28]!
       	.LM4:
 		mov	r2, #40
 		str	r2, [r3, #36]!
       	.LM5:
 		add	r2, r2, #308
 		str	r2, [r3, #-40]!
       	.LM6:
 		ldr	r3, .L2+4
 		mov	r2, #49152
       	.LM7:
       		@ lr needed for prologue
       	.LM8:
 		str	r2, [r3, #0]
 		mov	pc, lr
       	.L3:
       		.align	2
       	.L2:
 		.word	-196576
 		.word	-65532

Which is the same length overall.

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]