yes...
this drives me up the wall.
try:
for (i=0;i<N;i++) asm("; loop %0" ::"r"(i));
then gcc will probably not optimize the loop.
On Friday 29 November 2002 16:55, Steve Underwood wrote:
> Hi Dmitry,
>
> I think this problem is for you.......
>
> I have a delay loop for a slow LCD interface. This includes the
> following routine:
>
> static __inline__ void delay_b(void)
> {
> int i;
>
> for (i = 90; i > 0; i--)
> __asm__ __volatile__("; loop");
> }
>
>
> Compiled with the current mspgcc, this is optimsed to nothing. I
> reported this problem before. It seemed to be fixed a week or two ago,
> but is now back. A slightly modified routine:
>
> static __inline__ void delay_b(void)
> {
> int i;
>
> for (i = 90; i > 0; i--)
> _NOP();
> }
>
> produces a single NOP instruction, and there is no reason why it should
> not. However, if you take away the __inline__ you get something
> unexpected. You get 30 nop instructions, with a loop around them to
> repeat them 3 times. This is correct, but not very efficient :-)
>
> The above effects are with -O2 optimisation.
>
> Regards,
> Steve
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Get the new Palm Tungsten T
> handheld. Power & Color in a compact size!
> http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
--
/********************************************************************
("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
`6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys
(_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44
_..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
(il),-'' (li),' ((!.-' +7 (812) 3468202, 5585314
********************************************************************/