Path: utzoo!mnetor!uunet!mcvax!dik From: dik@cwi.nl (Dik T. Winter) Newsgroups: comp.arch Subject: Re: RISC is a nasty no-no! Message-ID: <7514@boring.cwi.nl> Date: 2 Mar 88 02:14:30 GMT References: <179@wsccs.UUCP: <696@nuchat.UUCP: <284@scdpyr.UUCP> <25699@linus.UUCP> <11199@duke.cs.duke.edu> <25723@linus.UUCP> <8332@eddie.MIT.EDU> <7482@apple.UUCP> Organization: CWI, Amsterdam Lines: 18 In article <7482@apple.UUCP> baum@apple.UUCP (Allen Baum) writes: > Accessing arbitrary array elements is non extremely common. Most of the > array references are inside loops, and use the loop induction variables as > part of the subscript expression. A good compiler will strength reduce these > multiply operations and turn them into add/subtract immediates. Even if this > is not possible, the multiply operation is generally reg*imm, which reduces > to a shift in the common cases (power of two array sizes are pretty common!), > or a SMALL series of shifts and adds. > I agree with most (CDC Cyber does not have a true integer multiply either). I disagree with the last, when you start programming on supers you will soon learn that power of two array sizes are the worse choice you can make. Even if nominally your array size ought to be a power of two, make it one more in the declaration to prevent degradation of perfomance. -- dik t. winter, cwi, amsterdam, nederland INTERNET : dik@cwi.nl BITNET/EARN: dik@mcvax