This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: SPARC code inefficiency


> 
> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]