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.
5 .if !defined(CPUTYPE) || empty(CPUTYPE) || ${CPUTYPE} == "native"
7 . if defined(CPUTYPE) && !empty(CPUTYPE) && ${CPUTYPE} == "native"
8 _CPUCFLAGS = -march=native
13 . if ${MACHINE_ARCH} == "i386"
14 MACHINE_CPU = i486 i386
15 . elif ${MACHINE_ARCH} == "x86_64"
16 MACHINE_CPU = x86_64 sse2 sse mmx
23 # Old CPUTYPE compat shim
24 . if ${MACHINE_ARCH} == "i386"
25 . if ${CPUTYPE} == "core"
27 . elif ${CPUTYPE} == "p4"
29 . elif ${CPUTYPE} == "p4m"
31 . elif ${CPUTYPE} == "p3"
33 . elif ${CPUTYPE} == "p3m"
35 . elif ${CPUTYPE} == "p-m"
37 . elif ${CPUTYPE} == "p2"
39 . elif ${CPUTYPE} == "i586/mmx"
41 . elif ${CPUTYPE} == "k5"
43 . elif ${CPUTYPE} == "k7"
45 . elif ${CPUTYPE} == "crusoe"
47 _CPUCFLAGS_FIXUP = -falign-functions=0 -falign-jumps=0 -falign-loops=0
49 . elif ${MACHINE_ARCH} == "x86_64"
50 . if ${CPUTYPE} == "prescott"
56 . if ${CPUTYPE} == "i586"
58 . elif ${CPUTYPE} == "i686"
60 . elif ${CPUTYPE} == "pentium3m"
62 . elif ${CPUTYPE} == "pentium4m"
64 . elif ${CPUTYPE} == "k6-2"
66 . elif ${CPUTYPE} == "athlon-tbird"
68 . elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-4"
70 . elif ${CPUTYPE} == "k8" || ${CPUTYPE} == "opteron" || \
71 ${CPUTYPE} == "athlon-fx"
73 . elif ${CPUTYPE} == "k8-sse3" || ${CPUTYPE} == "opteron-sse3"
74 CPUTYPE = athlon64-sse3
75 . elif ${CPUTYPE} == "amdfam10"
79 ###############################################################################
80 # Logic to set up correct gcc optimization flag. This must be included
81 # after /etc/make.conf so it can react to the local value of CPUTYPE
82 # defined therein. Consult:
83 # http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86-64-Options.html
85 _CPUCFLAGS = -march=${CPUTYPE} ${_CPUCFLAGS_FIXUP}
87 # Set up the list of CPU features based on the CPU type. This is an
88 # unordered list to make it easy for client makefiles to test for the
89 # presence of a CPU feature.
91 . if ${MACHINE_ARCH} == "i386"
92 . if ${CPUTYPE} == "barcelona"
93 MACHINE_CPU = athlon-xp athlon k7 3dnow abm sse4a sse3 sse2 sse mmx k6 k5 \
95 . elif ${CPUTYPE} == "athlon64-sse3"
96 MACHINE_CPU = athlon-xp athlon k7 3dnow sse3 sse2 sse mmx k6 k5 i586 i486 i386
97 . elif ${CPUTYPE} == "athlon64"
98 MACHINE_CPU = athlon-xp athlon k7 3dnow sse2 sse mmx k6 k5 i586 i486 i386
99 . elif ${CPUTYPE} == "athlon-xp"
100 MACHINE_CPU = athlon-xp athlon k7 3dnow sse mmx k6 k5 i586 i486 i386
101 . elif ${CPUTYPE} == "athlon"
102 MACHINE_CPU = athlon k7 3dnow mmx k6 k5 i586 i486 i386
103 . elif ${CPUTYPE} == "k6-3"
104 MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386
105 . elif ${CPUTYPE} == "k6"
106 MACHINE_CPU = mmx k6 k5 i586 i486 i386
107 . elif ${CPUTYPE} == "c3"
108 MACHINE_CPU = 3dnow mmx i586 i486 i386
109 . elif ${CPUTYPE} == "c3-2"
110 MACHINE_CPU = sse mmx i586 i486 i386
111 . elif ${CPUTYPE} == "geode"
112 MACHINE_CPU = 3dnow i686 mmx i586 i486 i386
113 . elif ${CPUTYPE} == "winchip2"
114 MACHINE_CPU = 3dnow mmx i486 i386
115 . elif ${CPUTYPE} == "winchip-c6"
116 MACHINE_CPU = mmx i486 i386
117 . elif ${CPUTYPE} == "core2"
118 MACHINE_CPU = ssse3 sse3 sse2 sse i686 mmx i586 i486 i386
119 . elif ${CPUTYPE} == "prescott" || ${CPUTYPE} == "nocona"
120 MACHINE_CPU = sse3 sse2 sse i686 mmx i586 i486 i386
121 . elif ${CPUTYPE} == "pentium4" || ${CPUTYPE} == "pentium-m"
122 MACHINE_CPU = sse2 sse i686 mmx i586 i486 i386
123 . elif ${CPUTYPE} == "pentium3"
124 MACHINE_CPU = sse i686 mmx i586 i486 i386
125 . elif ${CPUTYPE} == "pentium2"
126 MACHINE_CPU = i686 mmx i586 i486 i386
127 . elif ${CPUTYPE} == "pentiumpro"
128 MACHINE_CPU = i686 i586 i486 i386
129 . elif ${CPUTYPE} == "pentium-mmx"
130 MACHINE_CPU = mmx i586 i486 i386
131 . elif ${CPUTYPE} == "pentium"
132 MACHINE_CPU = i586 i486 i386
133 . elif ${CPUTYPE} == "i486"
134 MACHINE_CPU = i486 i386
135 . elif ${CPUTYPE} == "i386"
138 . elif ${MACHINE_ARCH} == "x86_64"
139 . if ${CPUTYPE} == "barcelona"
140 MACHINE_CPU = k8 3dnow abm sse4a sse3
141 . elif ${CPUTYPE} == "athlon64-sse3"
142 MACHINE_CPU = k8 3dnow sse3
143 . elif ${CPUTYPE} == "athlon64"
144 MACHINE_CPU = k8 3dnow
145 . elif ${CPUTYPE} == "core2"
146 MACHINE_CPU = ssse3 sse3
147 . elif ${CPUTYPE} == "nocona"
150 MACHINE_CPU += x86_64 sse2 sse mmx