well,
you want to unroll whole loop? 
try to use -funroll-all-loops
~d

On Wednesday 27 August 2003 20:05, Takahashi, Chris wrote:
> I've tried that.  No change.  When using -Os or -O2 (or I think even -O3)
> loop unrolling isn't turned on (according to what I've found by looking in
> gcc-3.2.3/gcc/toplev.c)
>
> -Chris Takahashi
>
>
>
> -----Original Message-----
> From: Dmitry [mailto:di...@mail.ru]
> Sent: Wednesday, August 27, 2003 3:13 AM
> To: mspgcc-users@lists.sourceforge.net
> Subject: Re: [Mspgcc-users] partial loop unrolling.
>
>
> use -fno-unroll-loops
> ~d
>
> On Wednesday 27 August 2003 03:01, Takahashi, Chris wrote:
> > The following code creates some interesting asm with the following flags:
> >  -g -c -Os -fno-force-mem -mmcu=msp430x437
> >
> > It looks like it unrolled the loop in 64 byte chunks and is instead
> > iterating over that.  While this is faster this would hardly ever get run
> > so I would rather have it small.
> >
> > attached are list files with the -fno-force-mem on and off and the C
> > file.
> >
> > If I change the span it iterates over to a nonmultiple of 64 I get the
> > expected asm.
> >
> > My question is what does no-force-mem have to do with this and why isn't
> > auto increment addressing being used?  In this case it would save quite a
> > bit here.
> >
> > -Chris
> >
> > ---
> >
> > #include <msp430x44x.h>
> >
> > int test()
> > {
> >     unsigned int sum = 0;
> >     unsigned int *addr;
> >
> >     for (addr = (int *)0x8000; addr != 0x0000; addr++) {
> >         sum += *addr;
> >     }
> >
> >     return sum;
> > }
> >
> > -------
> >
> >     for (addr = (int *)0x8000; addr != 0x0000; addr++) {^M
> >    2:   3e 40 00 80     mov #-32768,r14 ;#0x8000
> >         sum += *addr;^M
> >    6:   2f 5e           add @r14,   r15 ;
> >    8:   1f 5e 02 00     add 2(r14), r15 ;
> >    c:   1f 5e 04 00     add 4(r14), r15 ;
> >   10:   1f 5e 06 00     add 6(r14), r15 ;
> >   14:   1f 5e 08 00     add 8(r14), r15 ;
> >   18:   1f 5e 0a 00     add 10(r14),r15 ;
> >   1c:   1f 5e 0c 00     add 12(r14),r15 ;
> >   20:   1f 5e 0e 00     add 14(r14),r15 ;
> >   24:   1f 5e 10 00     add 16(r14),r15 ;
> >   28:   1f 5e 12 00     add 18(r14),r15 ;
> >   2c:   1f 5e 14 00     add 20(r14),r15 ;
> >   30:   1f 5e 16 00     add 22(r14),r15 ;
> >   34:   1f 5e 18 00     add 24(r14),r15 ;
> >   38:   1f 5e 1a 00     add 26(r14),r15 ;
> >   3c:   1f 5e 1c 00     add 28(r14),r15 ;
> >   40:   1f 5e 1e 00     add 30(r14),r15 ;
> >   44:   1f 5e 20 00     add 32(r14),r15 ;
> >   48:   1f 5e 22 00     add 34(r14),r15 ;
> >   4c:   1f 5e 24 00     add 36(r14),r15 ;
> >   50:   1f 5e 26 00     add 38(r14),r15 ;
> >   54:   1f 5e 28 00     add 40(r14),r15 ;
> >   58:   1f 5e 2a 00     add 42(r14),r15 ;
> >   5c:   1f 5e 2c 00     add 44(r14),r15 ;
> >   60:   1f 5e 2e 00     add 46(r14),r15 ;
> >   64:   1f 5e 30 00     add 48(r14),r15 ;
> >   68:   1f 5e 32 00     add 50(r14),r15 ;
> >   6c:   1f 5e 34 00     add 52(r14),r15 ;
> >   70:   1f 5e 36 00     add 54(r14),r15 ;
> >   74:   1f 5e 38 00     add 56(r14),r15 ;
> >   78:   1f 5e 3a 00     add 58(r14),r15 ;
> >   7c:   1f 5e 3c 00     add 60(r14),r15 ;
> >   80:   1f 5e 3e 00     add 62(r14),r15 ;
> >   84:   3e 50 40 00     add #64,    r14 ;#0x0040
> >   88:   be 23           jnz $-130       ;abs 0x6
> >     }

-- 
/*****************************************************************
     ("`-''-/").___..--''"`-._     (\   Dimmy the Wild     UA1ACZ
      `6_ 6  )   `-.  (     ).`-.__.`)  State Polytechnical Univ.
      (_Y_.)'  ._   )  `._ `. ``-..-'   Radio-Physics Departament
    _..`--'_..-_/  /--'_.' ,'           Saint Petersburg,  Russia
   (il),-''  (li),'  ((!.-'             +7 (812) 5403923, 5585314
 *****************************************************************/


Reply via email to