Subject: Re: VAX instructions (Was: VAX VECTOR chip, what part number?)
To: None <port-vax@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-vax
Date: 05/24/2001 11:19:03
> What I mean is: you have no use of them in C, them are too complex.
> For example, queue insns are not useful to gcc, movtc does what tr(1)
> do, locc is strlen(3) os index(3),

Not quite.  locc can be used for strnlen (to invent a name), provided
as you mention the length is under 64k; throw a loop around it and you
can get strlen.  It would be difficult to build index with it, since
what you really want is to scan for either the char being sought or
NUL.  I think you can do this with one of them - scanc or spanc, maybe;
it's been too long and I don't have my architecture reference handy.
With 64k+256 bytes of scratch space you could do it with movtuc (if I
remember right how movtuc works), but it would be a minor mess and
quite likely slower than a naïve implementation in practice.  (Besides,
I think movtuc is one of the macrocoded instructions on implementations
that do that, in which case it's slower than inline code.)

> movc3 is bcopy(3),

Yes (and movc5 can be used to give memset/bzero; unfortunately not
quite strncpy, though if you do a strnlen first it can, modulo that
annoying 64k limit).

> matchc is strstr(3)

No; matchc is memmem, to invent a name.  To get strstr out of it, you'd
have to do two strlens or equivalent before the matchc.

> Also note that all these insn's have a 64k working space limit.

Yah.  A pain.

Though I would like to see strnlen make it into some standard.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B