Re: [AD] More AMD64 stuff |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> > Currently, the only thing this is used for is to port over the CPU
> > identification code. This seems to work like a charm, but I'm not too
> > comfortable with the way I had to grab the arguments passed to the
> > function: %rdi gets the first argument, %rsi gets the second one. I did
> > some googling and checking around and this does seem to be normal (and
it
> > certainly simplifies the code significantly), but I'd like to hear more
> > opinions on it.
>
>
> clue: 0.0% sorry i have absolutely zero understanding of this %rdi
thingy.
On the i386, the normal convention is to pass arguments on the stack and
set up a stackframe to read them in (but I think you can also specify that
you want to use registers). On the AMD64, at least when interfacing with a
higher level language, the convention seems to be that the arguments
themselves are passed in registers: %rdi (the 64 bit version of the %edi
register) holds the first argument, %rsi holds the second argument, etc.
> i tend to think its best left upto the compiler if possible.
Yeah, you're probably right. If someone feels adventurous, the output from
gcc would probably be a good place to start. It'll be a mess to get the
alignment of structure members right though.
> in MSVC7 intrinsics can be used to make nice C-like code that uses
> mmx/sse instructions. does GCC support them?
I'm not sure. I've used inline code like
inline int bsr(unsigned int n)
{
asm ("bsr %%eax, %%eax": "=a" (n) : "a" (n) );
return n;
}
but I'm not sure if that's the sort of thing you're refering to?
> whats with the sprintf and strcat ?
> my spelling usually contains 'N's
The test programme doesn't use snprintf or strncat. You're right that it
should probably be changed for that, so feel free to submit a patch for
this ;)
Evert