On Sun, 25 Jul 2021, 22:46 NightStrike via Gcc-help, <gcc-help@xxxxxxxxxxx> wrote: > Where does GCC document how to use the builtin rdtsc and rdtscp functions? > It doesn't, see the Intel Intrinsics Guide: https://software.intel.com/sites/landingpage/IntrinsicsGuide/ Search for __rdtscp there. > Looking at ia32intrin.h, I can see it defined as: > > /* rdtsc */ > #define __rdtsc() __builtin_ia32_rdtsc () > > ... > > /* rdtscp */ > #define __rdtscp(a) __builtin_ia32_rdtscp (a) > > But the top of that file states: > > #ifndef _X86GPRINTRIN_H_INCLUDED > # error "Never use <ia32intrin.h> directly; include <x86gprintrin.h> > instead." > #endif > > Namely, I'm interesting in knowing: > > 1) What the return type of the two functions are > 2) What the 'a' arg is to the second > 3) If using these includes serializing calls to lfence or similar >