Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/i386/driver-i386.c @ 19:58ad6c70ea60
update gcc from 4.4.0 to 4.4.1.
author | kent@firefly.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Thu, 24 Sep 2009 13:21:57 +0900 |
parents | a06113de4d67 |
children | 77e2b8dfacca |
comparison
equal
deleted
inserted
replaced
18:33936f7f2835 | 19:58ad6c70ea60 |
---|---|
334 } | 334 } |
335 | 335 |
336 enum vendor_signatures | 336 enum vendor_signatures |
337 { | 337 { |
338 SIG_INTEL = 0x756e6547 /* Genu */, | 338 SIG_INTEL = 0x756e6547 /* Genu */, |
339 SIG_AMD = 0x68747541 /* Auth */, | 339 SIG_AMD = 0x68747541 /* Auth */ |
340 }; | |
341 | |
342 enum processor_signatures | |
343 { | |
340 SIG_GEODE = 0x646f6547 /* Geod */ | 344 SIG_GEODE = 0x646f6547 /* Geod */ |
341 }; | 345 }; |
342 | 346 |
343 /* This will be called by the spec parser in gcc.c when it sees | 347 /* This will be called by the spec parser in gcc.c when it sees |
344 a %:local_cpu_detect(args) construct. Currently it will be called | 348 a %:local_cpu_detect(args) construct. Currently it will be called |
372 unsigned int has_cmpxchg8b, has_cmov, has_mmx, has_sse, has_sse2; | 376 unsigned int has_cmpxchg8b, has_cmov, has_mmx, has_sse, has_sse2; |
373 | 377 |
374 /* Extended features */ | 378 /* Extended features */ |
375 unsigned int has_lahf_lm = 0, has_sse4a = 0; | 379 unsigned int has_lahf_lm = 0, has_sse4a = 0; |
376 unsigned int has_longmode = 0, has_3dnowp = 0, has_3dnow = 0; | 380 unsigned int has_longmode = 0, has_3dnowp = 0, has_3dnow = 0; |
381 unsigned int has_sse4_1 = 0, has_sse4_2 = 0; | |
382 unsigned int has_popcnt = 0, has_aes = 0, has_avx = 0; | |
383 unsigned int has_pclmul = 0; | |
377 | 384 |
378 bool arch; | 385 bool arch; |
379 | 386 |
380 if (argc < 1) | 387 if (argc < 1) |
381 return NULL; | 388 return NULL; |
395 model = (eax >> 4) & 0x0f; | 402 model = (eax >> 4) & 0x0f; |
396 family = (eax >> 8) & 0x0f; | 403 family = (eax >> 8) & 0x0f; |
397 | 404 |
398 has_sse3 = ecx & bit_SSE3; | 405 has_sse3 = ecx & bit_SSE3; |
399 has_ssse3 = ecx & bit_SSSE3; | 406 has_ssse3 = ecx & bit_SSSE3; |
407 has_sse4_1 = ecx & bit_SSE4_1; | |
408 has_sse4_2 = ecx & bit_SSE4_2; | |
409 has_avx = ecx & bit_AVX; | |
400 has_cmpxchg16b = ecx & bit_CMPXCHG16B; | 410 has_cmpxchg16b = ecx & bit_CMPXCHG16B; |
411 has_popcnt = ecx & bit_POPCNT; | |
412 has_aes = ecx & bit_AES; | |
413 has_pclmul = ecx & bit_PCLMUL; | |
401 | 414 |
402 has_cmpxchg8b = edx & bit_CMPXCHG8B; | 415 has_cmpxchg8b = edx & bit_CMPXCHG8B; |
403 has_cmov = edx & bit_CMOV; | 416 has_cmov = edx & bit_CMOV; |
404 has_mmx = edx & bit_MMX; | 417 has_mmx = edx & bit_MMX; |
405 has_sse = edx & bit_SSE; | 418 has_sse = edx & bit_SSE; |
431 } | 444 } |
432 } | 445 } |
433 | 446 |
434 if (vendor == SIG_AMD) | 447 if (vendor == SIG_AMD) |
435 { | 448 { |
436 processor = PROCESSOR_PENTIUM; | 449 unsigned int name; |
437 | 450 |
438 if (has_mmx) | 451 /* Detect geode processor by its processor signature. */ |
452 if (ext_level > 0x80000001) | |
453 __cpuid (0x80000002, name, ebx, ecx, edx); | |
454 else | |
455 name = 0; | |
456 | |
457 if (name == SIG_GEODE) | |
458 processor = PROCESSOR_GEODE; | |
459 else if (has_sse4a) | |
460 processor = PROCESSOR_AMDFAM10; | |
461 else if (has_sse2 || has_longmode) | |
462 processor = PROCESSOR_K8; | |
463 else if (has_3dnowp) | |
464 processor = PROCESSOR_ATHLON; | |
465 else if (has_mmx) | |
439 processor = PROCESSOR_K6; | 466 processor = PROCESSOR_K6; |
440 if (has_3dnowp) | 467 else |
441 processor = PROCESSOR_ATHLON; | 468 processor = PROCESSOR_PENTIUM; |
442 if (has_sse2 || has_longmode) | 469 } |
443 processor = PROCESSOR_K8; | |
444 if (has_sse4a) | |
445 processor = PROCESSOR_AMDFAM10; | |
446 } | |
447 else if (vendor == SIG_GEODE) | |
448 processor = PROCESSOR_GEODE; | |
449 else | 470 else |
450 { | 471 { |
451 switch (family) | 472 switch (family) |
452 { | 473 { |
453 case 4: | 474 case 4: |
574 { | 595 { |
575 if (has_cmpxchg16b) | 596 if (has_cmpxchg16b) |
576 options = concat (options, "-mcx16 ", NULL); | 597 options = concat (options, "-mcx16 ", NULL); |
577 if (has_lahf_lm) | 598 if (has_lahf_lm) |
578 options = concat (options, "-msahf ", NULL); | 599 options = concat (options, "-msahf ", NULL); |
600 if (has_aes) | |
601 options = concat (options, "-maes ", NULL); | |
602 if (has_pclmul) | |
603 options = concat (options, "-mpclmul ", NULL); | |
604 if (has_popcnt) | |
605 options = concat (options, "-mpopcnt ", NULL); | |
606 if (has_avx) | |
607 options = concat (options, "-mavx ", NULL); | |
608 else if (has_sse4_2) | |
609 options = concat (options, "-msse4.2 ", NULL); | |
610 else if (has_sse4_1) | |
611 options = concat (options, "-msse4.1 ", NULL); | |
579 } | 612 } |
580 | 613 |
581 done: | 614 done: |
582 return concat (cache, "-m", argv[0], "=", cpu, " ", options, NULL); | 615 return concat (cache, "-m", argv[0], "=", cpu, " ", options, NULL); |
583 } | 616 } |