Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!hao!gatech!mcnc!duke!dfk From: dfk@duke.cs.duke.edu (David Kotz) Newsgroups: comp.arch Subject: Re: RISC is a nasty no-no! Message-ID: <11199@duke.cs.duke.edu> Date: 29 Feb 88 16:44:15 GMT References: <179@wsccs.UUCP: <696@nuchat.UUCP> <284@scdpyr.UUCP> <25699@linus.UUCP> Organization: Duke University CS Dept.; Durham, NC Lines: 20 Summary: array indices don't necessarily use multiplication > There's something about RISC architectures in general that I find > confusing. Since they (read SPARC or equivalent) have no integer multiply > instructions, any code which has a fair number of these is going to > be slow. This would include any program which had access to 2-D arrays > since one must do multiplications (unless the array sizes are a convenient > power of 2) to get the array indices right. ... > Bob Silverman Multiplication is not necessary to access 2-D arrays if the array is set up like most arrays in C, where each row is a typical vector and the 2-D array is just a vector of pointers to each row vector. Then double-indirection is necessary, rather than multiplication. I won't say that's any better, but you don't *need* multiplication. (It might not be so bad once the first two pointers are cached, and a good programmer puts them in registers anyway). David Kotz -- ARPA: dfk@cs.duke.edu CSNET: dfk@duke UUCP: {ihnp4!decvax}!duke!dfk