disabling loop unrolling in GCC

disabling loop unrolling in GCC

Aviv Greenberg avivgnet at gmail.com
Mon Dec 21 16:52:37 IST 2009


Also, i tried grepping for "loop" and then negate all loop related params:

linux-gec2:~/projects/lu # gcc -c -O3 -fno-align-loops
-fno-move-loop-invariants -fno-peel-loops -fno-prefetch-loop-arrays
-fno-rerun-cse-after-loop -fno-reschedule-modulo-scheduled-loops
-fno-tree-loop-im -fno-tree-loop-ivcanon -fno-tree-loop-linear
-fno-tree-loop-optimize -fno-tree-vect-loop-version
-fno-unroll-all-loops -fno-unroll-loops -fno-unsafe-loop-optimizations
-fno-unswitch-loops -fno-loop-optimize -fno-rerun-loop-opt  main.c

linux-gec2:~/projects/lu # objdump -S main.o

main.o:     file format elf32-i386


Disassembly of section .text:

00000000 <func>:
   0:   55                      push   %ebp
   1:   31 c0                   xor    %eax,%eax
   3:   89 e5                   mov    %esp,%ebp
   5:   8d 76 00                lea    0x0(%esi),%esi
   8:   83 c0 01                add    $0x1,%eax
   b:   83 f8 07                cmp    $0x7,%eax
   e:   c7 05 00 00 00 00 00    movl   $0x0,0x0
  15:   00 00 00
  18:   7e ee                   jle    8 <func+0x8>
  1a:   5d                      pop    %ebp
  1b:   c3                      ret
  1c:   8d 74 26 00             lea    0x0(%esi,%eiz,1),%esi

Just need to figure out which param is the good one :)

On Mon, Dec 21, 2009 at 16:41, Dotan Shavit <dotan at shavitos.com> wrote:
> On Monday 21 December 2009 14:00:39 Shachar Shemesh wrote:
>> Where it gets worrying is when I try to cancel loop unrolling. I tried
>>  "-fno-unroll-loops" and "-fno-peel-loops", to no effect. I even tried
>>  messing with the --param option (max-unrolled-insns, max-unroll-times,
>>  max-peel-times) to no noticeable effect
>>
> max-completely-peeled-insns is your friend
>
> This param's value is also the difference between -O3 and -O2 you were missing
>
> _______________________________________________
> Linux-il mailing list
> Linux-il at cs.huji.ac.il
> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>



-- 

Charles de Gaulle  - "The better I get to know men, the more I find
myself loving dogs." -
http://www.brainyquote.com/quotes/authors/c/charles_de_gaulle.html



More information about the Linux-il mailing list