Path: utzoo!mnetor!uunet!husc6!bbn!rochester!PT.CS.CMU.EDU!sei!sei.cmu.edu!firth From: firth@sei.cmu.edu (Robert Firth) Newsgroups: comp.arch Subject: Re: Auto-shifted registers Message-ID: <4307@aw.sei.cmu.edu> Date: 23 Feb 88 13:43:58 GMT References: <1370@vaxb.calgary.UUCP> Sender: netnews@sei.cmu.edu Reply-To: firth@bd.sei.cmu.edu.UUCP (Robert Firth) Organization: Carnegie-Mellon University, SEI, Pgh, Pa Lines: 35 In article <1370@vaxb.calgary.UUCP> radford@calgary.UUCP (Radford Neal) writes: >Several instruction sets, such as the 68020 and the VAX, have >an "indexed" addressing mode, in which a register is shifted >left by 0, 1, 2, or 3 bits before being added to a displacement, >allowing easy access to arrays of ints, etc. > >I has occurred to me that this "auto-shifting" might be useful >for ALL register references. Every reference to a register as >a source operand would be accompanied by two bits giving a >shift amount - equivalet to a multiplication by 1, 2, 4, or 8. The problem with your suggestion, and with scaled-index modes, is that they introduce yet another nonorthogonality into the architecture. On the 68020, for example, arrays with component size 1 are a special case (no scaling); arrays of component size 2, 4, 8 are another special case (can use index mode), and arrays of any other size are another special case (can't use index mode). That's one case too many. Moreover, if you are going to generate slick code for, say, arrays whose component size is 12, you have to do all that loop induction, strength reduction &c stuff. Surprise: once you've done that, you can use those algorithms for all arrays, junk the scaled-index mode, and get better code. My own preference is for as simple an architecture as possible (but no simpler, as Einstein remarked). However, if people want to build a scaled index mode, PLEASE let the damn thing scale for ANY array a modern HLL can generate. In particular for component sizes SMALLER than the addressable unit as well as larger. Nothing is more tiresome than a special feature that works some of the time. The Data General Nova did some of what you want, and the Acorn does more. Writing a codegenerator for either of them is a pig, because you have to handle an unconscionable number of special cases for seemingly simple things like multiply, add, subtract, &c.