[eigen] cpuid on MSVC

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

Hi msvc developers,

as some of you probably known, we are now using the cpuid instruction
to retrieve CPU cache sizes. To do so I need to provide to cpuid two
information: the function code in the eax register and the cache id in
ecx. However, the msvc __cpuid intrinsics seems to be too limited
since it only allows to set the function code. So I'd some help from
msvc gurus to write inline assembly code doing that. For the record
here is the GCC version:

define EIGEN_CPUID(abcd,func,id) \
       __asm__ __volatile__ ("cpuid": "=a" (abcd[0]), "=b" (abcd[1]),
"=c" (abcd[2]), "=d" (abcd[3]) : "a" (func), "c" (id) );

The assembly is one instruction only: cpuid, thes next four items
after the ":" are the outputs where "a" means eax register, "b" ==
ebx, etc. and the last two item are the inputs which are put into the
eax and ecx registers respectively.

The code is in eigen/Eigen/src/Core/util/Memory.h line 598.

thanks a lot :)


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/