[PATCH] powerpc: tiny memcpy_(to|from)io optimisation

Albrecht Dreß albrecht.dress at arcor.de
Fri May 29 05:50:24 EST 2009


Am 28.05.09 18:13 schrieb(en) Joakim Tjernlund:
> hmm, these do look a bit unoptimal anyway. Any reason not to write  
> them something like below(written by me for uClibc long time ago).  
> You will have to add eieio()/sync

No (and I wasn't aware of the PPC pre-inc vs. post-inc stuff) - I just  
stumbled over this while fixing mtd accesses to the MPC5200's Local Bus  
in 16-bit mode which doesn't allow byte accesses.  And I didn't want to  
go too deep into this as the real fix for me is actually somewhat  
different...

> /* PPC can do pre increment and load/store, but not post increment  
> and load/store.
>    Therefore use *++ptr instead of *ptr++. */
[snip]
>  copy_chunks:
> 	do {
> 		/* make gcc to load all data, then store it */
> 		tmp1 = *(unsigned long *)(tmp_from+4);
> 		tmp_from += 8;
> 		tmp2 = *(unsigned long *)tmp_from;
> 		*(unsigned long *)(tmp_to+4) = tmp1;
> 		tmp_to += 8;
> 		*(unsigned long *)tmp_to = tmp2;
> 	} while (--chunks);

Is this the same for all PPC cores, i.e. do they all benefit from  
loading/storing 8 instead of 4 bytes?

Best, Albrecht.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20090528/b3e995a5/attachment.pgp>


More information about the Linuxppc-dev mailing list