Tweak previous: use shorter instructions to accomplish the same

#task (minimizes overhead).
This commit is contained in:
scottr 1999-06-09 15:34:08 +00:00
parent 6e2b65ec1d
commit 6adfba2698
1 changed files with 15 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.115 1999/06/09 06:59:53 scottr Exp $ */ /* $NetBSD: locore.s,v 1.116 1999/06/09 15:34:08 scottr Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -1499,20 +1499,23 @@ Lm68881rdone:
* the loops will run from a single cache half-line. * the loops will run from a single cache half-line.
*/ */
.align 8 | align to half-line boundary .align 8 | align to half-line boundary
nop | pad to align Ldelay
nop
nop
ENTRY(_delay) ENTRY(_delay)
movl sp@(4),d0 movl sp@(4),d0 | get iterations
jeq Ldelayexit jeq Ldelayexit | bail out if nothing to do
movl d0,d1 movql #0,d1 | put bits 15-0 in d1 for the
andl #0xffff,d0 movw d0,d1 | inner loop, and move bits
swap d1 movw #0,d0 | 31-16 to the low-order word
subql #1,d0 subql #1,d1 | of d0 for the outer loop
andl #0xffff,d1 swap d0
Ldelay: Ldelay:
tstl _C_LABEL(delay_flag) tstl _C_LABEL(delay_flag) | this never changes for delay()!
dbeq d1,Ldelay | (used only for timing purposes)
dbeq d0,Ldelay dbeq d0,Ldelay
dbeq d1,Ldelay addqw #1,d1 | adjust end count and
addql #1,d0 swap d0 | return the longword result
swap d1
orl d1,d0 orl d1,d0
Ldelayexit: Ldelayexit:
rts rts