Re: How to comprehend this code snippet: __asm__ __volatile__("rdtsc" : "=A"(t))?

2020-07-16 Thread Jeffrey Walton
On Thu, Jul 16, 2020 at 9:25 AM 孙世龙 sunshilong wrote: > > >The 'A' is the constraint EAX:RDX register pair. > >Also see https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html > >and https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html. > Thanks to your attached document, I find a lot of

Re: How to comprehend this code snippet: __asm__ __volatile__("rdtsc" : "=A"(t))?

2020-07-16 Thread 孙世龙 sunshilong
Hi, Jeff Thank you for taking the time to respond to my question. Thanks to your help, I have a deeper understanding of this matter. >Also read the note in the Machine Constraints for: > unsigned long long rdtsc (void) >{ > unsigned long long tick; > __asm__

Re: How to comprehend this code snippet: __asm__ __volatile__("rdtsc" : "=A"(t))?

2020-07-16 Thread Jeffrey Walton
On Thu, Jul 16, 2020 at 8:22 AM 孙世龙 sunshilong wrote: > > Here is the code snippet: > #define ipipe_read_tsc(t) \ > __asm__ __volatile__("rdtsc" : "=A"(t)) I hope that is i386 only, and not x86_64. > I found that the rdtsc (Read Time-Stamp Counter) instruction is used > to

How to comprehend this code snippet: __asm__ __volatile__("rdtsc" : "=A"(t))?

2020-07-16 Thread 孙世龙 sunshilong
Hi, list Here is the code snippet: #define ipipe_read_tsc(t) \ __asm__ __volatile__("rdtsc" : "=A"(t)) I found that the rdtsc (Read Time-Stamp Counter) instruction is used to determine how many CPU ticks took place since the processor was reset. But what does "=A"(t) mean? Thank