Subject: Re: query on timing of some asm
To: Chris Gilbert <chris@paradox.demon.co.uk>
From: Ben Harris <bjh21@netbsd.org>
List: port-arm
Date: 04/10/2001 00:28:10
On Tue, 10 Apr 2001, Chris Gilbert wrote:

> 	ldr	r6, [r7, r9, lsl #2]	/* Get address of first handler structure */
>         ldr	r4, Lcnt		/* Stat info A */
>
> 	teq	r6, #0x00000000		/* Do we have a handler */
> 	moveq	r0, r8			/* IRQ requests as arg 0 */
[...]
> 	ldr	r6, [r7, r9, lsl #2]	/* Get address of first handler structure */
>         ldr	r4, Lcnt		/* Stat info A */
>
> 	mov	r0, r8			/* IRQ requests as arg 0 */
> 	teq	r6, #0x00000000		/* Do we have a handler */
>
> where the value of r0 only matters if r6 == NULL, it's overwritten elsewhere
> if r6 != NULL.
>
> would actually save 1 cycle?  Or does this turn out to depend on the
> processor?

It's processor-dependent to some extent, since not all ARMs have clever
load-delay handling, so the LDR will always stall on old ones.  On the
other hand, you're right that they take the same time to execute a MOV as
not to execute it, so your suggestion has zero net effect there.

-- 
Ben Harris                                                   <bjh21@netbsd.org>
Portmaster, NetBSD/arm26               <URL:http://www.netbsd.org/Ports/arm26/>