Re: [eigen] cpuid on MSVC |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] cpuid on MSVC
- From: Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>
- Date: Thu, 24 Jun 2010 09:49:11 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=IOjiZPyoE1BfSpiHnS9a29Tp+VvEJgcrQ/ClnTkyQZ0=; b=AVD6/KzqhQtagKhDgZp5gG+K10sDIKCbsXjq1aeatJHivAlo+ypMdW0gn0IWGFkalu RpwvIWmNAqZ8uUQ1CEQIQN6dtXX3qLN0KlI++f1t0N06AqI3Y/1VrmX+9iTl7A4lbkWh RdPeTfGtc2i9MzlrW8mW/4Blv+Ulmiw+RsJkc=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=B9uzrbdmt6iHcornd+lgZWvTn6FeeZGPV1cwfjl0/zTOtTB3rthsBAEOI2PIGJ366h xuC4Qixn8pNnWfBjuXOMGhwJuCXGtkTFjz4oH1UO49G6f33vKngbOsBYHVFgVt4C/uMF 16bPwTP+vRNr1NcABK41D6/OXcN3gPjbKp0R4=
Assembly is not a good idea. We need to find intrinsics to do it
because the x64 compiler does not allow inline assembly.
See here: http://msdn.microsoft.com/en-us/library/wbk4z78b.aspx
On Thu, Jun 24, 2010 at 9:40 AM, Gael Guennebaud
<gael.guennebaud@xxxxxxxxx> wrote:
> 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 :)
>
> gael
>
>
>