lkml.org 
[lkml]   [1999]   [Jan]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectasm ("rdtsc" : "=A" ((unsigned long long)d) );

Hi,

While grebbing through the latest 2.2.0-pre5 I wonder why the "=A"
constraint isn't used for (atleast) the rdtsc asm's.
IMHO this optimizes quite better in functions returning 'long long'
(aka edx:eax).

The following test program

static inline unsigned long long read_rdtsc(void)
{
unsigned long long d;
__asm__ __volatile__ ("rdtsc" : "=A" (d) );
return d;
}

unsigned long long d;

unsigned long long xxx(void)
{
d = read_rdtsc();
return d;
}

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));

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


Hans
<lermen@fgan.de>


-
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/

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:0.096 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site