From: "Alexei A. Frounze" Newsgroups: comp.os.msdos.djgpp Subject: Re: inefficiency of GCC output code & -O problem Date: Fri, 14 Apr 2000 10:22:46 +0400 Organization: MTU-Intel ISP Lines: 38 Message-ID: <38F6B936.3D092A46@mtu-net.ru> References: <38F6137B DOT 47481761 AT mtu-net DOT ru> <38f6342c DOT 52524603 AT news DOT freeserve DOT net> <38F637C7 DOT 4F4ECB6 AT mtu-net DOT ru> <38F6A957 DOT 90A167DE AT is DOT elta DOT co DOT il> NNTP-Posting-Host: ppp97-38.dialup.mtu-net.ru Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-Trace: gavrilo.mtu.ru 955693397 6856 212.188.97.38 (14 Apr 2000 06:23:17 GMT) X-Complaints-To: usenet-abuse AT mtu DOT ru NNTP-Posting-Date: 14 Apr 2000 06:23:17 GMT X-Mailer: Mozilla 4.61 [en] (Win95; I) X-Accept-Language: en,ru To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com OKay, but is the ``: "g" (value)'' invalid thing unsupported by GCC/AS? If not, what are the actual limitations/restrictions to it? I've never seen such ones. Just only a limit of up to 6 arguments, if all they are put to the conventional registers (EAX,EBX,ECX,EDX,ESI,EDI). Is there something extra I should know for using :"g"() correctly? Why GCC/AS accept *different rules* of inline ASM under different optimization switches? thanks. Alexei A. Frounze ----------------------------------------- Homepage: http://alexfru.chat.ru Mirror: http://members.xoom.com/alexfru Eli Zaretskii wrote: > > "Alexei A. Frounze" wrote: > > > > Steamer wrote: > > > The bugs in your code are in the interface between the C and the inline > > > assembly. They may not cause a problem if you don't use -O2, but they > > > surely will as soon as the optimizer starts trying to rearrange things, > > > remove redundant instructions, avoid unnecessary memory access, etc. > > > > Thus design of the optimizer is buggy as well. :)) > > No, the optimizer is okay, and the interface between GCC and Gas is okay as > well. You just need to put into the inline assembly the necessary magic > (constraints and clobbered registers) to let GCC know enough about the inline > fragment so that it could Do The Right Thing. > > However, if you intend purposefully to fight GCC and deliberately not abide > by the rules of correct inline assembly, don't be surprised if GCC and Gas > will fight back and produce invalid code... ;-)