diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-02-26 09:41:14 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-02-26 09:41:14 +0000 |
commit | 13461a18b1605feb17304d52136d100df50ca296 (patch) | |
tree | 7a51a90e4dd9eb198d4bdb93757a24e676865a40 /src/sna/sna_cpu.c | |
parent | 528dbf9ebb2688f476ef283be59d0f2232159dcb (diff) |
sna: Print detected CPU features
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_cpu.c')
-rw-r--r-- | src/sna/sna_cpu.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/sna/sna_cpu.c b/src/sna/sna_cpu.c index c669eb87..d5264641 100644 --- a/src/sna/sna_cpu.c +++ b/src/sna/sna_cpu.c @@ -44,7 +44,7 @@ unsigned sna_cpu_detect(void) unsigned int eax, ebx, ecx, edx; unsigned features = 0; - __cpuid(0, eax, ebx, ecx, edx); + __cpuid(1, eax, ebx, ecx, edx); if (eax & bit_SSE3) features |= SSE3; @@ -89,3 +89,27 @@ unsigned sna_cpu_detect(void) } #endif + +char *sna_cpu_features_to_string(unsigned features, char *line) +{ + char *ret = line; + + if (features & SSE2) + line += sprintf (line, ", sse2"); + if (features & SSE3) + line += sprintf (line, ", sse3"); + if (features & SSSE3) + line += sprintf (line, ", ssse3"); + if (features & SSE4a) + line += sprintf (line, ", sse4a"); + if (features & SSE4_1) + line += sprintf (line, ", sse4.1"); + if (features & SSE4_2) + line += sprintf (line, ", sse4.2"); + if (features & AVX) + line += sprintf (line, ", avx"); + if (features & AVX2) + line += sprintf (line, ", avx2"); + + return ret + 2; +} |