From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb9cd,3e10dbc776740ba1 X-Google-Attributes: gidfb9cd,public X-Google-Thread: 110292,3e10dbc776740ba1 X-Google-Attributes: gid110292,public X-Google-Thread: 1164f8,3e10dbc776740ba1 X-Google-Attributes: gid1164f8,public X-Google-Thread: f57db,3e10dbc776740ba1 X-Google-Attributes: gidf57db,public From: "H.W. Stockman" Subject: Re: A portable benchmark for ANSI C compilers, Windows NT and MPP supercomputers. Date: 1997/03/10 Message-ID: <3324D323.18A@swcp.com>#1/1 X-Deja-AN: 224575716 References: <5g120v$312@news-rocq.inria.fr> <332424A5.71BB@tonys.ecology.umn.edu> <33248B27.1E17@cao.mts.dec.com> Organization: Southwest Cyberport Reply-To: hwstock@swcp.com Newsgroups: comp.benchmarks,comp.sys.intel,comp.sys.dec,comp.os.ms-windows.nt.misc Peter Mayne wrote: > Modern compilers probably are beyond "register", but not "const". In a > function argument, const might indicate that a variable can't be > aliased, which means that the compiler can then make assumptions that it > couldn't usually make, and optimise accordingly (like load it into a > register instead of leaving it in memory). > There was a discussion about aliasing and its affect on code > optimisation recently in comp.arch. I'm very interested in this issue, since we have been testing a code on alpha/SGI/PPro, and I spent the weekend trying to find fool-proof ways to give the compiler hints about aliasing. It isn't easy, and I could find few places where I was comfortable using "const". Putting #pragma optimize(...) around a few key functions helped just a little, but I got almost the same effect from declaring some vars static, removing the few obvious aliases, and converting temporaries to double in strategic places (when arrays were float) to rely on ANSI aliasing rules. It is really tough to use dynamic allocation effectively, and also make it easy on the compiler to detect functions that will be free from aliasing problems (OK, I admit I never thought about this that much before, so maybe it's easier than I thought). In trolling for hints, I came across several discussions of the DEC optimizing compilers; it looks like there are options (or at least plans to implement such options) to search for global aliasing hints, with varying degrees of agression. I noticed the SPEC benchmarks are compiled to assume the ANSI aliasing rules. > PJDM > Digital Equipment Corporation (Australia), Canberra, ACT You should be an expert on this, que no?