Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!whuxl!whuxlm!akgua!gatech!seismo!lll-crg!lll-lcc!qantel!hplabs!oliveb!glacier!mips!mash From: mash@mips.UUCP Newsgroups: net.arch Subject: Re: Addressing modes Message-ID: <385@mips.UUCP> Date: Sat, 8-Mar-86 13:37:43 EST Article-I.D.: mips.385 Posted: Sat Mar 8 13:37:43 1986 Date-Received: Tue, 11-Mar-86 01:24:34 EST References: <946@garfield.UUCP> <2900001@ztivax.UUCP> Organization: MIPS Computer Systems, Sunnyvale, CA Lines: 38 David Smyth writes: > However, cliff, a good question you have implied: Does anyone do assembler > programming on RISC machines? > > For example: Is UNIX on RISC entirely in C? How do > the stack recovery mechanisms work? Interrupted / failed instructions? > CPU mode register control manipulation (if applicable)? 1) Does anyone do assembler on RISC machines? Yes. For what it's worth, a well-designed RISC is relatively easy to program in assembler when that makes sense. After all, in those cases, what you're doing is writing microcode (more vertical than horizontal, but with some idea of overlap). 2) Is UNIX on RISC entirely in C? No. On almost any machine, there are bound to be instructions that are hard to get to from C. ALso, there are a few time-critical pieces of code where the programmer knows attributes of the problem that no compiler can reasonably deduce. Example: for string & block copy loops, there is usually a tradeoff between a faster loop with longer setup time, and a slower loop that gets started quicker. It's very hard for a compiler to guess the distribution. 3) Thus, there is still room for selected assembler code. However, from experience with assembler (on S/360s, PDP-11s, VAXen, 68K's, and our R2000), in most cases I'd rather have fast instructions that are easy to use and give me more access to the machine's pipeline, than most complex ones. Most memory-intensive multi-cycle instructions (like string instructions) run just as fast when hand-coded, because they're memory limited anyway; a lot of them don't really match what you need in some cases: for example, look at all of the mem* and str* routines in SYstem V, and see how well the string operations of most machines do them. About the only win for complex instructions is when they support a datatype (like floating point) that is both frequently used in the application at hand, and difficult to simulate cheaply. -- -john mashey UUCP: {decvax,ucbvax,ihnp4}!decwrl!mips!mash DDD: 408-720-1700 USPS: MIPS Computer Systems, 930 E. Arques, Sunnyvale, CA 94086