Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly x86 > Re: optimizatio...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 13 Topic 4621 of 4729
Post > Topic >>

Re: optimization possibilities...

by "Chris Thomasson" <spamtrap@[EMAIL PROTECTED] > Apr 19, 2008 at 02:06 PM

"Terje Mathisen" <spamtrap@[EMAIL PROTECTED]
> wrote in message 
news:77OdnffMSLK8n5fVnZ2dnUVZ_oOnnZ2d@[EMAIL PROTECTED]
> Chris Thomasson wrote:
>> Before I convert this code into AT&T syntax for GAS to assemble, and to

>> MASM I was wondering if there are any possible optimizations I can 
>> perform on the following code, I will show the C header first:
>
> The code looks OK, at least on a first read-through, but you really
don't 
> need to worry about asm performance details!
>
> The LOCK CMPXCHG etc instructions will take so much time that tiny
things 
> like using XOR EAX,EAX instead of MOV EAX,0 to save code space doesn't 
> matter.

;^)




> The one thing I would change would be the function call/return format:
>
> You are using the cdecl default of stackbased parameters and caller
stack 
> cleanup, but you only use one or two parameters for most functions,
right?

Indeed.




> If you instead use register-based calling each call can be simpler & 
> faster, and the implementation becomes shorter as well:

Okay. I am wondering about the consistency of the fastcall calling 
convention. I am going to move this from inline _asm to pure assembly
files 
that can be assembled with MASM and GAS. I am going this mainly because I
am 
not good with GCC inline-assembly, and VC++ do***entation mentioned 
something about dropping sup****t for it in future versions...

I would like to be able to allow a fairly diverse number of C compilers to

link against the assembled object files. Do you have any tips on how to 
produce a "****table" register based calling convention? I know that VC++
and 
GCC have fastcall directives, but I wonder if they pass parameters in the 
same registers. I think I remember reading something in the do***entation 
for VC++ that says fastcall is subject to change in further releases of
the 
compiler.

If I can't reliably use register-based calling convention in the object 
files, then, well I guess the code is good enough as-is... Humm...





[...]

> but at this point it should be obvious that this particular function can

> be implemented as a single-line inline macro, since there is nothing
here 
> except for an atomic store. :-)

;^)

[...]
 




 13 Posts in Topic:
optimization possibilities...
"Chris Thomasson&quo  2008-04-18 17:30:10 
Re: optimization possibilities...
Terje Mathisen <spamt  2008-04-19 07:30:55 
Re: optimization possibilities...
"Chris Thomasson&quo  2008-04-19 14:06:11 
Re: optimization possibilities...
Timothy Baldwin <spam  2008-04-19 11:40:51 
Re: optimization possibilities...
"Chris Thomasson&quo  2008-04-19 12:27:17 
Re: optimization possibilities...
Timothy Baldwin <spam  2008-04-22 20:36:39 
Re: optimization possibilities...
"Chris Thomasson&quo  2008-04-22 16:58:52 
Re: optimization possibilities...
"Chris Thomasson&quo  2008-04-19 16:53:01 
Re: optimization possibilities...
"Alexei A. Frounze&q  2008-04-19 00:15:30 
Re: optimization possibilities...
"Chris Thomasson&quo  2008-04-19 12:41:01 
Re: optimization possibilities...
"Alexei A. Frounze&q  2008-04-20 02:12:38 
Re: optimization possibilities...
"Chris Thomasson&quo  2008-04-20 11:33:37 
Re: optimization possibilities...
"Chris Thomasson&quo  2008-06-10 23:30:33 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 21:03:16 CDT 2008.