disabling loop unrolling in GCC
Aviv Greenberg
avivgnet at gmail.com
Mon Dec 21 16:28:32 IST 2009
This is what i get if i set i to be volatile in gcc 4.3.1 with -O3:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 10 sub $0x10,%esp
6: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
d: 8b 45 fc mov -0x4(%ebp),%eax
10: 83 f8 07 cmp $0x7,%eax
13: 7f 1e jg 33 <func+0x33>
15: 8d 76 00 lea 0x0(%esi),%esi
18: c7 05 00 00 00 00 00 movl $0x0,0x0
1f: 00 00 00
22: 8b 45 fc mov -0x4(%ebp),%eax
25: 83 c0 01 add $0x1,%eax
28: 89 45 fc mov %eax,-0x4(%ebp)
2b: 8b 45 fc mov -0x4(%ebp),%eax
2e: 83 f8 07 cmp $0x7,%eax
31: 7e e5 jle 18 <func+0x18>
33: c9 leave
34: c3 ret
looks like i was right!
On Mon, Dec 21, 2009 at 15:54, Shachar Shemesh <shachar at shemesh.biz> wrote:
> Aviv Greenberg wrote:
>
> Just out of curiousity: why do you care about the resulting assembly?
> It's a strong indication that you are doing something wrong :)
>
>
> First, we have found several bugs in GCC as a result of "caring about the
> assembly". Lets agree that it's an indication that someone is doing
> something wrong.
>
> The reason I'm trying to disable this optimization is because it causes the
> code to be too big to fit onto the available ROM on which the code needs to
> be flashed. The X86 version I gave here shows the problem, but is no the
> platform on which the problem was diagnosed.
>
> Shachar
>
> --
> Shachar Shemesh
> Lingnu Open Source Consulting Ltd.
> http://www.lingnu.com
>
--
Ogden Nash - "The trouble with a kitten is that when it grows up,
it's always a cat." -
http://www.brainyquote.com/quotes/authors/o/ogden_nash.html
More information about the Linux-il
mailing list