gpt4 book ai didi

intrinsics - 确定 Intel Intrinsics Guide 中列出的 CPUID

转载 作者:行者123 更新时间:2023-12-04 21:45:09 26 4
gpt4 key购买 nike

在 Intel Intrinsics Guide 中,在几个 Intrinsics 的底部有“延迟和吞吐量信息”,列出了几个 CPUID 的性能。

例如,Intrinsics Guide 中的表格对于 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?

我正在使用 Kubuntu 12.04 并尝试使用 sudo dmidecode -t 4还有小程序 cpuid来自 Ubuntu 软件包,但它们的输出并不是很有用。

我在上述命令的输出中的任何地方都找不到 Intrinsics Guide 中列出的任何字符串。

最佳答案

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

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.



参见 Intel Processor Identification and the CPUID Instruction 中的第 22 页了解更多详情。

实际的 CPUID 是“family_model”。
以下代码应该可以完成这项工作:
#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;
}

对于我的电脑,我得到:

CPUID: 06_25



希望能帮助到你。

关于intrinsics - 确定 Intel Intrinsics Guide 中列出的 CPUID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15368394/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com