Messages in this thread | | | Date | Thu, 7 Jan 1999 12:38:21 +0100 (MET) | From | Hans Lermen <> | Subject | asm ("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/
| |