Add initial support for python bindings
[alexxy/gromacs.git] / cmake / TestInlineASM_gcc_x86.c
1 int
2 main()
3 {
4   unsigned int _eax,_ebx,_ecx,_edx;
5   unsigned int level = 0;
6
7   /* Test gcc inline asm for x86. Note that we CANNOT plainly use __x86_64__
8    * to correspond to a 64-bit environment without also checking that __ILP32__
9    * is NOT set, since x32 uses __x86_64__.
10    */
11 #if (defined(__x86_64__) && !defined(__ILP32__))
12     __asm__("push %%rbx       \n\t"
13             "cpuid            \n\t"
14             "movl %%ebx, %1   \n\t"
15             "pop %%rbx        \n\t"
16             : "=a"(_eax), "=r"(_ebx), "=c"(_ecx), "=d"(_edx) : "0"(level));
17 #elif (defined(__x86_64__) && defined(__ILP32__)) || defined(__i386__)
18     __asm__("push %%ebx       \n\t"
19             "cpuid            \n\t"
20             "movl %%ebx, %1   \n\t"
21             "pop %%ebx        \n\t"
22             : "=a"(_eax), "=r"(_ebx), "=c"(_ecx), "=d"(_edx) : "0"(level));
23 #else
24 #    error Cannot detect whether this is a 32-bit or 64-bit x86 build.
25 #endif
26
27   return 0;
28 }