Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ukma!xanth!nic.MR.NET!hal!ncoast!allbery From: allbery@ncoast.ORG (Brandon S. Allbery) Newsgroups: comp.sys.ibm.pc Subject: Re: Optimizers and RISC (Re: Why unix doesn't catch on) Message-ID: <13628@ncoast.ORG> Date: 7 May 89 18:50:15 GMT References: <7632@phoenix.Princeton.EDU> <256@jwt.UUCP> <7697@phoenix.Princeton.EDU> <268@tree.UUCP> <13595@ncoast.ORG> <369@utgard.UUCP> <3181@looking.UUCP> Reply-To: allbery@ncoast.UUCP (Brandon S. Allbery) Followup-To: comp.sys.ibm.pc Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 38 As quoted from <3181@looking.UUCP> by brad@looking.UUCP (Brad Templeton): +--------------- | Did RISC machines cause a push in optimizing compilers? I always thought | the big advantage of the RISC was that it made the low level optimizations | so much simpler -- there's only one way to code the thing, so no need to | worry about the best use of fancy instructions and addressing modes. +--------------- I was under the impression that it had. At least one person has suggested that I was wrong -- but I'm not entirely certain of that. Optimization under RISC consists primarily of (1) recognizing that some loops will run faster when "unwound" into linear code and (2) optimizing the use of registers. The latter involves copying often-used values into a register once instead of constantly fetching it from memory, and recognizing that the "brute-force" method of using registers can result in multiple registers having the same value, and saving only one of those registers for future use while "freeing" the others up for use by the next calculation. Both can be applied to CISC code; in fact, register optimization is, if anything, *more* useful on hardware which doesn't have registers to spare. Unwinding loops isn't normally useful unless you've decided to trade code size for the absolute maximum of speed, although certain "trivial" loops might always be expanded with little cost (and, probably, equally little gain). The difference that RISC brings to it is that both are very nearly *required* for RISC, whereas CISC can get by without either; consider yours and my "favorite" compiler, AT&T's pcc. The speed benefits of RISC are quickly lost if the compiler produces code that wastes time doing things that don't really need to be done because it isn't aware of prior context. ++Brandon -- Brandon S. Allbery, moderator of comp.sources.misc allbery@ncoast.org uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery@hal.cwru.edu Send comp.sources.misc submissions to comp-sources-misc@ NCoast Public Access UN*X - (216) 781-6201, 300/1200/2400 baud, login: makeuser