comparison i386/cputest.c @ 43:ab64a3fc62bf libavcodec

Portability and testing issues
author nickols_k
date Wed, 08 Aug 2001 16:26:51 +0000
parents c31fb57d17a6
children 718a22dc121f
comparison
equal deleted inserted replaced
42:8068c4bce9c1 43:ab64a3fc62bf
4 #include <stdlib.h> 4 #include <stdlib.h>
5 #include "../dsputil.h" 5 #include "../dsputil.h"
6 6
7 /* ebx saving is necessary for PIC. gcc seems unable to see it alone */ 7 /* ebx saving is necessary for PIC. gcc seems unable to see it alone */
8 #define cpuid(index,eax,ebx,ecx,edx)\ 8 #define cpuid(index,eax,ebx,ecx,edx)\
9 asm ("movl %%ebx, %%esi\n\t"\ 9 __asm __volatile\
10 ("movl %%ebx, %%esi\n\t"\
10 "cpuid\n\t"\ 11 "cpuid\n\t"\
11 "xchgl %%ebx, %%esi"\ 12 "xchgl %%ebx, %%esi"\
12 : "=a" (eax), "=S" (ebx),\ 13 : "=a" (eax), "=S" (ebx),\
13 "=c" (ecx), "=d" (edx)\ 14 "=c" (ecx), "=d" (edx)\
14 : "0" (index)\ 15 : "0" (index));
15 : "cc")\
16 16
17 /* Function to test if multimedia instructions are supported... */ 17 /* Function to test if multimedia instructions are supported... */
18 int mm_support(void) 18 int mm_support(void)
19 { 19 {
20 int rval; 20 int rval;
100 return rval; 100 return rval;
101 } else { 101 } else {
102 return 0; 102 return 0;
103 } 103 }
104 } 104 }
105
106 #ifdef __TEST__
107 int main ( void )
108 {
109 int mm_flags;
110 mm_flags = mm_support();
111 printf("mm_support = 0x%08u\n",mm_flags);
112 return 0;
113 }
114 #endif