This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: SPARC code inefficiency
- From: Jan Hubicka <jh at suse dot cz>
- To: Dan Nicolaescu <dann at godzilla dot ICS dot UCI dot EDU>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 22 May 2002 10:45:51 +0200
- Subject: Re: SPARC code inefficiency
- References: <200205212313.aa02477@gremlin-relay.ics.uci.edu>
>
> The source code below comes from md5.c from gnupg.
> The code is compiled with gcc-3.1 -O2 on sparc
> (adding -mcpu=v8 or ultrasparc doesn't change much)
>
> Look at all the uses for the %o2 register:
>
> 32 lines matching "o2" in buffer md5.s.
> 11: add %fp, -80, %o2
> 21: mov %o2, %i5
> 40: ld [%o2], %i0
> 53: add %o2, 4, %o2
> 54: ld [%o2], %i0
Hmm, this is exactly kind of code my webizer pass present on the CFG branch
solves. WHat happens is that sequence of things like:
*(a++)=x;
*(a++)=x;
*(a++)=x;
*(a++)=x;
Gets converted into
*a=x;
a1=a+1;
*a1=x;
a2=a1+1;
and so on.. CSE knows how to optimize this case.
Honza