Re: [eigen] Performance gap between gcc and msvc ? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
If that might help, I use the following code in one of my project to get a working 'cpuid' across compilers:
(inside a proper #ifdef for x86/amd64, of course):
#if defined(__GNUC__)
# if defined(__PIC__) && defined(__i386__)
# define cpuid(abcd,func) \
__asm__ __volatile__ ("xchgl %%ebx, %%esi;cpuid; xchgl %%ebx,%%esi": "=a" (abcd[0]), "=S" (abcd[1]), "=c" (abcd[2]), "=d" (abcd[3]) : "a" (func));
# else
# define cpuid(abcd,func) \
__asm__ __volatile__ ("cpuid": "=a" (abcd[0]), "=b" (abcd[1]), "=c" (abcd[2]), "=d" (abcd[3]) : "a" (func) );
# endif
#elif defined(_MSC_VER)
# define cpuid(abcd,func) __cpuid((int*)abcd,func)
#endif
#ifndef cpuid
#error "Failed to find a way to get cpuid() for this architecture."
#endif
(and wikipedia describes what you can get, very useful :-)
Thomas
--
Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>
http://www.freehackers.org/thomas
In data venerdì 18 giugno 2010 23:42:50, Benoit Jacob ha scritto:
> ok, looks what we need is just the CPUID instruction.
>
> http://en.wikipedia.org/wiki/CPUID#EAX.3D2:_Cache_and_TLB_Descriptor_information
>
> apparently this is what linux uses for /proc/cpuinfo.