On Mon, 06 Sep 2010 14:16:25 +0800 Yao Qi yao.qi@linaro.org wrote:
Yao Qi wrote:
Hi, We are looking for some possible improvements and optimizations on thumb2 code size. Currently, I am running some benchmarks with compilation flag "-Os -march=armv7-a -mthumb", and hope to find some thing interesting that we can improve. Beside that, do you have some ideas on this topic? or do you have some observations on thumb2 code that we may probably improve the size?
Any thoughts on this are appreciated.
I've put some ideas in this wiki page, https://wiki.linaro.org/Internal/People/YaoQi/Thumb2Optimize
People have pointed out problems with your first example already, but there might actually have been something possible to do there (I see you removed it already though!): the problem is that r8 is saved just to maintain 8-byte stack alignment, but that changes the prologue and epilogue push & pop instructions from 2-byte to 4-byte instructions.
I thought this was just an unfortunate corner case which we couldn't do anything about, but maybe it is... could we have pushed an extra low register instead (e.g. r3 instead of r8) to maintain stack alignment? Do you still have the code fragment handy (I don't remember exactly how it went)?
Julian