| Commit | Line | Data |
|---|---|---|
| cdefb602 SS |
1 | # Set default CPU compile flags and baseline CPUTYPE for each arch. The |
| 2 | # compile flags must support the minimum CPU type for each architecture but | |
| 3 | # may tune support for more advanced processors. | |
| 4 | ||
| 5 | .if !defined(CPUTYPE) || empty(CPUTYPE) | |
| 6 | . if ${MACHINE_ARCH} == "i386" | |
| 7 | CPUTYPE = i686 | |
| c1543a89 | 8 | . elif ${MACHINE_ARCH} == "x86_64" |
| cdefb602 SS |
9 | CPUTYPE = athlon64 |
| 10 | . endif | |
| 11 | .endif | |
| 12 | ||
| 13 | # Handle aliases (not documented in make.conf to avoid user confusion | |
| 14 | # between e.g. i586 and pentium) | |
| 15 | ||
| 16 | .if ${CPUTYPE} == "core" | |
| 17 | CPUTYPE = nocona | |
| 18 | .elif ${CPUTYPE} == "p4" | |
| 19 | CPUTYPE = pentium4 | |
| 20 | .elif ${CPUTYPE} == "p4m" | |
| 21 | CPUTYPE = pentium4m | |
| 22 | .elif ${CPUTYPE} == "p3" | |
| 23 | CPUTYPE = pentium3 | |
| 24 | .elif ${CPUTYPE} == "p3m" | |
| 25 | CPUTYPE = pentium3m | |
| 26 | .elif ${CPUTYPE} == "p-m" | |
| 27 | CPUTYPE = pentium-m | |
| 28 | .elif ${CPUTYPE} == "p2" | |
| 29 | CPUTYPE = pentium2 | |
| de607877 SS |
30 | .elif ${CPUTYPE} == "i686" |
| 31 | CPUTYPE = pentiumpro | |
| cdefb602 SS |
32 | .elif ${CPUTYPE} == "i586/mmx" |
| 33 | CPUTYPE = pentium-mmx | |
| 34 | .elif ${CPUTYPE} == "i586" | |
| 35 | CPUTYPE = pentium | |
| 36 | .elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "k8" | |
| 37 | CPUTYPE = athlon64 | |
| 38 | .elif ${CPUTYPE} == "k7" | |
| 39 | CPUTYPE = athlon | |
| 40 | .endif | |
| 41 | ||
| 42 | ############################################################################### | |
| 43 | # Logic to set up correct gcc optimization flag. This must be included | |
| 44 | # after /etc/make.conf so it can react to the local value of CPUTYPE | |
| 45 | # defined therein. Consult: | |
| 46 | # http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html | |
| 47 | # http://gcc.gnu.org/onlinedocs/gcc/IA-64-Options.html | |
| 48 | # http://gcc.gnu.org/onlinedocs/gcc/RS-6000-and-PowerPC-Options.html | |
| 49 | # http://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html | |
| 50 | # http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86-64-Options.html | |
| 51 | ||
| 52 | .if ${MACHINE_ARCH} == "i386" | |
| 53 | . if ${CPUTYPE} == "crusoe" | |
| 54 | _CPUCFLAGS = -march=i686 -falign-functions=0 -falign-jumps=0 -falign-loops=0 | |
| 55 | . elif ${CPUTYPE} == "k5" | |
| 56 | _CPUCFLAGS = -march=pentium | |
| 57 | . else | |
| 58 | _CPUCFLAGS = -march=${CPUTYPE} | |
| 59 | . endif # GCC on 'i386' | |
| c1543a89 | 60 | .elif ${MACHINE_ARCH} == "x86_64" |
| cdefb602 SS |
61 | _CPUCFLAGS = -march=${CPUTYPE} |
| 62 | .endif | |
| 63 | ||
| 64 | # Set up the list of CPU features based on the CPU type. This is an | |
| 65 | # unordered list to make it easy for client makefiles to test for the | |
| 66 | # presence of a CPU feature. | |
| 67 | ||
| 68 | .if ${MACHINE_ARCH} == "i386" | |
| 69 | . if ${CPUTYPE} == "athlon64-sse" | |
| 70 | MACHINE_CPU = athlon-xp athlon k7 3dnow sse3 sse2 sse mmx k6 k5 i586 i486 i386 | |
| 71 | . elif ${CPUTYPE} == "athlon64" | |
| 72 | MACHINE_CPU = athlon-xp athlon k7 3dnow sse2 sse mmx k6 k5 i586 i486 i386 | |
| 73 | . elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || ${CPUTYPE} == "athlon-4" | |
| 74 | MACHINE_CPU = athlon-xp athlon k7 3dnow sse mmx k6 k5 i586 i486 i386 | |
| 75 | . elif ${CPUTYPE} == "athlon" || ${CPUTYPE} == "athlon-tbird" | |
| 76 | MACHINE_CPU = athlon k7 3dnow mmx k6 k5 i586 i486 i386 | |
| 77 | . elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" | |
| 78 | MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386 | |
| 79 | . elif ${CPUTYPE} == "k6" | |
| 80 | MACHINE_CPU = mmx k6 k5 i586 i486 i386 | |
| 81 | . elif ${CPUTYPE} == "k5" | |
| 82 | MACHINE_CPU = k5 i586 i486 i386 | |
| 83 | . elif ${CPUTYPE} == "c3" | |
| 84 | MACHINE_CPU = 3dnow mmx i586 i486 i386 | |
| 85 | . elif ${CPUTYPE} == "c3-2" | |
| 86 | MACHINE_CPU = sse mmx i586 i486 i386 | |
| 87 | . elif ${CPUTYPE} == "core2" | |
| 88 | MACHINE_CPU = ssse3 sse3 sse2 sse i686 mmx i586 i486 i386 | |
| 89 | . elif ${CPUTYPE} == "prescott" || ${CPUTYPE} == "nocona" | |
| 90 | MACHINE_CPU = sse3 sse2 sse i686 mmx i586 i486 i386 | |
| 91 | . elif ${CPUTYPE} == "pentium4" || ${CPUTYPE} == "pentium4m" || ${CPUTYPE} == "pentium-m" | |
| 92 | MACHINE_CPU = sse2 sse i686 mmx i586 i486 i386 | |
| 93 | . elif ${CPUTYPE} == "pentium3" || ${CPUTYPE} == "pentium3m" | |
| 94 | MACHINE_CPU = sse i686 mmx i586 i486 i386 | |
| 95 | . elif ${CPUTYPE} == "pentium2" | |
| 96 | MACHINE_CPU = i686 mmx i586 i486 i386 | |
| 97 | . elif ${CPUTYPE} == "pentiumpro" | |
| 98 | MACHINE_CPU = i686 i586 i486 i386 | |
| 99 | . elif ${CPUTYPE} == "pentium-mmx" | |
| 100 | MACHINE_CPU = mmx i586 i486 i386 | |
| 101 | . elif ${CPUTYPE} == "pentium" | |
| 102 | MACHINE_CPU = i586 i486 i386 | |
| 103 | . elif ${CPUTYPE} == "i486" | |
| 104 | MACHINE_CPU = i486 i386 | |
| 105 | . elif ${CPUTYPE} == "i386" | |
| 106 | MACHINE_CPU = i386 | |
| 107 | . endif | |
| c1543a89 | 108 | .elif ${MACHINE_ARCH} == "x86_64" |
| cdefb602 SS |
109 | . if ${CPUTYPE} == "athlon64-sse3" |
| 110 | MACHINE_CPU = k8 3dnow sse3 | |
| 111 | . elif ${CPUTYPE} == "athlon64" | |
| 112 | MACHINE_CPU = k8 3dnow | |
| 113 | . elif ${CPUTYPE} == "nocona" | |
| 114 | MACHINE_CPU = sse3 | |
| 115 | . elif ${CPUTYPE} == "core2" | |
| 116 | MACHINE_CPU = ssse3 sse3 | |
| 117 | . endif | |
| c1543a89 | 118 | MACHINE_CPU += x86_64 sse2 sse mmx |
| cdefb602 | 119 | .endif |