Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!sharkey!atanasoff!hascall From: hascall@atanasoff.cs.iastate.edu (John Hascall) Newsgroups: comp.arch Subject: Re: Re: MicroVAX emulation Message-ID: <902@atanasoff.cs.iastate.edu> Date: 23 Mar 89 16:08:45 GMT References: <807@microsoft.UUCP> <92634@sun.uucp> <13322@steinmetz.ge.com> <1133@auspex.UUCP> <12000@haddock.ima.isc.com> <1368@husc6.harvard.edu> <679@scaup.cl.cam.ac.uk> <12035@haddock.ima.isc.com> <687@scaup.cl.cam.ac.uk> <37515@bbn.COM> <15665@winchester.mips.COM Reply-To: hascall@atanasoff.cs.iastate.edu (John Hascall) Organization: Iowa State Univ. Computation Center Lines: 92 In article <15665@winchester.mips.COM> rogerk@mips.COM (Roger B.A. Klorese) writes: >In article <37515@bbn.COM> slackey@BBN.COM (Stan Lackey) writes: >>The MICROvax architecture does NOT include >>string instructions, other than MOVC3 (and MOVC5?). Some DEC-supplied >>software includes emulation to ease the transition. Generating the >>in-line emulation using a reduced instruction set is NO PROBLEM, right? >There *IS NO* MicroVAX architecture. There is a MicroVAX *implementation* >of the VAX architecture, which implements some instructions in software. >This is very different. >>1. The uVAX is NOT said to implement the VAX architecture. >I've never seen this claimed. To quote from "VAX MACRO and Instruction Set Reference Manual", page 9-126, "Character String Instructions--LOCC": This instruction is not part of the MicroVAX architecture definition. This notice appears at the bottom of each page which describes an instruction not in the MicroVAX architecture. Since we are on this topic, here is a little experiment I ran. I wrote a version of the C function strlen (which basically looks for a byte of 0x00) which does not use the LOCC (locate character instruction), but rather uses the trick: ((x - 0x01010101) & ~x) & 0x80808080) != 0) to scan 4 characters at a time for the null-byte, it basically looks like: MOVL 4(AP),R0 ; address of string (arg 1) in R0 5$: SUBL3 #^x01010101,(R0),R1 ; R1 = *string - 0x01010101 BICL2 (R0)+,R1 ; R1 = R1 & ~*string++ BICL2 #^x7F7F7F7F,R1 ; R1 = R1 & 0x80808080 BEQL 5$ ; all 4 bytes are non-zero BBS #7,R1,10$ ; low order byte was 0 BBS #15,R1,11$ ; second byte was 0 BBS #23,R1,12$ ; third bytes was 0 SUBL2 #1,R0 ; high byte was 0, adjust SUBL2 4(AP),R0 ; length = end-start-adjust RET 10$: SUBL2 #2,R0 ; adjust, etc.... Anyway here are some results compared with the "VAXC" strlen: I had a for loop which did 10 strlens/mystrlens, which was repeated x times based on the length of the string l: x = (l < 10) ? 10000 : (l < 100) ? 1000 : (l < 1000) ? 100 : (l < 10000) ? 10 : 1; ----------------- string lengths -------------- machine vers 0 1 9 99 999 9999 99999 ------- ---- ----- ----- ----- ----- ----- ----- ----- VS2000 VAXC 9.16 9.51 12.04 4.03 3.28 3.14 3.17 MINE 2.42 2.52 3.41 1.31 1.13 1.12 1.13 6220 VAXC .89 .98 1.26 .53 .42 .44 .43 MINE .92 .96 1.29 .51 .40 .42 .45 11/780 VAXC 3.02 2.98 3.23 .70 .39 .51 .58 MINE 2.54 2.68 3.50 1.32 1.08 1.16 1.24 11/785 VAXC 2.27 2.30 2.40 .33 .24 .23 .39 MINE 1.97 2.11 2.44 .72 .69 .70 .90 (all were VMS5.0-2 except my vaxstation which is VMS4.7) Since the VS2000 is just a uVAXII, it obviously emulates the LOCC which is in strlen, but what about the 6220? Does it? In four cases the 11/785 (and once the 11/780) toasted the 6220! Perhaps I should try a simple: 5$: TSTB (R1)+ BNEQ 5$ as well. For what it's worth, John Hascall