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
${CPUTYPE} == "i586" \
27 . elif
${CPUTYPE} == "i586/mmx"
29 . elif
${CPUTYPE} == "p2"
31 . elif
${CPUTYPE} == "pentium3m" \
32 ||
${CPUTYPE} == "p3m" \
33 ||
${CPUTYPE} == "p3" \
34 ||
${CPUTYPE} == "c3-2"
36 . elif
${CPUTYPE} == "pentium4m" \
37 ||
${CPUTYPE} == "pentium-m" \
38 ||
${CPUTYPE} == "p-m" \
39 ||
${CPUTYPE} == "p4"\
40 ||
${CPUTYPE} == "p4m"
42 . elif
${CPUTYPE} == "crusoe"
44 _CPUCFLAGS_FIXUP
= -falign-functions
=0 -falign-jumps
=0 -falign-loops
=0
45 . elif
${CPUTYPE} == "i686"
47 . elif
${CPUTYPE} == "k6-2"
49 . elif
${CPUTYPE} == "k7" \
50 ||
${CPUTYPE} == "athlon-tbird"
52 . elif
${CPUTYPE} == "athlon-mp" \
53 ||
${CPUTYPE} == "athlon-4"
55 . elif
${CPUTYPE} == "k8" \
56 ||
${CPUTYPE} == "opteron" \
57 ||
${CPUTYPE} == "athlon-fx"
59 . elif
${CPUTYPE} == "k8-sse3" \
60 ||
${CPUTYPE} == "opteron-sse3"
61 CPUTYPE
= athlon64-sse3
62 . elif
${CPUTYPE} == "amdfam10"
64 . elif
${CPUTYPE} == "c3"
66 . elif
${CPUTYPE} == "core"
68 . elif
${CPUTYPE} == "corei7-avx" \
69 ||
${CPUTYPE} == "corei7-avx-i" \
70 ||
${CPUTYPE} == "corei7-avx2"
72 . elif
${CPUTYPE} == "atom"
74 . elif
${CPUTYPE} == "bdver2"
76 . elif
${CPUTYPE} == "btver1"
80 ###############################################################################
81 # Logic to set up correct gcc optimization flag. This must be included
82 # after /etc/make.conf so it can react to the local value of CPUTYPE
83 # defined therein. Consult:
84 # http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86-64-Options.html
86 _CPUCFLAGS
= -march
=${CPUTYPE} ${_CPUCFLAGS_FIXUP}
88 # Set up the list of CPU features based on the CPU type. This is an
89 # unordered list to make it easy for client makefiles to test for the
90 # presence of a CPU feature.
92 . if
${MACHINE_ARCH} == "i386"
93 . if
${CPUTYPE} == "bdver1"
94 MACHINE_CPU
= abm
3dnow mmx sse4.2 sse4.1 sse3 sse2 sse \
95 athlon-xp athlon k7 k6 k5 i586
96 . elif
${CPUTYPE} == "barcelona"
97 MACHINE_CPU
= abm
3dnow mmx sse4a sse3 sse2 sse \
98 athlon-xp athlon k7 k6 k5 i586
99 . elif
${CPUTYPE} == "athlon64-sse3"
100 MACHINE_CPU
= 3dnow mmx sse3 sse2 sse athlon-xp athlon k7 k6 k5 i586
101 . elif
${CPUTYPE} == "athlon64"
102 MACHINE_CPU
= 3dnow mmx sse2 sse athlon-xp athlon k7 k6 k5 i586
103 . elif
${CPUTYPE} == "athlon-xp"
104 MACHINE_CPU
= 3dnow mmx sse athlon-xp athlon k7 k6 k5 i586
105 . elif
${CPUTYPE} == "athlon"
106 MACHINE_CPU
= 3dnow mmx athlon k7 k6 k5 i586
107 . elif
${CPUTYPE} == "k6-3"
108 MACHINE_CPU
= 3dnow mmx k6 k5 i586
109 . elif
${CPUTYPE} == "k6"
110 MACHINE_CPU
= mmx k6 k5 i586
111 . elif
${CPUTYPE} == "geode"
112 MACHINE_CPU
= 3dnow mmx i686 i586
113 . elif
${CPUTYPE} == "corei7"
114 MACHINE_CPU
= sse4.2 sse4.1 ssse3 sse3 sse2 sse mmx i686 i586
115 . elif
${CPUTYPE} == "core2"
116 MACHINE_CPU
= ssse3 sse3 sse2 sse mmx i686 i586
117 . elif
${CPUTYPE} == "nocona"
118 MACHINE_CPU
= sse3 sse2 sse mmx i686 i586
119 . elif
${CPUTYPE} == "prescott"
120 MACHINE_CPU
= sse3 sse2 sse mmx i686 i586
121 . elif
${CPUTYPE} == "pentium4"
122 MACHINE_CPU
= sse2 sse mmx i686 i586
123 . elif
${CPUTYPE} == "pentium3"
124 MACHINE_CPU
= sse mmx i686 i586
125 . elif
${CPUTYPE} == "pentium2"
126 MACHINE_CPU
= mmx i686 i586
127 . elif
${CPUTYPE} == "pentiumpro"
128 MACHINE_CPU
= i686 i586
129 . elif
${CPUTYPE} == "winchip2"
130 MACHINE_CPU
= 3dnow mmx
131 . elif
${CPUTYPE} == "winchip-c6"
133 . elif
${CPUTYPE} == "pentium-mmx"
134 MACHINE_CPU
= mmx i586
135 . elif
${CPUTYPE} == "pentium"
138 MACHINE_CPU
+= i386 i486
139 . elif
${MACHINE_ARCH} == "x86_64"
140 . if
${CPUTYPE} == "bdver1"
141 MACHINE_CPU
= k8 abm
3dnow sse4.2 sse4.1 sse3
142 . elif
${CPUTYPE} == "barcelona"
143 MACHINE_CPU
= k8 abm
3dnow sse4a sse3
144 . elif
${CPUTYPE} == "athlon64-sse3"
145 MACHINE_CPU
= k8
3dnow sse3
146 . elif
${CPUTYPE} == "athlon64"
147 MACHINE_CPU
= k8
3dnow
148 . elif
${CPUTYPE} == "corei7"
149 MACHINE_CPU
= sse4.2 sse4.1 ssse3 sse3
150 . elif
${CPUTYPE} == "core2"
151 MACHINE_CPU
= ssse3 sse3
152 . elif
${CPUTYPE} == "nocona"
155 MACHINE_CPU
+= sse2 sse mmx x86_64