问题
I am using RDTSCP to replace LFENCE;RDTSC sequences and also get the processor ID back so that I know when I'm comparing TSC values after the thread was rescheduled to another CPU.
To ensure I don't run RDTSCP on a too old machine I fallback to RDTSC after a CPUID check (using libcpuid). I'd like to try using the gcc multiple target attribute functionality instead of a CPUID call:
int core2_func (void) __attribute__ ((__target__ ("arch=core2")));
The gcc manual lists a number of cpu families (haswell, skylake, ...). How would I find which cpu family first introduced RDTSCP?
回答1:
According to this1 article which was written in 2006, the RDTSCP
instruction was first introduced in the AMD NPT Family 0Fh processors, which is now called AMD K8 Hammer. However, there are many processors that belong to this family and were released in or before 2006. I found another article, which was originally written in Japanese, but I used Google Translate to translate it to English. That article mentions that "Rev. F" of Family 0Fh supports the RDTSCP
instruction. The processors that are listed there that are branded Rev. F are Athlon 64 FX and Athlon 64 Orleans, both of which were released in 2006. Therefore, these are the first two processors that support RDTSCP
.
The first Intel processor that supports RDTSCP
is Nehalem which was released in 2008.
Footnote 1: I could only find the article using the Wayback Machine and here. It is not there anymore on the AMD website.
来源:https://stackoverflow.com/questions/37682939/what-is-the-gcc-cpu-type-that-includes-support-for-rdtscp