From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Fri, 4 May 2007 22:11:38 -0700 From: Roman Shaposhnick Subject: Re: [9fans] speaking of kenc In-reply-to: <20070503192201.A22416@orthanc.ca> To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Message-id: <1178341898.8179.25.camel@work.sfbay.sun.com> MIME-version: 1.0 Content-type: text/plain Content-transfer-encoding: 7BIT References: <7560b2245493f07219455a36984c983f@coraid.com> <1178244537.16650.1835.camel@work.sfbay.sun.com> <20070503191149.G22416@orthanc.ca> <1178245220.16650.1845.camel@work.sfbay.sun.com> <20070503192201.A22416@orthanc.ca> Topicbox-Message-UUID: 5a911cfe-ead2-11e9-9d60-3106f5b1d025 On Thu, 2007-05-03 at 19:35 -0700, Lyndon Nerenberg wrote: > >> That's called as(1). > > > > On any architecture with a non-trivial register allocation, the above > > statement does not apply. > > As far as performance goes you might be better off not using assembler > > to begin with. > > Exactly. If you want asm, you know where to find it. These days, the > cases where raw assembler really matters are significant enough that a few > in-lines generally don't accomplish anything. I partially agree with you, but anything in hardware that isn't directly represented by C semantics is a fair game for using __asm's. In fact, it is the only way to make your software look good on a particular platform. I don't know how to fix that with C and it seems that the rest of the posters on this thread don't really know either. But this is a problem. > > Compilers (at least the ones I work on) are quite smart > > in how they use precious resource such as registers, and unless you > > can hide everything away on the other side of the 'call' op you'd > > be in trouble mixing your code with what compiler had generated for > > you. > > Sure, the compiler can assist with register allocation, but so can reading > the ABI documentation. The problem is not register allocation per se, but how it ties into instructions scheduling, piplining and all that jazz. And no, you can't beat a smart compiler on architectures as complex as AMD64 and EM64T. Thanks, Roman.