Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!joyce!sri-unix!quintus!ok From: ok@quintus.uucp (Richard A. O'Keefe) Newsgroups: comp.arch Subject: Re: RISC bashing at USENIX (really RISCs as X servers) Message-ID: <186@quintus.UUCP> Date: 22 Jul 88 02:51:35 GMT References: <6965@ico.ISC.COM> <936@garth.UUCP> <202@baka.stan.UUCP> <1681@gofast.camcon.uucp> Sender: news@quintus.UUCP Reply-To: ok@quintus.UUCP (Richard A. O'Keefe) Organization: Quintus Computer Systems, Inc. Lines: 56 In article <1681@gofast.camcon.uucp> anc@camcon.uucp (Adrian Cockcroft) writes: >> The loop which does most of the work for a bit blt looks like this for the >> common copy case: >> register long count; >> register long *src, *dst; >> while( --count ) >> { >> *dst++ = *src++; >> } >Are you using the DBRA instruction for this? Has anyone ever seen a compiler >generate a DBRA? Maybe SUNs bcopy library routine is in assembler and uses it. The SunOS 3.2 C compiler is perfectly happy to generate a DBRA; you just have to write some suprising C to do it. void move(dst, src, len) register long *dst, *src; register short len; { do *dst++ = *src++; while (--len != -1); } compiled with -O yielded movl a6@(8),a5 movl a6@(12),a4 movw a6@(18),d7 L16: movl a4@+,a5@+ dbra d7,L16 Remember that dbra operates on *16-bit* registers (boo hiss). A reasonably good strcpy for 68010s can be done thus: void strmov(dst, src) register char *dst, *src; { register short len = -2; while ((*dst++ = *src++) && --len != -1); } which turns into movl a6@(8),a5 movl a6@(12),a4 moveq #-2,d7 L14: movb a4@+,a5@+ dbeq d7,L14 Frankly, I'd rather write clearer C and put up with not getting DBcc. (Oops, just forfeited my junior hacker's badge...) That, of course, is the snag with CISCy instructions: if they're not *exactly* what you want, you might as well not have them.