Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!ucbvax!amdcad!crackle!tim From: tim@crackle.amd.com (Tim Olson) Newsgroups: comp.arch Subject: Re: Understanding variations in Dhrystone performance Message-ID: <25679@amdcad.AMD.COM> Date: 18 May 89 19:13:30 GMT References: <474@estevax.UUCP> <1989May15.173631.3029@utzoo.uucp> <1989May16.172354.1417@utzoo.uucp> <839@ultb.UUCP> Sender: news@amdcad.AMD.COM Reply-To: tim@amd.com (Tim Olson) Organization: Advanced Micro Devices, Inc. Sunnyvale CA Lines: 51 Summary: Expires: Sender: Followup-To: In article <839@ultb.UUCP> jed4885@ultb.UUCP (J.E. Dyer (713ICS)) writes: | This does seem like alot of work to test for a null byte... Has | anyone considered putting in a test-word-for-byte (twfb?) | instruction on their favorite processor? From the Am29000 User's Manual: CPBYTE CPBYTE Compare Bytes Operation: if (srca.byte0 = srcb.byte0) or (srca.byte1 = srcb.byte1) or (srca.byte2 = srcb.byte2) or (srca.byte3 = srcb.byte3) then dest <- TRUE else dest <- FALSE Description: Each byte of the srca operand is compared to the corresponding byte of the srcb operand. If any corresponding bytes are equal, a Boolean TRUE is placed into the DEST location; otherwise, a Boolean FALSE is placed in the DEST location. Assembler Syntax: cpbyte rc, ra, rb cpbyte rc, ra, const8 | It seems to me that | adding this kind of a function to an alu would be pretty | trivial, and it would make a significant improvement in some | kinds of string operations. Yes, it is trivial. We added it because we felt that it was an easy way to speed up 'C' string operations (str[n]cmp, str[n]cpy, strlen) which must constantly search for a terminating byte. With the cpbyte instruction, string operations can be performed a word at a time. | Of course, your strings would have | to be aligned on word boundaries, but that shouldn't be to | difficult to add to a compiler. Not necessarily. All you have to do is take care of the boundary conditions correctly. -- Tim Olson Advanced Micro Devices (tim@amd.com)