Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!pt.cs.cmu.edu!sei.cmu.edu!firth From: firth@sei.cmu.edu (Robert Firth) Newsgroups: comp.arch Subject: Re: Optimization vs. the programmer Message-ID: <920@aw.sei.cmu.edu.sei.cmu.edu> Date: Mon, 13-Apr-87 08:27:16 EST Article-I.D.: aw.920 Posted: Mon Apr 13 08:27:16 1987 Date-Received: Sun, 19-Apr-87 09:42:20 EST References: <479@danews.ATT.COM> <3300003@uiucdcsm> <344@zuring.mcvax.cwi.nl> Sender: netnews@sei.cmu.edu Reply-To: firth@bd.sei.cmu.edu.UUCP (PUT YOUR NAME HERE) Organization: Carnegie-Mellon University, SEI, Pgh, Pa Lines: 10 In article <344@zuring.mcvax.cwi.nl> dik@zuring.UUCP (Dik T. Winter) writes: >And that is right, otherwise you might see i * 14 transformed to >(i << 4) - (i << 1), which is slower on some machines. >(The Pascal compiler on one of the systems I use did this, this >'optimization' has been turned off.) Also uses an unnecessary register. If a compiler makes this change it will emit ((i<<3)-i)<<1. Transformations such as these are VALID on (almost) all machines, but they are not necessarily OPTIMISATIONS. Mr Winter and others are right - leave these tricks to the compiler.