From: TAMURA K. <ke...@ha...> - 2001-10-26 08:44:04
|
In message "[Mingw-users] help on inline assmebly" on 01/10/26, "cateroc" <ca...@16...> writes: > there was no error when i compile it with with msvc compiler (cl.exe). > but i got many warning and errors when i compile it with gcc (version > 2.95.3-6 (mingw special)). The syntax of assembly and inline assembly of gcc is different from that of VC++. MinGW distribution has "as" manual, info-html\as.html, and gcc manual has information about inline assembly, info-html\gcc.html -> C Extensions -> Extended Asm. Here is an example for MinGW: int mmxIsEnabled() { register int ret __asm__ ("%eax"); __asm__ volatile ( "pushfl popl %%eax movl %%eax,%%ebx xorl $0x00200000,%%eax pushl %%eax popfl pushfl popl %%eax subl %%ebx,%%eax jz 0f movl $1,%%eax cpuid and $0x00800000,%%edx movl %%edx,%%eax 0:" : "=r" (ret) : /* no inputs */ : "%ebx", "%edx" /* broken registers */); return ret; } -- TAMURA Kent <ke...@ha...> <ke...@ne...> |