[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-chat] Missed Optimisation ?
From: |
bob |
Subject: |
Re: [avr-chat] Missed Optimisation ? |
Date: |
Tue, 01 Mar 2011 13:53:22 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 |
On 01/03/11 12:56, Graham Davies wrote:
> bob wrote:
>
>
>> ... The code is very simple (runs in Port Change interrupt):
>>
>> if ((PINA & _BV(A2DDATA)) != 0)
>> result |= 0x80000000;
>>
>> result >>= 1;
>
> How is result declared? Are you using the volatile qualifier? If so,
> that would explain why the compiler feels obliged to load and store the
> entire 32 bits.
>
> Graham.
>
>
>
> _______________________________________________
> AVR-chat mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-chat
>
Hi Graham,
yes, I forgot to mention that its "volatile uint32_t result;"
But that doesn't really hold water as it loads and simply discards the
bytes that or 0 in the immediate operand.
I would expect it to either load 4 bytes, OR 4bytes and store 4 bytes
or
load 1byte, OR 1 byte and store 1 byte.
Maybe it's just me, but it seems that the OR part is optimised and the
load part not.
OK I can overcome this by using assembler obviously.
Regards,
Bob
RE: [avr-chat] Missed Optimisation ?, Boyapati, Anitha, 2011/03/02
RE: [avr-chat] Missed Optimisation ?, Boyapati, Anitha, 2011/03/02
Re: [avr-chat] Missed Optimisation ?,
bob <=
Re: [avr-chat] Missed Optimisation ?, bob, 2011/03/01
Re: [avr-chat] Missed Optimisation ?, Graham Davies, 2011/03/01