Re: [eigen] Building eigen in non x86/amd64/ppc archs

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


Hi,

I think the proper solution should be along the line of:

#if defined(__GNUC__)

# if defined(__i386__)

# if defined(__PIC__)

# define EIGEN_CPUID(abcd,func,id) \

__asm__ __volatile__ ("xchgl %%ebx, %%esi;cpuid; xchgl %%ebx,%%esi": "=a" (abcd[0]), "=S" (abcd[1]), "=c" (abcd[2]), "=d" (abcd[3]) : "a" (func), "c" (id));

# else

# 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) );

# endif

# endif

#elif defined(_MSC_VER)

# if (_MSC_VER > 1500) /* newer than MSVC++ 9.0 */ || (_MSC_VER == 1500 && _MSC_FULL_VER >= 150030729) /* MSVC++ 9.0 with SP1*/

# define EIGEN_CPUID(abcd,func,id) __cpuidex((int*)abcd,func,id)

# endif

#endif

Shouldn't it ?

Better switch on i386 instead of a list of negation that might be incomplete (as it is right now).

I'd like one or two confirmation before comitting.

++

Thomas

--

Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>

http://www.freehackers.org/thomas

On Monday 27 December 2010 16:57:59 Jose Luis Blanco wrote:

> On Mon, Dec 27, 2010 at 9:05 AM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:

> > So, patches welcome!

>

> OK. I can confirm you that changing just this single line:

>

> ==========================

> --- eigen3/Eigen/src/Core/util/Memory.h

> +++ eigen3/Eigen/src/Core/util/Memory.h

> @@ -601,7 +601,7 @@

> # if defined(__PIC__) && defined(__i386__)

> # define EIGEN_CPUID(abcd,func,id) \

> __asm__ __volatile__ ("xchgl %%ebx, %%esi;cpuid; xchgl

> %%ebx,%%esi": "=a" (abcd[0]), "=S" (abcd[1]), "=c" (abcd[2]), "=d"

> (abcd[3]) : "a" (func), "c" (id));

> -# elif !defined(__arm__) && !defined(__powerpc__)

> +# elif !defined(__arm__) && !defined(__powerpc__) &&

> !defined(__mips__) && !defined(__sparc__) && !defined(__sh__) &&

> !defined(__s390__) && !defined(__m68k__) && !defined(__ia64__) &&

> !defined(__hppa__)

> # 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) );

> # endif

> ==========================

>

> fixes the compilation under MIPS, and hopefully in the rest of

> platforms (if you're interested, I'll let you know if it's really the

> case, but building one single file in a MIPS emulator took me ~30mins,

> so it'll take days!!!).

>

> Please, apply that patch upstream. You can also replace all those "&&

> !defined()" by a few "|| define()" if you are sure on which platforms

> cpuid works... (x86 & x86_64?).

>

> Thanks and... have a happy new year!

>

> JL

>

>

>



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