disabling loop unrolling in GCC

2009-12-21 Thread Shachar Shemesh
Hi all, I'm trying, without success, to disable loop unrolling when compiling a program with -O3 with gcc (4.4, but I see the same problem with 4.3). The program is the following one: volatile int v; void func() { int i; for( i=0; i8; ++i ) { v=0; } } I compile it with the

Re: disabling loop unrolling in GCC

2009-12-21 Thread Aviv Greenberg
Just out of curiousity: why do you care about the resulting assembly? It's a strong indication that you are doing something wrong :) I would try to set i to volatile or to an extern to trick the compiler to drop the optimization (if the flags don't work). --Aviv 2009/12/21 Shachar Shemesh

Re: disabling loop unrolling in GCC

2009-12-21 Thread Shachar Shemesh
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

Re: disabling loop unrolling in GCC

2009-12-21 Thread Aviv Greenberg
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 10sub$0x10,%esp 6: c7 45 fc 00 00 00 00movl $0x0,-0x4(%ebp) d: 8b 45 fc

Re: disabling loop unrolling in GCC

2009-12-21 Thread Dotan Shavit
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

Re: disabling loop unrolling in GCC

2009-12-21 Thread Aviv Greenberg
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

Re: disabling loop unrolling in GCC

2009-12-21 Thread Oleg Goldshmidt
2009/12/21 Shachar Shemesh shac...@shemesh.biz: Hi all, I'm trying, without success, to disable loop unrolling when compiling a program with -O3 with gcc (4.4, but I see the same problem with 4.3). I am actually very surprized that -O3 unrolls loops. It is not supposed to. The idea to include

Re: disabling loop unrolling in GCC

2009-12-21 Thread Shachar Shemesh
Dotan Shavit 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,