Re: asm ("rdtsc" : "=A" ((unsigned long long)d) );

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Sat, 9 Jan 1999 10:16:15 +0000


On Thu, Jan 07, 1999 at 12:38:21PM +0100, Hans Lermen wrote:
> compiles (-O2) as
>
> xxx:
> pushl %ebp
> movl %esp,%ebp
> #APP
> rdtsc
> #NO_APP
> movl %eax,d
> movl %edx,d+4
> movl %ebp,%esp
> popl %ebp
> ret
>
> which is IMHO realy optimal, much better as what you get using constructs
> such as
>
> __asm__("rdtsc":"=a" (eax), "=d" (edx));

Why does the latter construct not generate code of the same quality? It
certainly should. If it doesn't, there's far more code that will be
affected in the kernel than just `rdtsc'.

> Are there any problems with "=A' and the compilers, that I so far haven't
> seen?

No-one trust the long long support in GCC, I think that's all.

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/