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

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

Re: [avr-libc-dev] Missed optimizations


From: Senthil Kumar Selvaraj
Subject: Re: [avr-libc-dev] Missed optimizations
Date: Tue, 18 Apr 2017 11:38:24 +0530
User-agent: mu4e 0.9.18; emacs 25.1.1

Joerg Wunsch writes:

> As Raul Sanchez wrote:
>
>> Just wanted to report the following observations in generated code.
>> Target:__AVR_ATtiny85__Version: AVR gcc 4.6.4Optimization level: -Os
>
> Besides your code missing linefeeds so it's barely readable: sorry,
> GCC code optimization is nothing we could do anything about.  We are
> *only* dealing with the standard library that is frequently used
> together with AVR-GCC.
>
> About AVR-GCC, you'd have to talk to the GCC developers.  However, AVR
> is a minor target only there.  The most competent person to talk to
> about AVR-GCC's optimizations is probably stil Georg-Johann Lay
> though.  He implemented a lot of improvements in that area in the past
> years.

I tried it out with the latest trunk build - it fixes all the missed
optimizations you pointed out, except for clr. According to the
instruction set manual, both ldi reg,0 and clr reg are 16 bit
instructions and both execute in one clock cycle, so I don't see any
missed optimization there.

Compiler Explorer link with your source -  
http://avr-gcc.senthilthecoder.com/#g:!((g:!((g:!((h:codeEditor,i:(j:1,options:(colouriseAsm:'0',compileOnChange:'0'),source:'%23include+%3Cavr/io.h%3E%0A%23include+%3Cstdint.h%3E%0Auint16_t+sum_adc%3B%0Auint16_t+analog%3B%0Auint16_t+adc_buffer%5B64%5D%3B%0Auint8_t+adc_index%3B%0A%0Aint+main()+%7B%0A++sum_adc+%2B%3D+ADC%3B%0A++sum_adc+-%3D+adc_buffer%5Badc_index%5D%3B++%0A++analog+%3D+(uint16_t)+(sum_adc+%3E%3E+3)%3B%0A++return+analog%3B%0A%7D'),l:'5',n:'1',o:'C+source+%231',t:'0')),k:37.96344647519582,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:trunk,filters:(b:'0',commentOnly:'0',directives:'0',intel:'0'),options:'-v+-mmcu%3Dattiny85+-Os'),l:'5',n:'0',o:'%231+with+trunk',t:'0')),k:62.03655352480417,l:'4',n:'0',o:'',s:0,t:'0')),l:'2',n:'0',o:'',t:'0')),version:4




reply via email to

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