Path: utzoo!attcan!uunet!europa.asd.contel.com!sura.net!haven!adm!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.arch Subject: Re: What the compiler won't do you for you Message-ID: <24280:Feb2802:55:4991@kramden.acf.nyu.edu> Date: 28 Feb 91 02:55:49 GMT References: <8728@exodus.Eng.Sun.COM> <13578:Feb2705:46:4391@kramden.acf.nyu.edu> <8787@exodus.Eng.Sun.COM> Organization: IR Lines: 40 In article <8787@exodus.Eng.Sun.COM> chased@rbbb.Eng.Sun.COM (David Chase) writes: > Simpler method: > compiler writer writes library of inlineable code. > compiler writer documents names of routines that are in this library. > programmer uses those names. I give up. The man just refuses to see that this does NOT produce portable code. Sun writes one library, and DEC writes another one, and Convex writes another one, and a programmer who uses these libraries will NOT be able to run his programs on more than one machine. > No need to promise that > in the future, a special chunk of code will result in the use of a > special instruction. Nor does he see that the compiler writer NEVER has to make such a promise. Again it is obvious that his viewpoint is twisted by his Sun-specific environment. Too bad for him that the rest of the world uses hundreds of different architectures. If David opens his eyes he will see that what I am proposing will ALWAYS improve the portability of efficient code. But because this requires a bit of work on the compiler-writer's part, his eyes will remain closed. > In addition, as I said before, there is ample evidence that time is > better spent doing a good job of optimizing code in a general way. If > it paid to do the things that you propose, it would have showed up in > compiler tuning. People do look at the code that is generated, and > try to come up with ways to make it better. Somehow, nothing like > your idea even made it onto the list, let alone near the top. Actually, David, I found out from e-mail that essentially the same ideas have been published before, in many separate papers. I still find it amazing that David can draw a line between optimizing *(p+a) into a single instruction on a Convex, optimizing c = a/b and d = a%b into a single instruction on most CISC chips, and optimizing a short Hamming weight function into a single instruction on a Cyber. ---Dan