🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Andrew Smith Mon, 20 Jul 1992 20:49
Re: gcc 2.2.2 optimizer bug/68k
#172
Author: Andrew Smith
Date: Mon, 20 Jul 1992 20:49
51 lines
1695 bytes
I'll bet that you did not declare "addr" as a volatile pointer! Unless you
do that, GCC is entitled to think that *addr can never change, so it doesn't
need to recalculate it each time through the loop.

Don't ask me why it still leaves the loop in the program - that is the real bug!


Andrew.

 
> C code: 
> 
>         graph_AMOVE(0,-i);
>         while (!(*addr & 32));
>  
> ------------------------------- 
> 68k assembler code not optimized 
> 
>         jbsr _graph_AMOVE 
>         addqw #8,sp
> L86:
>         movel _addr,a0
>         moveb a0@(1),d0
>         andb #32,d0
>         tstb d0
>         jne L87
>         jra L86
> L87:
>  
> --------------------------------- 
> 68k assembler code with optimization (-O) 
>  
>         jbsr _graph_AMOVE
>         addqw #8,sp
>         movel _addr,a0
>         moveb a0@(1),d0
>         andb #32,d0
> L97:
>         tstb d0
>         jeq L97
>         clrl d0
> 
> 
> -- 
> _____________
> Hermann Hueni Seidenweg 40, CH-3012 Bern,		    +41 31 234 607
> Jucker Informatik, Anlikerweg 5, CH-3626 Huenibach,	    +41 33 434 868
> Physiological Institute, University of Berne, CH-3012 Bern, +41 31 658 726
> e-mail: hueni@optolab.unibe.ch			       fax: +41 31 654 611
> 
> 
Re: gcc 2.2.2 optimizer bug/68k
#277
Author: Ross Ridge
Date: Sat, 25 Jul 1992 21:02
29 lines
1308 bytes
asmith@synoptics.com (Andrew Smith) writes:
>Don't ask me why it still leaves the loop in the program - that is the
>real bug!

It can't get rid of the loop, if "*addr & 32" is true then it should go
into a infinite loop.  You could optimize the loop by branching to
after the test statement instead of before, but what's the point of
doing nothing faster?

>> C code: 
>>         while (!(*addr & 32));
>> --------------------------------- 
>> 68k assembler code with optimization (-O) 
>>  
>>         movel _addr,a0
>>         moveb a0@(1),d0
>>         andb #32,d0
>> L97:
>>         tstb d0
>>         jeq L97
>>         clrl d0

							Ross Ridge

-- 
Ross Ridge - The Great HTMU					     l/	 //
								    [OO][oo]
ross@zooid.guild.org						    /()\/()/
uunet.ca!zooid!ross						     db	 //
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads