Sender: nate AT cartsys DOT com Message-ID: <36E47E68.E834BD8D@cartsys.com> Date: Mon, 08 Mar 1999 17:50:32 -0800 From: Nate Eldredge X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.1 i586) MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: Help needed to learn ASM References: <0LebGBAgcD42EwWu AT dunvegan1 DOT demon DOT co DOT uk> <36e3787f DOT 7191289 AT 158 DOT 152 DOT 254 DOT 68> <36e2e0cd DOT 23664102 AT 158 DOT 152 DOT 254 DOT 68> <36e3ee80 DOT 57683257 AT newshost DOT cc DOT utexas DOT edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Dave Bird wrote: > > In article <36e3ee80 DOT 57683257 AT newshost DOT cc DOT utexas DOT edu>, Jeramie Hicks > writes > >A single inline assembly statement will typically disable all > >compiler-based optimizations for the entire module in most C compilers > >(since a C compiler doesn't try to understand what you're doing with > >the inline asm). Is DJGPP this way too? > > No, it goes mad in the other direction. > > You must always tell it registers IN, OUT, and JUNKED, because every > register you do not mention it assumes is still unchanged for > optimisation purposes. This adds more book-keeping, but it > works wonders for optimisation. > > It can also try inlining short functions which are assem, and > (unless you mark the asm block "volatile") moving it out of loops! Or deleting it altogether. If you don't mark it volatile, and the compiler finds that the output values aren't used, it can go away. This is disabled for the common case of asm blocks with no outputs whatever, since the compiler assumes that a total lack of outputs implies side effects, or else why write it at all? -- Nate Eldredge nate AT cartsys DOT com