Mercurial > libavcodec.hg
comparison i386/cputest.c @ 2967:ef2149182f1c libavcodec
COSMETICS: Remove all trailing whitespace.
author | diego |
---|---|
date | Sat, 17 Dec 2005 18:14:38 +0000 |
parents | 55a72627a2c5 |
children | bfabfdf9ce55 |
comparison
equal
deleted
inserted
replaced
2966:564788471dd4 | 2967:ef2149182f1c |
---|---|
27 { | 27 { |
28 int rval = 0; | 28 int rval = 0; |
29 int eax, ebx, ecx, edx; | 29 int eax, ebx, ecx, edx; |
30 int max_std_level, max_ext_level, std_caps=0, ext_caps=0; | 30 int max_std_level, max_ext_level, std_caps=0, ext_caps=0; |
31 long a, c; | 31 long a, c; |
32 | 32 |
33 __asm__ __volatile__ ( | 33 __asm__ __volatile__ ( |
34 /* See if CPUID instruction is supported ... */ | 34 /* See if CPUID instruction is supported ... */ |
35 /* ... Get copies of EFLAGS into eax and ecx */ | 35 /* ... Get copies of EFLAGS into eax and ecx */ |
36 "pushf\n\t" | 36 "pushf\n\t" |
37 "pop %0\n\t" | 37 "pop %0\n\t" |
38 "mov %0, %1\n\t" | 38 "mov %0, %1\n\t" |
39 | 39 |
40 /* ... Toggle the ID bit in one copy and store */ | 40 /* ... Toggle the ID bit in one copy and store */ |
41 /* to the EFLAGS reg */ | 41 /* to the EFLAGS reg */ |
42 "xor $0x200000, %0\n\t" | 42 "xor $0x200000, %0\n\t" |
43 "push %0\n\t" | 43 "push %0\n\t" |
44 "popf\n\t" | 44 "popf\n\t" |
45 | 45 |
46 /* ... Get the (hopefully modified) EFLAGS */ | 46 /* ... Get the (hopefully modified) EFLAGS */ |
47 "pushf\n\t" | 47 "pushf\n\t" |
48 "pop %0\n\t" | 48 "pop %0\n\t" |
49 : "=a" (a), "=c" (c) | 49 : "=a" (a), "=c" (c) |
50 : | 50 : |
51 : "cc" | 51 : "cc" |
52 ); | 52 ); |
53 | 53 |
54 if (a == c) | 54 if (a == c) |
55 return 0; /* CPUID not supported */ | 55 return 0; /* CPUID not supported */ |
56 | 56 |
57 cpuid(0, max_std_level, ebx, ecx, edx); | 57 cpuid(0, max_std_level, ebx, ecx, edx); |
58 | 58 |
59 if(max_std_level >= 1){ | 59 if(max_std_level >= 1){ |
60 cpuid(1, eax, ebx, ecx, std_caps); | 60 cpuid(1, eax, ebx, ecx, std_caps); |
61 if (std_caps & (1<<23)) | 61 if (std_caps & (1<<23)) |
62 rval |= MM_MMX; | 62 rval |= MM_MMX; |
63 if (std_caps & (1<<25)) | 63 if (std_caps & (1<<25)) |
64 rval |= MM_MMXEXT | MM_SSE; | 64 rval |= MM_MMXEXT | MM_SSE; |
65 if (std_caps & (1<<26)) | 65 if (std_caps & (1<<26)) |
66 rval |= MM_SSE2; | 66 rval |= MM_SSE2; |
67 } | 67 } |
68 | 68 |
69 cpuid(0x80000000, max_ext_level, ebx, ecx, edx); | 69 cpuid(0x80000000, max_ext_level, ebx, ecx, edx); |
70 | 70 |
101 Rev. 1.01 table 1), so we'll check the value of eax for | 101 Rev. 1.01 table 1), so we'll check the value of eax for |
102 CPUID/0 to see if standard CPUID level 2 is supported. | 102 CPUID/0 to see if standard CPUID level 2 is supported. |
103 According to the table, the only CPU which supports level | 103 According to the table, the only CPU which supports level |
104 2 is also the only one which supports extended CPUID levels. | 104 2 is also the only one which supports extended CPUID levels. |
105 */ | 105 */ |
106 if (eax < 2) | 106 if (eax < 2) |
107 return rval; | 107 return rval; |
108 if (ext_caps & (1<<24)) | 108 if (ext_caps & (1<<24)) |
109 rval |= MM_MMXEXT; | 109 rval |= MM_MMXEXT; |
110 } | 110 } |
111 #if 0 | 111 #if 0 |
112 av_log(NULL, AV_LOG_DEBUG, "%s%s%s%s%s%s\n", | 112 av_log(NULL, AV_LOG_DEBUG, "%s%s%s%s%s%s\n", |
113 (rval&MM_MMX) ? "MMX ":"", | 113 (rval&MM_MMX) ? "MMX ":"", |
114 (rval&MM_MMXEXT) ? "MMX2 ":"", | 114 (rval&MM_MMXEXT) ? "MMX2 ":"", |
115 (rval&MM_SSE) ? "SSE ":"", | 115 (rval&MM_SSE) ? "SSE ":"", |
116 (rval&MM_SSE2) ? "SSE2 ":"", | 116 (rval&MM_SSE2) ? "SSE2 ":"", |
117 (rval&MM_3DNOW) ? "3DNow ":"", | 117 (rval&MM_3DNOW) ? "3DNow ":"", |
118 (rval&MM_3DNOWEXT) ? "3DNowExt ":""); | 118 (rval&MM_3DNOWEXT) ? "3DNowExt ":""); |
119 #endif | 119 #endif |
120 return rval; | 120 return rval; |
121 } | 121 } |
122 | 122 |