The builtin function `__builtin_ia32_rdtscp()` is undocumented

Liu Hao
Mon Apr 24 13:44:00 GMT 2017

On 2017/4/24 14:29, Marc Glisse wrote:
> On Mon, 24 Apr 2017, Liu Hao wrote:
>> Today I accidentally found the built-in function
>> `__builtin_ia32_rdtscp()` on GCC6, but there is no documentation about
>> it on <>.
>> Is this an oversight?
> I don't know if it is an oversight, but I think documenting the builtins
> is a bad idea, you are supposed to use the intrinsics instead, in this
> case __rdtscp, which is documented by Intel (and Microsoft).
Yes. This function is not so important for me and I am just a bit curious.

FWIW, I really love using the function `__builtin_pause()`. As you have 
pointed out I should have been using `_mm_pause()` instead, but it 
requires `#include "emmintrin.h"` according to Intel's documentation and 
the `-msse2` command line option when targeting x86. The function 
`__builtin_pause()` works perfectly there. And even if (in the rare 
case) the `PAUSE` instruction isn't recognized by the CPU, it is a valid 
encoding of `REP NOP` thus will not trigger an illegal instruction 
exception nevertheless.

Best regards,

More information about the Gcc-help mailing list