确定英特尔ID指南中列出的CPUID [英] Determine CPUID as listed in the Intel Intrinsics Guide

查看:170
本文介绍了确定英特尔ID指南中列出的CPUID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Intel Intrinsics Guide中,一些Intrinsics的底部都有延迟和吞吐量信息",列出了多个CPUID的性能.

In the Intel Intrinsics Guide there are 'Latency and Throughput Information' at the bottom of several Intrinsics, listing the performance for several CPUID(s).

例如,《内在指南》中的表对于内在_mm_hadd_pd如下所示:

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

现在:如何确定我的CPU拥有什么ID?

Now: How do I determine, what ID my CPU has?

我正在使用Kubuntu 12.04,并尝试使用sudo dmidecode -t 4以及Ubuntu软件包中的小程序cpuid,但是它们的输出并不是真正有用.

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.

在以上命令的输出中的任何地方都找不到《 Intrinsics Guide》中列出的任何字符串.

I cannot find any of the strings listed in the Intrinsics Guide anywhere in the output of the commands above.

推荐答案

您可以使用CPUID指令获取该信息,其中

you can get that information using CPUID instruction, where

大家庭,位位置20到 与家人一起使用27 位位置8到11中指定的代码,指示处理器是否属于 Intel386,Intel486,Pentium,Pentium Pro或Pentium 4系列处理器. P6 系列处理器包括所有基于奔腾Pro处理器架构的处理器 并有一个等于00h的大家庭 和一个家庭代码等于06h.奔腾4 家族处理器包括所有基于IntelNetBurst®微体系结构的处理器 并有一个等于00h的大家庭和一个等于0Fh的家庭代码.

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.

在位positi中指定的扩展模型 结合16至19 在第4位到第7位中指定的型号是 用于识别处理器的型号 在处理者的家庭中.

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.

然后,实际的CPUID为"family_model". 以下代码可以完成这项工作:

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

CPUID: 06_25

希望有帮助.

这篇关于确定英特尔ID指南中列出的CPUID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆