What is the gcc cpu-type that includes support for RDTSCP?

ε祈祈猫儿з 提交于 2019-12-10 20:17:22

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!