3 # Set default CPU compile flags and baseline CPUTYPE for each arch. The
4 # compile flags must support the minimum CPU type for each architecture but
5 # may tune support for more advanced processors.
7 .if !defined(CPUTYPE) || empty(CPUTYPE)
9 . if ${MACHINE_ARCH} == "i386"
11 . elif ${MACHINE_ARCH} == "alpha"
12 _CPUCFLAGS = -mcpu=ev4 -mtune=ev5
14 . elif ${MACHINE_ARCH} == "amd64"
15 MACHINE_CPU = amd64 sse2 sse
16 . elif ${MACHINE_ARCH} == "ia64"
18 . elif ${MACHINE_ARCH} == "sparc64"
19 . elif ${MACHINE_ARCH} == "arm"
24 # Handle aliases (not documented in make.conf to avoid user confusion
25 # between e.g. i586 and pentium)
27 . if ${MACHINE_ARCH} == "i386"
28 . if ${CPUTYPE} == "nocona"
30 . elif ${CPUTYPE} == "p4"
32 . elif ${CPUTYPE} == "p4m"
34 . elif ${CPUTYPE} == "p3"
36 . elif ${CPUTYPE} == "p3m"
38 . elif ${CPUTYPE} == "p-m"
40 . elif ${CPUTYPE} == "p2"
42 . elif ${CPUTYPE} == "i686"
44 . elif ${CPUTYPE} == "i586/mmx"
46 . elif ${CPUTYPE} == "i586"
48 . elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || \
51 . elif ${CPUTYPE} == "k7"
54 . elif ${MACHINE_ARCH} == "amd64"
55 . if ${CPUTYPE} == "prescott"
60 ###############################################################################
61 # Logic to set up correct gcc optimization flag. This must be included
62 # after /etc/make.conf so it can react to the local value of CPUTYPE
63 # defined therein. Consult:
64 # http://gcc.gnu.org/onlinedocs/gcc/DEC-Alpha-Options.html
65 # http://gcc.gnu.org/onlinedocs/gcc/IA-64-Options.html
66 # http://gcc.gnu.org/onlinedocs/gcc/RS-6000-and-PowerPC-Options.html
67 # http://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html
68 # http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86-64-Options.html
70 . if ${MACHINE_ARCH} == "i386"
71 . if ${CPUTYPE} == "crusoe"
72 _CPUCFLAGS = -march=i686 -falign-functions=0 -falign-jumps=0 -falign-loops=0
73 . elif ${CPUTYPE} == "k5"
74 _CPUCFLAGS = -march=pentium
76 _CPUCFLAGS = -march=${CPUTYPE}
77 . endif # GCC on 'i386'
78 . if ${CPUTYPE} == "crusoe"
79 _ICC_CPUCFLAGS = -tpp6 -xiM
80 . elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || \
81 ${CPUTYPE} == "athlon-4"
82 _ICC_CPUCFLAGS = -tpp6 -xiMK
83 . elif ${CPUTYPE} == "athlon-tbird" || ${CPUTYPE} == "athlon"
84 _ICC_CPUCFLAGS = -tpp6 -xiM
85 . elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" || ${CPUTYPE} == "k6"
86 _ICC_CPUCFLAGS = -tpp6 -xi
87 . elif ${CPUTYPE} == "k5"
88 _ICC_CPUCFLAGS = -tpp5
89 . elif ${CPUTYPE} == "pentium4" || ${CPUTYPE} == "pentium4m"
90 _ICC_CPUCFLAGS = -tpp7 -xiMKW
91 . elif ${CPUTYPE} == "pentium3" || ${CPUTYPE} == "pentium3m" || \
92 ${CPUTYPE} == "pentium-m"
93 _ICC_CPUCFLAGS = -tpp6 -xiMK
94 . elif ${CPUTYPE} == "pentium2" || ${CPUTYPE} == "pentiumpro"
95 _ICC_CPUCFLAGS = -tpp6 -xiM
96 . elif ${CPUTYPE} == "pentium-mmx"
97 _ICC_CPUCFLAGS = -tpp5 -xM
98 . elif ${CPUTYPE} == "pentium"
99 _ICC_CPUCFLAGS = -tpp5
102 . endif # ICC on 'i386'
103 . elif ${MACHINE_ARCH} == "alpha"
104 _CPUCFLAGS = -mcpu=${CPUTYPE}
105 . elif ${MACHINE_ARCH} == "amd64"
106 _CPUCFLAGS = -march=${CPUTYPE}
107 . elif ${MACHINE_ARCH} == "arm"
108 . if ${CPUTYPE} == "xscale"
109 #XXX: gcc doesn't seem to like -mcpu=xscale, and dies while rebuilding itself
110 #_CPUCFLAGS = -mcpu=xscale
111 _CPUCFLAGS = -march=armv5te -D__XSCALE__
113 _CPUCFLAGS = -mcpu=${CPUTYPE}
117 # Set up the list of CPU features based on the CPU type. This is an
118 # unordered list to make it easy for client makefiles to test for the
119 # presence of a CPU feature.
121 . if ${MACHINE_ARCH} == "i386"
122 . if ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64"
123 MACHINE_CPU = athlon-xp athlon k7 3dnow sse2 sse mmx k6 k5 i586 i486 i386
124 . elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || \
125 ${CPUTYPE} == "athlon-4"
126 MACHINE_CPU = athlon-xp athlon k7 3dnow sse mmx k6 k5 i586 i486 i386
127 . elif ${CPUTYPE} == "athlon" || ${CPUTYPE} == "athlon-tbird"
128 MACHINE_CPU = athlon k7 3dnow mmx k6 k5 i586 i486 i386
129 . elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2"
130 MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386
131 . elif ${CPUTYPE} == "k6"
132 MACHINE_CPU = mmx k6 k5 i586 i486 i386
133 . elif ${CPUTYPE} == "k5"
134 MACHINE_CPU = k5 i586 i486 i386
135 . elif ${CPUTYPE} == "pentium4" || ${CPUTYPE} == "pentium4m" || ${CPUTYPE} == "pentium-m"
136 MACHINE_CPU = sse2 sse i686 mmx i586 i486 i386
137 . elif ${CPUTYPE} == "pentium3" || ${CPUTYPE} == "pentium3m"
138 MACHINE_CPU = sse i686 mmx i586 i486 i386
139 . elif ${CPUTYPE} == "pentium2"
140 MACHINE_CPU = i686 mmx i586 i486 i386
141 . elif ${CPUTYPE} == "pentiumpro"
142 MACHINE_CPU = i686 i586 i486 i386
143 . elif ${CPUTYPE} == "pentium-mmx"
144 MACHINE_CPU = mmx i586 i486 i386
145 . elif ${CPUTYPE} == "pentium"
146 MACHINE_CPU = i586 i486 i386
147 . elif ${CPUTYPE} == "i486"
148 MACHINE_CPU = i486 i386
149 . elif ${CPUTYPE} == "i386"
152 . elif ${MACHINE_ARCH} == "alpha"
153 . if ${CPUTYPE} == "ev67"
154 MACHINE_CPU = ev67 ev6 ev56 pca56 ev5 ev45 ev4
155 . elif ${CPUTYPE} == "ev6"
156 MACHINE_CPU = ev6 ev56 pca56 ev5 ev45 ev4
157 . elif ${CPUTYPE} == "pca56"
158 MACHINE_CPU = pca56 ev56 ev5 ev45 ev4
159 . elif ${CPUTYPE} == "ev56"
160 MACHINE_CPU = ev56 ev5 ev45 ev4
161 . elif ${CPUTYPE} == "ev5"
162 MACHINE_CPU = ev5 ev45 ev4
163 . elif ${CPUTYPE} == "ev45"
164 MACHINE_CPU = ev45 ev4
165 . elif ${CPUTYPE} == "ev4"
168 . elif ${MACHINE_ARCH} == "amd64"
169 . if ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || ${CPUTYPE} == "k8"
170 MACHINE_CPU = k8 3dnow
171 . elif ${CPUTYPE} == "nocona"
174 MACHINE_CPU += amd64 sse2 sse mmx
175 . elif ${MACHINE_ARCH} == "ia64"
176 . if ${CPUTYPE} == "itanium"
177 MACHINE_CPU = itanium
182 .if ${MACHINE_ARCH} == "alpha"
186 # NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk
188 .if !defined(NO_CPU_CFLAGS)
190 CFLAGS += ${_ICC_CPUCFLAGS}
192 CFLAGS += ${_CPUCFLAGS}