aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2010-06-26 23:15:06 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2010-06-26 23:15:06 +0200
commit931027f31be7ffa50389d7c9e82b0ce99434e500 (patch)
tree3a3e4a676d08d4eb656990747c0a8aa213d8a112 /Eigen/src/Core
parentd8b1ce664b10d5cfd5be3497c57134be07f43916 (diff)
add a utilility to debug cpuid, and makes sure we get 0 if we query an unsupported cpuid function
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r--Eigen/src/Core/util/Memory.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h
index 30d9b2377..83b2dd90d 100644
--- a/Eigen/src/Core/util/Memory.h
+++ b/Eigen/src/Core/util/Memory.h
@@ -614,6 +614,7 @@ inline void ei_queryCacheSizes_intel(int& l1, int& l2, int& l3)
int cache_id = 0;
int cache_type = 0;
do {
+ abcd[0] = abcd[1] = abcd[2] = abcd[3] = 0;
EIGEN_CPUID(abcd,0x4,cache_id);
cache_type = (abcd[0] & 0x0F) >> 0;
if(cache_type==1||cache_type==3) // data or unified cache
@@ -641,8 +642,10 @@ inline void ei_queryCacheSizes_intel(int& l1, int& l2, int& l3)
inline void ei_queryCacheSizes_amd(int& l1, int& l2, int& l3)
{
int abcd[4];
+ abcd[0] = abcd[1] = abcd[2] = abcd[3] = 0;
EIGEN_CPUID(abcd,0x80000005,0);
l1 = (abcd[2] >> 24) * 1024; // C[31:24] = L1 size in KB
+ abcd[0] = abcd[1] = abcd[2] = abcd[3] = 0;
EIGEN_CPUID(abcd,0x80000006,0);
l2 = (abcd[2] >> 16) * 1024; // C[31;16] = l2 cache size in KB
l3 = ((abcd[3] & 0xFFFC000) >> 18) * 512 * 1024; // D[31;18] = l3 cache size in 512KB