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: gcc 3.2 altivec options and glibc


Am Die, 2002-08-27 um 19.17 schrieb Geoff Keating:

> > You can use it for anything but performance will likely suck for a large
> > amount of unaligned memory accesses which is what you'll most likely get
> > with standard functions. 
 
> That's not quite how it works.  glibc's current memset for powerpc
> (which doesn't rely on the presence of altivec) is actually very
> similar to what you'd write using a vector instruction set, except
> that it deals with data in 32-bit chunks instead of 128-bit.

I know how memset works but what is your point? :) All the mem-functions
basically break up all request into largest possible aligned chunks and
then work on them to avoid unaligned accesses.

That works great for one, two or three different size types but will
quickly loose the benefits if the functions gets bloated to much by
leaving choices. AltiVec is even more a special case here because one
cannot assume it's existance on all PPC processors and thus we'd either
need to different sets of mem functions, ohne w/ and one w/o AltiVec
support which can be switched somehow or another conditional in the
function. Also since the functions are called in the same processcontext
some %vr have to be saved which will again cost.

But feel free to try it. I benchmarked a handwritten memcpy using
lvx/stvx, loops with double/int/short/char and memcpy for various
sized of 16-byte aligned memory. memcpy won in almost all cases 
by lengths followed by int-loop, lvx/stvx-loop and then the others
on a 7410 with 500Mhz. A wild speculation here is that LSU is optimised
for 32bit accesses which makes it really go fast though accesses through
larger types have the advantage of reducing the code size and thus fit
better into caches and reduce load in the scheduler.

My conclusion from that experience is that AltiVec is only worth the
hassles if you really have something to calculate and this job is
actually paralliseable. 

--
Servus,
       Daniel

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


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