Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!ames!ucbcad!ucbvax!amdcad!bcase From: bcase@amdcad.UUCP Newsgroups: comp.arch,comp.lang.c Subject: Re: String Processing Instruction Message-ID: <15314@amdcad.UUCP> Date: Fri, 27-Mar-87 18:11:50 EST Article-I.D.: amdcad.15314 Posted: Fri Mar 27 18:11:50 1987 Date-Received: Sat, 28-Mar-87 16:03:18 EST References: <15292@amdcad.UUCP> <978@ames.UUCP> <5969@mimsy.UUCP> Reply-To: bcase@amdcad.UUCP (Brian Case) Distribution: na Organization: Advanced Micro Devices, Sunnyvale, California Lines: 23 Keywords: instruction set architectures, Am29000 Xref: utgpu comp.arch:681 comp.lang.c:1355 In article <5969@mimsy.UUCP> mark@mimsy.UUCP (Mark Weiser) writes: >In article <978@ames.UUCP> lamaster@pioneer.UUCP (Hugh LaMaster) writes: >>...How likely is it that a compiler [can] detect the case when it can use >> an instruction like this and generate code automatically to use it? > >This is of course a good point, and it seems that this is going to be >one of those hard cases for compiler writers. But it opens the issue >of subroutine libraries as providing an environment which also needs >support in the instruction set. The Unix string routines are a good >example, because they are even now often recoded in assembly for efficiency. >Various pieces of Unix kernel frequently suffer the same fate >(e.g. tty buffers). But once one is into instructions which are good >for certain operating systems or environments, rather than certain languages, >one has narrowed one's market. For instance, the Am29000 special string >compare is useless if strings are encoded as a length followed by the chars. Yes, you are right: when the length is known, things are *much* easier. But, the instruction is still a useful primitive: it can be used to find out, in one cycle, whether or not a 32-bit word contains a byte of interest. The compiler may not generate it, but it can be used in hand- coded inner loops for this purpose. bcase