Re: udelay() on alpha

From: Ivan Kokshaysky (ink@jurassic.park.msu.ru)
Date: Fri Mar 03 2000 - 02:46:49 EST


On Thu, Mar 02, 2000 at 01:06:48PM -0800, Richard Henderson wrote:
> rpcc %1
> 1: rpcc %0
> subl %0,%1,%0
> cmpult %0,%2,%0
> bne %0,1b
> : "=&r" (tmp), "=&r" (cc) : "r"((int)loops));
>
> Or with the (int) moved back to the __delay prototype.
> With both arguments to cmpult properly sign extended
> we get proper results without the extra zap instruction.

Agreed, but in either case we're in trouble with
loops = 0xffffffff (or close) - chances to break the loop
are small. Although such values must not be passed
to __delay anyway.

Alternatively we can use

        rpcc %0
        addl %1,%0,%1
1: rpcc %0
        subl %1,%0,%0
        bgt %0,1b
        : "=&r" (tmp), "=&r" (loops) : "1"(loops));

loops here must be positive int, but it's still up to
2+ seconds for 1 GHz.

Ivan.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:14 EST