簡體   English   中英

i5-2500k上的cpuid指令:未設置MMX,SSE,SSE2位

[英]cpuid instruction on i5-2500k: MMX, SSE, SSE2 bits are not set

這是預期的嗎? 我希望我的Sandy Bridge CPU報告它可以處理MMX,SSE和SSE2指令。 這些位是否未設置,因為這些“舊”指令集已被某些較新的指令集“取代”?

在這里使用此代碼將CPU檢測放入我的代碼中。

#include "CPUID.h"
int main(int argc, char *argv[]) {
    CPUID cpuid;
    cpuid.load(0);
    printf("CPU: %.4s%.4s%.4s", 
        (const char*)&cpuid.EBX(),
        (const char*)&cpuid.EDX(),
        (const char*)&cpuid.ECX()
    );
    char brand[0x30];
    cpuid.load(0x80000002); memcpy(brand,&cpuid.EAX(),16);
    cpuid.load(0x80000003); memcpy(brand+16,&cpuid.EAX(),16);
    cpuid.load(0x80000004); memcpy(brand+32,&cpuid.EAX(),16);
    printf("%.48s\n",brand);
    cpuid.load(1);
    // tests bit 23 of ECX for popcnt instruction support
    printf("MMX - %s\n", cpuid.EAX() & (1 << 23) ? "yes" : "no");
    printf("SSE - %s\n", cpuid.EAX() & (1 << 25) ? "yes" : "no"); 
    printf("SSE2 - %s\n", cpuid.EAX() & (1 << 26) ? "yes" : "no"); 
    printf("SSE3 - %s\n", cpuid.ECX() & (1 << 0) ? "yes" : "no"); 
    printf("SSSE3 - %s\n", cpuid.ECX() & (1 << 9) ? "yes" : "no"); 
    printf("SSE4.1 - %s\n", cpuid.ECX() & (1 << 19) ? "yes" : "no"); 
    printf("SSE4.2 - %s\n", cpuid.ECX() & (1 << 20) ? "yes" : "no"); 
    printf("AES - %s\n", cpuid.ECX() & (1 << 25) ? "yes" : "no"); 
    printf("AVX - %s\n", cpuid.ECX() & (1 << 28) ? "yes" : "no"); 
    printf("HT - %s\n", cpuid.EAX() & (1 << 28) ? "yes" : "no"); 
    printf("IA64 (emulating x86) - %s\n", cpuid.EAX() & (1 << 30) ? "yes" : "no"); 
    printf("Hypervisor? - %s\n", cpuid.ECX() & (1 << 31) ? "yes" : "no"); 
    printf("popcnt - %s\n", cpuid.ECX() & (1 << 23) ? "yes" : "no");
    return 0;
}

輸出:

CPU: GenuineIntel       Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz
MMX - no
SSE - no
SSE2 - no
SSE3 - yes
SSSE3 - yes
SSE4.1 - yes
SSE4.2 - yes
AES - yes
AVX - yes
HT - no
IA64 (emulating x86) - no
Hypervisor? - no
popcnt - yes

愚蠢的錯誤。 我假設表中的第一行是針對EAX的,但它適用於EDX。

產生了正確的結果。 好吧,這個芯片不支持HT,但可能總是設置。

更新:結果“HT”表示包裝上的> 1個邏輯線程(該芯片有4個)。

CPU: GenuineIntel       Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz
MMX - yes
SSE - yes
SSE2 - yes
SSE3 - yes
SSSE3 - yes
SSE4.1 - yes
SSE4.2 - yes
AES - yes
AVX - yes
HT - yes
IA64 (emulating x86) - no
Hypervisor? - no
popcnt - yes

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM