In the Intel Intrinsics Guide there are 'Latency and Throughput Information' at the bottom of several Intrinsics, listing the performance for several CPUID(s).
For example, the table in the Intrinsics Guide looks as follows for the Intrinsic _mm_hadd_pd
:
CPUID(s) Parameters Latency Throughput
0F_03 13 4
06_2A xmm1, xmm2 5 2
06_25/2C/1A/1E/1F/2E xmm1, xmm2 5 2
06_17/1D xmm1, xmm2 6 1
06_0F xmm1, xmm2 5 2
Now: How do I determine, what ID my CPU has?
I'm using Kubuntu 12.04 and tried with sudo dmidecode -t 4
and also with the little program cpuid
from the Ubuntu packages, but their output isn't really useful.
I cannot find any of the strings listed in the Intrinsics Guide anywhere in the output of the commands above.
you can get that information using CPUID instruction, where
The extended family, bit positions 20 through 27 are used in conjunction with the family code, specified in bit positions 8 through 11, to indicate whether the processor belongs to the Intel386, Intel486, Pentium, Pentium Pro or Pentium 4 family of processors. P6 family processors include all processors based on the Pentium Pro processor architecture and have an extended family equal to 00h and a family code equal to 06h. Pentium 4 family processors include all processors based on the Intel NetBurst® microarchitecture and have an extended family equal to 00h and a family code equal to 0Fh.
The extended model specified in bit positi ons 16 through 19, in conjunction with the model number specified in bits 4 though 7 are used to identify the model of the processor within the processor’s family.
see page 22 in Intel Processor Identification and the CPUID Instruction for futher details.
Actual CPUID is then "family_model". The following code should do the job:
#include "stdio.h"
int main () {
int ebx = 0, ecx = 0, edx = 0, eax = 1;
__asm__ ("cpuid": "=b" (ebx), "=c" (ecx), "=d" (edx), "=a" (eax):"a" (eax));
int model = (eax & 0x0FF) >> 4;
int extended_model = (eax & 0xF0000) >> 12;
int family_code = (eax & 0xF00) >> 8;
int extended_family_code = (eax & 0xFF00000) >> 16;
printf ("%x %x %x %x \n", eax, ebx, ecx, edx);
printf ("CPUID: %02x %x\n", extended_family_code | family_code, extended_model | model);
return 0;
}
For my computer I get:
CPUID: 06_25
hope it helps.
来源:https://stackoverflow.com/questions/15368394/determine-cpuid-as-listed-in-the-intel-intrinsics-guide