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

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

Re: [avr-libc-dev] RFC: avr/bits.h


From: Björn Haase
Subject: Re: [avr-libc-dev] RFC: avr/bits.h
Date: Sun, 6 Mar 2005 15:10:41 +0100
User-agent: KMail/1.7.1

>
> This one takes 43 instructions instead of 8:
>
>   This is the load...
>
>   f8: 89 85           ldd     r24, Y+9        ; 0x09
>   fa: 99 27           eor     r25, r25
>   fc: aa 27           eor     r26, r26
>   fe: bb 27           eor     r27, r27
>
>   and the shift...
>
>  100: b8 2f           mov     r27, r24
>  102: aa 27           eor     r26, r26
>  104: 99 27           eor     r25, r25
>  106: 88 27           eor     r24, r24
>
>   useless code, again...
>
> I had better confidence in compilers before, is it general to gcc or just
> specific to avr-gcc?
>
> /Nicolas.

... same issue as lots of other optimization difficulties of the avr back-end: 
Avr presently suffers from the fact that the back-end pretends that avr 
provides instructions for 32 bit and 16 bit operations. Each of the above  
blocks corresponds to one 32-Bit instruction. Solution will be to break down 
the more complex operations in sequences of individual 8 bit operations. Then 
gcc would also be able to remove useless code :-). I am working at this issue 
but since I am not a real gcc expert, I do not advance very fast ... :-) .
My impression is, that the present implementation ov avr-gcc is fairly good as 
long as you are not mixing variables of different modes. 
Only when mixing variables of different modes, you presently cannot avoid some 
workaround in order to improve code quality.

Yours,

Björn




reply via email to

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