Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!husc6!yale!bunker!ricker From: ricker@bunker.UUCP Newsgroups: comp.lang.c Subject: Re: String Processing Instruction Message-ID: <1818@bunker.UUCP> Date: Tue, 31-Mar-87 10:42:46 EST Article-I.D.: bunker.1818 Posted: Tue Mar 31 10:42:46 1987 Date-Received: Thu, 2-Apr-87 04:56:27 EST References: <15292@amdcad.UUCP> <978@ames.UUCP> <15304@amdcad.UUCP> Reply-To: ricker@bunker.UUCP (ricker) Distribution: na Organization: Bunker Ramo/Olivetti, Trumbull CT Lines: 38 >>My question is this: How likely is it that a compiler itself will be able to >>detect the case when it can use an instruction like this and generate code >>automatically to use it.... The Wang Labs VS processor also has some very useful assembler (not machine) instructions for string processing. The manner in which this is handled is by adding an attribute to functions called "builtin". This enables the C (or other language) compiler to generate in-line code for functions that are in the instruction set. Example: builtin char *memcpy(); main() { struct stbuf { char buf[8]; int i; } structure1; struct stbuf structure2; /** initialize structure1 with code here **/ /** This function generates a single VS assembler instruction **/ memcpy(&structure2,&structure2,sizeof(structure1)); } The list of builtins is clearly listed in the reference manual and includes all the standard System 5 string functions. If one does not wish to use builtins, then the function is declared explicitly without the builtin attribute. I am not sure, but I think I recall that if the function is not declared explicitly and the function is a builtin, then it is treated as a builtin. Portability is not a problem with this scheme. Your basic ricker.