driver-i386.c (237021) | driver-i386.c (251212) |
---|---|
1/* Subroutines for the gcc driver. | 1/* Subroutines for the gcc driver. |
2 Copyright (C) 2006 Free Software Foundation, Inc. | 2 Copyright (C) 2006, 2007 Free Software Foundation, Inc. |
3 4This file is part of GCC. 5 6GCC is free software; you can redistribute it and/or modify 7it under the terms of the GNU General Public License as published by 8the Free Software Foundation; either version 2, or (at your option) 9any later version. 10 --- 24 unchanged lines hidden (view full) --- 35#define bit_CMPXCHG8B (1 << 8) 36#define bit_CMOV (1 << 15) 37#define bit_MMX (1 << 23) 38#define bit_SSE (1 << 25) 39#define bit_SSE2 (1 << 26) 40 41#define bit_SSE3 (1 << 0) 42#define bit_SSSE3 (1 << 9) | 3 4This file is part of GCC. 5 6GCC is free software; you can redistribute it and/or modify 7it under the terms of the GNU General Public License as published by 8the Free Software Foundation; either version 2, or (at your option) 9any later version. 10 --- 24 unchanged lines hidden (view full) --- 35#define bit_CMPXCHG8B (1 << 8) 36#define bit_CMOV (1 << 15) 37#define bit_MMX (1 << 23) 38#define bit_SSE (1 << 25) 39#define bit_SSE2 (1 << 26) 40 41#define bit_SSE3 (1 << 0) 42#define bit_SSSE3 (1 << 9) |
43#define bit_SSE4a (1 << 6) |
|
43#define bit_CMPXCHG16B (1 << 13) 44 45#define bit_3DNOW (1 << 31) 46#define bit_3DNOWP (1 << 30) 47#define bit_LM (1 << 29) 48 49/* This will be called by the spec parser in gcc.c when it sees 50 a %:local_cpu_detect(args) construct. Currently it will be called --- 12 unchanged lines hidden (view full) --- 63 const char *cpu = NULL; 64 enum processor_type processor = PROCESSOR_I386; 65 unsigned int eax, ebx, ecx, edx; 66 unsigned int max_level; 67 unsigned int vendor; 68 unsigned int ext_level; 69 unsigned char has_mmx = 0, has_3dnow = 0, has_3dnowp = 0, has_sse = 0; 70 unsigned char has_sse2 = 0, has_sse3 = 0, has_ssse3 = 0, has_cmov = 0; | 44#define bit_CMPXCHG16B (1 << 13) 45 46#define bit_3DNOW (1 << 31) 47#define bit_3DNOWP (1 << 30) 48#define bit_LM (1 << 29) 49 50/* This will be called by the spec parser in gcc.c when it sees 51 a %:local_cpu_detect(args) construct. Currently it will be called --- 12 unchanged lines hidden (view full) --- 64 const char *cpu = NULL; 65 enum processor_type processor = PROCESSOR_I386; 66 unsigned int eax, ebx, ecx, edx; 67 unsigned int max_level; 68 unsigned int vendor; 69 unsigned int ext_level; 70 unsigned char has_mmx = 0, has_3dnow = 0, has_3dnowp = 0, has_sse = 0; 71 unsigned char has_sse2 = 0, has_sse3 = 0, has_ssse3 = 0, has_cmov = 0; |
71 unsigned char has_longmode = 0, has_cmpxchg8b = 0; | 72 unsigned char has_longmode = 0, has_cmpxchg8b = 0, has_sse4a = 0; |
72 unsigned char is_amd = 0; 73 unsigned int family = 0; 74 bool arch; 75 76 if (argc < 1) 77 return NULL; 78 79 arch = strcmp (argv[0], "arch") == 0; --- 35 unchanged lines hidden (view full) --- 115 cpuid (0x80000000, eax, ebx, ecx, edx); 116 ext_level = eax; 117 if (ext_level >= 0x80000000) 118 { 119 cpuid (0x80000001, eax, ebx, ecx, edx); 120 has_3dnow = !!(edx & bit_3DNOW); 121 has_3dnowp = !!(edx & bit_3DNOWP); 122 has_longmode = !!(edx & bit_LM); | 73 unsigned char is_amd = 0; 74 unsigned int family = 0; 75 bool arch; 76 77 if (argc < 1) 78 return NULL; 79 80 arch = strcmp (argv[0], "arch") == 0; --- 35 unchanged lines hidden (view full) --- 116 cpuid (0x80000000, eax, ebx, ecx, edx); 117 ext_level = eax; 118 if (ext_level >= 0x80000000) 119 { 120 cpuid (0x80000001, eax, ebx, ecx, edx); 121 has_3dnow = !!(edx & bit_3DNOW); 122 has_3dnowp = !!(edx & bit_3DNOWP); 123 has_longmode = !!(edx & bit_LM); |
124 has_sse4a = !!(ecx & bit_SSE4a); |
|
123 } 124 125 is_amd = vendor == *(unsigned int*)"Auth"; 126 127 if (is_amd) 128 { 129 if (has_mmx) 130 processor = PROCESSOR_K6; 131 if (has_3dnowp) 132 processor = PROCESSOR_ATHLON; 133 if (has_sse2 || has_longmode) 134 processor = PROCESSOR_K8; | 125 } 126 127 is_amd = vendor == *(unsigned int*)"Auth"; 128 129 if (is_amd) 130 { 131 if (has_mmx) 132 processor = PROCESSOR_K6; 133 if (has_3dnowp) 134 processor = PROCESSOR_ATHLON; 135 if (has_sse2 || has_longmode) 136 processor = PROCESSOR_K8; |
137 if (has_sse4a) 138 processor = PROCESSOR_AMDFAM10; |
|
135 } 136 else 137 { 138 switch (family) 139 { 140 case 5: 141 /* Default is PROCESSOR_PENTIUM. */ 142 break; --- 118 unchanged lines hidden (view full) --- 261 cpu = "pentium4"; 262 break; 263 case PROCESSOR_K8: 264 cpu = "k8"; 265 break; 266 case PROCESSOR_NOCONA: 267 cpu = "nocona"; 268 break; | 139 } 140 else 141 { 142 switch (family) 143 { 144 case 5: 145 /* Default is PROCESSOR_PENTIUM. */ 146 break; --- 118 unchanged lines hidden (view full) --- 265 cpu = "pentium4"; 266 break; 267 case PROCESSOR_K8: 268 cpu = "k8"; 269 break; 270 case PROCESSOR_NOCONA: 271 cpu = "nocona"; 272 break; |
273 case PROCESSOR_AMDFAM10: 274 cpu = "amdfam10"; 275 break; |
|
269 case PROCESSOR_GENERIC32: 270 case PROCESSOR_GENERIC64: 271 cpu = "generic"; 272 break; 273 default: 274 abort (); 275 break; 276 } --- 31 unchanged lines hidden --- | 276 case PROCESSOR_GENERIC32: 277 case PROCESSOR_GENERIC64: 278 cpu = "generic"; 279 break; 280 default: 281 abort (); 282 break; 283 } --- 31 unchanged lines hidden --- |