diff -r 303583d2fb97 -r 4b84e90325c5 tools/cpuflags.c --- a/tools/cpuflags.c Mon Apr 14 12:51:50 2008 +0200 +++ b/tools/cpuflags.c Tue Apr 15 17:12:50 2008 +0200 @@ -221,14 +221,10 @@ { if (model <= 1) arch = "pentiumpro"; else if (model < 7) arch = "pentium2"; - else if (model == 7) arch = "pentium3"; - else if (model < 15) arch = "pentium-m"; - else if (model == 15) - { - if (stepping < 6) arch = "core"; - else arch = "core2"; - } - + else if (model < 12) arch = "pentium3"; + else if (model < 14) arch = "pentium-m"; + else if (model == 14) arch = "prescott"; // core + else if (model == 15) arch = "core2"; } else if (family > 6) { /* family == 15 */ @@ -295,7 +291,12 @@ gccarch = arch; if (gccver < (float)4.3) { - if (!strcmp(gccarch, "core2")) gccarch = "pentium3"; + if (!strcmp(gccarch, "core2")) gccarch = "pentium-m"; + } + if (gccver < (float)3.41) + { + if (!strcmp(gccarch, "prescott")) gccarch = "pentium4"; + if (!strcmp(gccarch, "pentium-m")) gccarch = "pentium4"; } if (gccver < (float)3.4) { @@ -314,7 +315,6 @@ || !strcmp(gccarch, "pentium4")) gccarch = "pentiumpro"; } - if (gccver < (float)3.0) { if (!strcmp(gccarch, "athlon")) @@ -322,8 +322,7 @@ else if (!strcmp(gccarch, "k6")) gccarch = "pentium"; } - - if (gccver < (float)2.9) + if (gccver < (float)2.95) { if (!strcmp(gccarch, "pentiumpro")) gccarch = "i686"; @@ -351,7 +350,7 @@ } } - /* intelc options */ + /* IntelC options */ iccarch = arch; icctune = arch; iccsimd = ""; @@ -361,8 +360,19 @@ else if (simd.has_sse2) iccsimd = "-msse2"; printf("%s\n", arch); + + /* GCC flags */ if (gccver >= 4.2) gccarch = "native"; - printf("-march=%s -mtune=%s %s\n", gccarch, gccarch, gccsimd); +#ifdef __x86_64__ + /* do not output i386 flags on x86_64 */ + if (strcmp(gccarch, "core2") != 0 && strcmp(gccarch, "native") != 0) + printf("%s\n", gccsimd); + else +#endif + printf("-march=%s %s\n", gccarch, gccsimd); + + /* IntelC flags */ printf("-march=%s -mtune=%s %s\n", iccarch, icctune, iccsimd); + return 0; }