From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,80f21c0575c616e8 X-Google-Attributes: gid111c93,public From: lindahl@pbm.com (Greg Lindahl) Subject: Re: fast array calculation in C Date: 1999/10/09 Message-ID: <7tockg$230o@news2.newsguy.com>#1/1 X-Deja-AN: 534831224 References: <37FCEB06.5F23041F@ife.ee.ethz.ch> Organization: a guest of Shadow Island Games Newsgroups: comp.os.linux.alpha Alex Rhomberg writes: > I've found that looking at the produces assembler is important. > In my case, the Compaq ccc compiler produces nearly three times faster > code than gcc. It gets dependencies much better. OK. > I've found that the biggest difference in code efficience comes if the > compiler thinks that lvalue and rvalue accesses could be the same > address or not. This is usually known as the "aliasing problem" -- the compiler isn't sure if a given pointer store is the same as a different pointer load, so it doesn't re-use values in variables. > By feeding the produced assembler into a short Perl > script, I was able to identify ugly code, optimize it and shave 30% of > the execution time of a 700 line function by optimizing 4 lines. > > I'll post the perl-script for those who are interested. > It finds the lines where the target of a ldt/addt/mult/subt function > appears in the following line, which means pipeline stalls: .. but this is a different problem, an instruction scheduling problem. What I am saying, mostly, is that I obviously don't understand what you are saying. In addition, is this savings in gcc or in ccc? Are you using a 21264 or a 21164? The 21264 has enough out-of-order execution stuff that the above problem doesn't always cause a stall. If you are interested in this from a computer-science research side, you can look at the Atlas and FFTW projects, which do a more complicated version of what you have done. -- g