brk's zero-fill behavior on VAXen

Guy Harris guy at sun.uucp
Thu Nov 6 06:22:37 AEST 1986


> "One or a few" is not a meaningful criterion.

I'll agree with that, but...

> The Vax's MOVC5 instruction is indeed a single instruction - but it runs
> at just about the same speed as an equivalent sequence of CLRL (reg)+
> instructions.

Oh, really?  *Which* VAX's MOVC5 instruction?  I tried this on an 11/750,
and got:

% cat bzeroes.s
        .globl  _bzerow1
        .align  2
_bzerow1:
        .word   0
        movl    4(ap),r3
        movc5   $0,(r3),$0,8(ap),(r3)	# conventional MOVC5
        ret

        .globl  _bzerow2
        .align  2
_bzerow2:
        .word   0
        movl    4(ap),r3
        movl    8(ap),r2
1:
        clrl    (r3)+			# SOBGTR loop of CLRL
        sobgtr  r2,1b			# NOTE - "bzerow1" takes a byte
        ret				# count, this one takes a longword
					# count

        .globl  _bzerow3
        .align  2
_bzerow3:
        .word   0
        movl    4(ap),r3
        clrl    (r3)+			# a total of 1024 CLRLs
	...
	clrl	(r3)+
        ret

I built three programs, each of which just calls a byte-clearer 1024 times.

The first program calls "bzerow1" with a count of 4096 (bytes); "time" gives

	1.1u 0.0s 0:01 89% 5+11k 0+1io 2pf+0w

The second calls "bzerow2" with a count of 1024 (longwords); "time" gives

	3.6u 0.0s 0:03 95% 1+11k 0+0io 1pf+0w

The third calls "bzerow3", which always clears 1024 longwords (the count is
irrelevant); "time" gives

	2.1u 0.0s 0:02 91% 5+11k 0+0io 1pf+0w
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy at sun.com (or guy at sun.arpa)



More information about the Comp.unix.wizards mailing list