avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] [bug #12739] Gcc assumes that target libc provides ff


From: Joerg Wunsch
Subject: Re: [avr-libc-dev] [bug #12739] Gcc assumes that target libc provides ffs function
Date: Thu, 21 Apr 2005 06:58:09 +0200
User-agent: Mutt/1.4.2.1i

As Dmitry K. wrote:

> I have look 'ffs' from newlib (1.12.0).  It take up to 800 (!)
> clocks.  Reason: shift is included to loop.

The slightly modified BSD code (counter reduced to 8 bits) yields

        sbiw r24,0
        breq .L1
        ldi r18,lo8(1)
.L9:
        sbrc r24,0
        rjmp .L8
        lsr r25
        ror r24
        subi r18,lo8(-(1))
        rjmp .L9
.L8:
        mov r24,r18
        clr r25
.L1:
        ret

This makes 6 clocks per cycle, so up to ~ 100 clocks max.

I'm interested in seeing Dmitry's code...
-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]