Re: Thumb2 code size improvements

2010-09-20 Thread Dave Martin
Hi, On Sun, Sep 19, 2010 at 9:40 PM, Michael Hope wrote: [...] >>> I've just modified this to build different variants as well.  ffmpeg >>> now builds as supplied (-O2 and others), with -Os, with hand-written >>> assembler turned off, and with -mfpu=neon.  corebench builds in -O2 >>> and -Os.

Re: Thumb2 code size improvements

2010-09-19 Thread Michael Hope
On Sat, Sep 18, 2010 at 3:00 AM, Dave Martin wrote: > Hi, > > On Fri, Sep 17, 2010 at 3:50 AM, Michael Hope wrote: >> It's only part of the puzzle, but I run speed benchmarks as part of >> the continious build: >>  http://ex.seabright.co.nz/helpers/buildlog >>  http://ex.seabright.co.nz/helpers/b

Re: Thumb2 code size improvements

2010-09-17 Thread Dave Martin
Hi, On Fri, Sep 17, 2010 at 3:50 AM, Michael Hope wrote: > It's only part of the puzzle, but I run speed benchmarks as part of > the continious build: >  http://ex.seabright.co.nz/helpers/buildlog >  http://ex.seabright.co.nz/helpers/benchcompare >  http://ex.seabright.co.nz/build/gcc-linaro-4.5-

Re: Thumb2 code size improvements

2010-09-17 Thread Yao Qi
Richard Earnshaw wrote: >>> I've just modified this to build different variants as well. ffmpeg >>> now builds as supplied (-O2 and others), with -Os, with hand-written >>> assembler turned off, and with -mfpu=neon. corebench builds in -O2 >>> and -Os. >> Here are some options we may have to use

Re: Thumb2 code size improvements

2010-09-17 Thread Richard Earnshaw
On Fri, 2010-09-17 at 18:21 +0800, Yao Qi wrote: > Michael Hope wrote: > > It's only part of the puzzle, but I run speed benchmarks as part of > > the continious build: > > http://ex.seabright.co.nz/helpers/buildlog > > http://ex.seabright.co.nz/helpers/benchcompare > > > > http://ex.seabright

Re: Thumb2 code size improvements

2010-09-17 Thread Yao Qi
Michael Hope wrote: > It's only part of the puzzle, but I run speed benchmarks as part of > the continious build: > http://ex.seabright.co.nz/helpers/buildlog > http://ex.seabright.co.nz/helpers/benchcompare > > http://ex.seabright.co.nz/build/gcc-linaro-4.5-2010.09-1/logs/armv7l-maverick-cbuil

Re: Thumb2 code size improvements

2010-09-16 Thread Michael Hope
It's only part of the puzzle, but I run speed benchmarks as part of the continious build: http://ex.seabright.co.nz/helpers/buildlog http://ex.seabright.co.nz/helpers/benchcompare http://ex.seabright.co.nz/build/gcc-linaro-4.5-2010.09-1/logs/armv7l-maverick-cbuild4-pavo4/pybench-test.txt I've

Re: Thumb2 code size improvements

2010-09-16 Thread Dave Martin
It would be interesting if we could get a good, representative set of comparative benchmarks for the size and performance impact of -Os. I did a bit of investigation here: https://wiki.linaro.org/Platform/Foundations/OptimiseForSize (though with just a few packages and only one benchmark, it's n

Re: Thumb2 code size improvements

2010-09-10 Thread Richard Earnshaw
On Tue, 2010-09-07 at 12:24 +0100, Julian Brown wrote: > On Tue, 7 Sep 2010 12:55:59 +0200 > Loïc Minier wrote: > > > On Tue, Sep 07, 2010, Julian Brown wrote: > > > Do > > > you still have the code fragment handy (I don't rem

Re: Thumb2 code size improvements

2010-09-10 Thread Richard Earnshaw
On Tue, 2010-09-07 at 13:09 +0100, Andrew Stubbs wrote: > On 07/09/10 13:01, Yao Qi wrote: > >> * Investigate reduced alignment constraints? > > > > Any details on this? > > No, I just know that some targets like to align functions to > cache-lines. This is a useful speed optimization, but does

Re: Thumb2 code size improvements

2010-09-10 Thread Mark Mitchell
On 9/10/2010 2:17 AM, Dave Martin wrote: > (int)((unsigned)c << 28) >> 28 > > is invalid C, because the result of the unsigned->signed cast (needed > to get arithmetic right shift) is undefined if the argument is > > INT_MAX. True, but undefined-ness (or, in this case, implementation-defined-ne

Re: Thumb2 code size improvements

2010-09-10 Thread Dave Martin
On Fri, Sep 10, 2010 at 2:14 AM, Nicolas Pitre wrote: [...] >                lsl     r0, r0, #28 >                asr     r0, r0, #28 >                bx      lr > > But I doubt gcc could ever become that smart. Some pointed out to me that the tempting C equivalent (int)((unsigned)c << 28) >>

Re: Thumb2 code size improvements

2010-09-09 Thread Nicolas Pitre
On Thu, 9 Sep 2010, Andrew Stubbs wrote: > On 09/09/10 16:22, Yao Qi wrote: > > GCC produces code like this, > > 0024: > >24: f000 000f and.w r0, r0, #15 > >28: 2807cmp r0, #7 > >2a: d901bls.n 30 > >2c: 3810subsr0, #

Re: Thumb2 code size improvements

2010-09-09 Thread Andrew Stubbs
On 09/09/10 16:22, Yao Qi wrote: > GCC produces code like this, > 0024: >24: f000 000f and.w r0, r0, #15 >28: 2807cmp r0, #7 >2a: d901bls.n 30 >2c: 3810subsr0, #16 >2e: b280uxthr0, r0<--[1] >

Re: Thumb2 code size improvements

2010-09-09 Thread Yao Qi
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 >

Re: Thumb2 code size improvements

2010-09-08 Thread Yao Qi
Chung-Lin Tang wrote: > This reminds me of a PR that Bernd did: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40657 > > It is also support for adding the r0-r3 registers to the > epilogue/prologue push-pop for sake of reducing code size, though in a > sense even more aggressive; it tries to merge

Re: Thumb2 code size improvements

2010-09-07 Thread Chung-Lin Tang
This reminds me of a PR that Bernd did: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40657 It is also support for adding the r0-r3 registers to the epilogue/prologue push-pop for sake of reducing code size, though in a sense even more aggressive; it tries to merge the local stack allocation SP s

Re: Thumb2 code size improvements

2010-09-07 Thread Julian Brown
On Tue, 07 Sep 2010 21:06:10 +0800 Yao Qi wrote: > Julian Brown wrote: > > So yeah, I think there is indeed a possible improvement here (and we > > don't even need to break the EABI, I don't think). Unless I've > > overlooked something, anyway... > Julian, > I revert back the first example, and a

Re: Thumb2 code size improvements

2010-09-07 Thread Yao Qi
Loïc Minier wrote: > I see you moved the wiki page to the public space, thanks > > Couple of notes: > * make sure you use the rename action on the page, I think this will >preserver history (I didn't check whether you did or not, but I think >not) No, I didn't. I use copy and paste.

Re: Thumb2 code size improvements

2010-09-07 Thread Yao Qi
Julian Brown wrote: > On Tue, 7 Sep 2010 12:55:59 +0200 > Loïc Minier wrote: > >> On Tue, Sep 07, 2010, Julian Brown wrote: >>> Do >>> you still have the code fragment handy (I don't remember exactly how >>> it went)? >> You c

Re: Thumb2 code size improvements

2010-09-07 Thread Andrew Stubbs
On 07/09/10 13:01, Yao Qi wrote: >> * Investigate reduced alignment constraints? > > Any details on this? No, I just know that some targets like to align functions to cache-lines. This is a useful speed optimization, but does lead to lots of "blank" gaps in the code. I have no real idea if ARM d

Re: Thumb2 code size improvements

2010-09-07 Thread Yao Qi
Andrew Stubbs wrote: > On 06/09/10 07:16, Yao Qi wrote: >> I've put some ideas in this wiki page, >> https://wiki.linaro.org/Internal/People/YaoQi/Thumb2Optimize > > We probably shouldn't post Internal links to this public list. Is there > any reason this can't be done in the open? I've moved thi

Re: Thumb2 code size improvements

2010-09-07 Thread Julian Brown
On Tue, 7 Sep 2010 12:55:59 +0200 Loïc Minier wrote: > On Tue, Sep 07, 2010, Julian Brown wrote: > > Do > > you still have the code fragment handy (I don't remember exactly how > > it went)? > > You can extract it from the wi

Re: Thumb2 code size improvements

2010-09-07 Thread Loïc Minier
On Tue, Sep 07, 2010, Julian Brown wrote: > Do > you still have the code fragment handy (I don't remember exactly how > it went)? You can extract it from the wiki history with the "Info" action on the page and then diffing rev

Re: Thumb2 code size improvements

2010-09-07 Thread Julian Brown
On Mon, 06 Sep 2010 14:16:25 +0800 Yao Qi 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 in

Re: Thumb2 code size improvements

2010-09-07 Thread Andrew Stubbs
On 06/09/10 07:16, Yao Qi wrote: > I've put some ideas in this wiki page, > https://wiki.linaro.org/Internal/People/YaoQi/Thumb2Optimize We probably shouldn't post Internal links to this public list. Is there any reason this can't be done in the open? Now for the page content I think you s

Re: Thumb2 code size improvements

2010-09-06 Thread Yao Qi
Nicolas Pitre wrote: > > > Your remark for the first example is wrong. GCC has to store r8 (or any > other register for that matter) in order to keep the stack pointer > 64-bit aligned, as required by EABI. Nicolas, Thanks for letting me know this. I've marked this example as wrong in wiki.

Re: Thumb2 code size improvements

2010-09-06 Thread Nicolas Pitre
On Mon, 6 Sep 2010, Yao Qi 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 w

Re: Thumb2 code size improvements

2010-09-05 Thread Yao Qi
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 >

Re: Thumb2 code size improvements

2010-09-02 Thread Yao Qi
Loïc Minier wrote: > On Fri, Sep 03, 2010, Yao Qi wrote: >> 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

Re: Thumb2 code size improvements

2010-09-02 Thread Loïc Minier
On Fri, Sep 03, 2010, Yao Qi wrote: > 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