From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,64f8df62a7534aa,start X-Google-Attributes: gid111c93,public From: Emil Briggs Subject: Re: fast array calculation in C Date: 1999/10/18 Message-ID: <380A9C4B.27837CFE@tick.physics.ncsu.edu>#1/1 X-Deja-AN: 537361321 Content-Transfer-Encoding: 7bit References: <3809E64D.85BDCAFC@ife.ee.ethz.ch> <7ud6gc$2o94@news2.newsguy.com> X-Accept-Language: en X-Server-Date: 18 Oct 1999 04:02:32 GMT Content-Type: text/plain; charset=us-ascii Organization: MindSpring Enterprises Mime-Version: 1.0 Newsgroups: comp.os.linux.alpha Greg Lindahl wrote: > > Alex Rhomberg writes: > > > > The memcpy() call at the end, on the other hand, is expensive. > > > > Did you check that? > > It isn't (expensive). The compiler inlines it and then does some more > > optimizations. > > I get >400 MFLOPS (40% peak) with the memcpy > > Compilers are clever with memcopy, but I've yet to see one that could > figure out at compile time "hey, the byte count is divisible by 8 and > the buffers are aligned..." That's why a good compiler will usually do > a better job of optimizing a copy loop. > The Cray vector compilers were smart enough to do wholesale replacment of computational loops with calls to had coded assembly language routines. Even up to the level of BLAS2 calls. I was quite impressed when I looked at the assembly language output of the compiler and realized what it was doing. Regards Emil