From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,6af9ef4b59855c62 X-Google-Attributes: gid1164f8,public From: Joe Mario Subject: Re: New C compiler Date: 1996/07/01 Message-ID: <31D819F6.41C6@zk3.dec.com>#1/1 X-Deja-AN: 163142409 references: <4r25s5$eb7@vixen.cso.uiuc.edu> to: Steve Peltz cc: mario content-type: text/plain; charset=us-ascii organization: CTG mime-version: 1.0 newsgroups: comp.sys.dec x-mailer: Mozilla 2.02 (X11; I; OSF1 V4.0 alpha) Steve Peltz wrote: > > Having just installed 4.0 on our development Alpha (2100 4/275), I went > ahead to see if I could compare the performance of the optimizer with > the ucode version. For some things, it improved a fair bit, but for most > the code it produced was a bit slower. I used -fast -O4 -inline speed > -tune host. I didn't see a significant difference between -O3 and -O4. The -O4 opt level may or may not be what you want with DEC C in V4.0. For DEC C in V4.0, the "preferred" optimization levels are -O2 and -O3. (-O2 and -O3 differ only by the optimizations that impact symbol preemption). The -O4 opt level contains optimizations which tend to increase code size. It helps many applications but hurts others. The cc(1) manpage states you should compare program execution times for the same program compiled at levels -O3 and -O4. The "-inline speed" vs "-inline size" tends to fall into this same category. Don't get confused with the opt levels between "cc" and "cc -migrate". Even though they both give you the same DEC C compiler in V4.0, they have different optimization levels. Although the "cc -migrate" command in V4.0 still gives you the same optimization levels that it always did, the "cc" command in V4.0 remaps DEC C's optimizations to be compatible with the previous compiler's optimizations so users wouldn't need to change their makefiles. > > I did have to hand-tune a bunch of "register" declarations for the old > compiler in order to get the maximum speed, and it was very sensitive > to any changes in that area, so I may be able to improve things still. > > I also note that the assembler optimizations still don't really seem to do > much of anything other than rearranging order. For instance, it doesn't > seem to do any checking of redundant write-backs or loads even in the > most obvious and straightforward of cases (I was hoping the assembler > would be a bit smarter so I wouldn't have to put much effort along those > lines in generating the assembly code; the various .set options in the > assembler seem to imply it does a lot more optimizations than it seems > to actually do). There is not a new assembler in V4.0 (except for some new features and bugfixes). > > Is it correct that to use the -ifo flag, I should just forget about > compiling to .o files, and simply specify the .c files I want to be > optimized in the cc command that does the final load? I was using the > -j flag before, with the final program dependent on the .u files; now > I just make the final program dependent on the .c files along with the > normal .o files that don't need that level of optimization? Does that > produce more optimization (global register usage, etc.) than if I use, e.g.: > > cc -c -O4 -ifo a.c b.c > cc a.o b.o With -ifo, you can compile both a.c and b.c as one compilation unit. This will give you the same optimizations (and more) that you used to get with -j and .u files. Compiling "cc -c -O -ifo a.c b.c -o both.o" gives you a combined .o file. If you omit the -o flag, the name of the first source file is used for the object filename. You can always omit the -c and have it go right to an a.out file. > > Does it produce incorrect results if I do: > > cc -c -O4 -ifo a.c b.c > cc -c b.c > cc a.o b.o > > because b.o may now be using different registers than the optimized a.o is > expecting? Yes, the above example will produce incorrect results for the reasons you stated. > > One behavior has changed which is not documented in the man page: if you > use both -E and -P, with -oldc it still pipes it to stdout; with -newc > it ignores the -E. Is there some reason for this? I guess I don't care > too much, since I've already changed all my makefiles, but it was annoying. This wasn't intentional. Thanks for pointing it out. Joe Mario DEC C.