avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-b


From: Vincent Trouilliez
Subject: Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ?
Date: Fri, 04 Nov 2005 07:59:27 +0100

> I replaced the '&' operator with the more appropriate '&&' one.... works
> much better... 5 instructions instead of 115 (3 + 6*18 + 4) for the
> previous code.
> So that's indeed about 20 times faster. Although I still don't get why
> it can't just use one single SBRC/S instruction instead of these 4 cp or
> cpc instructions... I guess I am still missing something in the bit test
> department...
> 

>               if (address && 0x00040000)
>     24ec:     21 15           cp      r18, r1
>     24ee:     31 05           cpc     r19, r1
>     24f0:     41 05           cpc     r20, r1
>     24f2:     51 05           cpc     r21, r1
>     24f4:     11 f0           breq    .+4             ; 0x24fa



Hmmm, '&&' might give much tighter code than '&', but my program no
longer works ! So it's still not the proper way to test a bit then,
dear... :o(((


--
Vince





reply via email to

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