Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 (Tek) 9/28/84 based on 9/17/84; site mako.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!mtuxo!mtunh!mtung!mtunf!ariel!vax135!cornell!uw-beaver!tektronix!orca!mako!jans From: jans@mako.UUCP (Jan Steinman) Newsgroups: net.arch Subject: Re: better late... (really, fast NS32000 multiplies) Message-ID: <836@mako.UUCP> Date: Thu, 20-Jun-85 19:35:37 EDT Article-I.D.: mako.836 Posted: Thu Jun 20 19:35:37 1985 Date-Received: Sat, 22-Jun-85 23:56:18 EDT References: <254@greipa.UUCP> Reply-To: jans@mako.UUCP (Jan Steinman) Distribution: net Organization: Tektronix, Wilsonville OR Lines: 37 Summary: In article <254@greipa.UUCP> paul@greipa.UUCP (Paul A. Vixie) writes: >Not being a compiler writer (yet :-), anyway) I don't see many other things >a compiler could optimize for (except the "muld 2, tos" which could have been >"ashd 1, tos" but only vax-11 C from DEC does this). Note that if one operand is a constant small integer and the other is in a register, the following multiplies are shorter and quicker: Instruction Function Clocks Size (w/MMU) (Bytes) addd rx,rx ; 2*rx (destructive) 4 2 addr rx[rx:b],ry ; 2*rx 13 2 addr rx[rx:w],ry ; 3*rx 15 2 addr @0[rx:d],ry ; 4*rx 15 3 addr rx[rx:d],ry ; 5*rx 16 2 addr @0[rx:q],ry ; 8*rx 17 3 addr rx[rx:q],ry ; 9*rx 18 2 compared with: ashd 1,rx ; 2*rx (destructive) 23 7 muld 2,rx ; 2*rx (destructive) 85 7 It's so much quicker, that the 9 clocks required to move the operand from the stack into a register still keep it faster and smaller than the shifted vers. I've noticed that the C compiler on our 6000 series boxes generate at least a few of these. (This will all change when the 32?32 with the barrell shifter arrives!) I disagree with Henry Spencer in saying that multiplies are uncommon. In particular, the small integer multiply operation is used in index scaling, particularly whenever index math is performed, and it is important that a compiler do its best on these, as they are often inside loops. -- :::::: Jan Steinman Box 1000, MS 61-161 (w)503/685-2843 :::::: :::::: tektronix!tekecs!jans Wilsonville, OR 97070 (h)503/657-7703 ::::::