🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #13301

Re: String Processing Instruction

#13301
From: guy
Date: Thu, 26 Mar 1987 19:38
31 lines
2239 bytes
>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.

In most C implementations, "strcpy", "strcmp", etc. are library
routines; if the speedup from these instructions is sufficiently
large, it doesn't matter if the compiler can generate them because
the compiler can generate calls to those routines, and those routines
can be written in assembler language.  You could also imagine a
compiler that would recognize names like "_builtin_strcpy" and
generate the assembler code for those routines in line, and a
<string.h> that contains

	#define	strcpy	_builtin_strcpy

(see the footnote on page 86 of the October 1, 1986 ANSI C draft).
Another possibility might be to have something like the WE32000 C
compiler's "asm" directive, which permits you to define "functions"
that are expanded in line to assembler code.

Similar techniques can probably be used in other languages.  If they
do string processing in routines, the routines can be written in
assembler language to use these instructions.  If they generate
stereotyped sequences for these string operations, these stereotyped
seqences can use these instructions.

However, I don't know how difficult it would be to recognize various
special cases and generate non-stereotyped sequences that use these
instructions, or how much of a speedup this would give (if these
special cases weren't common, speeding them up might not buy you
enough to worry about it).
Technical Details
Message-ID: <15694@sun.uucp>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!sri-unix!ctnews!pyramid!decwrl!sun!gorodish!guy
References: <15292@amdcad.UUCP> <978@ames.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!sri-unix!ctnews!pyramid!decwrl!sun!gorodish!guy
From: guy@gorodish.UUCP
Newsgroups: comp.arch,comp.lang.c
Subject: Re: String Processing Instruction
Message-ID: <15694@sun.uucp>
Date: Thu, 26-Mar-87 14:38:41 EST
Article-I.D.: sun.15694
Posted: Thu Mar 26 14:38:41 1987
Date-Received: Sat, 28-Mar-87 11:26:12 EST
References: <15292@amdcad.UUCP> <978@ames.UUCP>
Sender: news@sun.uucp
Reply-To: guy@sun.UUCP (Guy Harris)
Distribution: na
Organization: Sun Microsystems, Mountain View
Lines: 31
Keywords: instruction set architectures, Am29000