Re: possible optimize bugg

"georg chambert" <[email protected]> Tue, 16 Jan 2018 12:50:42 +0100
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <009c01d38ec0$3d3a91f0$7b88e75a@a>
Hi Erik,
I have a related question; is there any interrest for the avr dev community 
to find & corr buggs;
since I could easily work around this, and leave it be.
The fault I think I have encountered, is some opt. that realizes that these 
are same statements over and over
and tried to put code making this more efficient. Essentially I  move 4 
elementes (bytes) from 7 different
arrays, into yet another array (of 4 elsements), depending on a select 
parameter.
The move is done by the for(i....) loop. I have tried to follow the 
assembler in the .lst file (from the .o),
but thats a bit tricky, expecially since the insertion of the original 
C-lines are quite randomly scattered into
the resulting asm. However there seem to be some elaborate thinking/coding 
going on, rather than a highy repetitive action
which I had expected. and all the 7 "if() for()  " statements are lumped 
together.

----- Original Message ----- 
From: "Erik Christiansen" <[email protected]>
To: <[email protected]>
Sent: Tuesday, January 16, 2018 4:59 AM
Subject: Re: [avr-gcc-list] possible optimize bugg


> Reply-To: [email protected]
>
> On 16.01.18 01:17, georg chambert wrote:
>>
>> msg_on[0] = 0b10001000; // address
>>
>> msg_on[1] = 0b00000000; // PWZS Tmmm : (?) mmm = cool
>>
>> msg_on[2] = 0b10000100; // tttt,vvvv ; 23c , high vent
>>
>> msg_on[3] = 0b11000000; // pppp, 0 ; parity
>>
>> -----  etc for 6 more messages ----
>
> ...
>
>> if (msg_nbr == 0) for (i=0;i<4;i++) seq[i] = msg_off[i]; // load a 
>> selected message to send (off)
>
> No information provided on msg_off, so no diagnosis possible.
>
>> //if (msg_nbr == 1) for (i=0;i<4;i++) seq[i] = msg_on[i]; //
>
> This is the only line which addresses the msg_on array.
>
>> //if (msg_nbr == 2) for (i=0;i<4;i++) seq[i] = msg_on26[i]; //
>>
>> //if (msg_nbr == 3) for (i=0;i<4;i++) seq[i] = msg_on1[i]; //
>>
>> //if (msg_nbr == 4) for (i=0;i<4;i++) seq[i] = msg_on2[i];
>>
>> //if (msg_nbr == 5) for (i=0;i<4;i++) seq[i] = msg_on3[i];
>>
>> if (msg_nbr == 6) for (i=0;i<4;i++) seq[i] = msg_on4[i];
>
> No information provided on msg_on4, a different array, so no diagnosis 
> possible.
>
>> When I comment out the inbetween statements the last one for 6, works,
>> else the data in seq array is not what  I just put the msg_on4 just
>> before.
>
> You might try: $ nm yourfile.elf | grep msg_on
> then compare the values for msg_on and msg_on4.
> If you have made them the same address, in a way not shown, then the
> same data could be expected, if I understand what you're trying to do.
>
> Erik
>
>
> _______________________________________________
> AVR-GCC-list mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/avr-gcc-list