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} == "amd64"
12 MACHINE_CPU = amd64 sse2 sse
13 . elif ${MACHINE_ARCH} == "ia64"
15 . elif ${MACHINE_ARCH} == "sparc64"
16 . elif ${MACHINE_ARCH} == "arm"
21 # Handle aliases (not documented in make.conf to avoid user confusion
22 # between e.g. i586 and pentium)
24 . if ${MACHINE_ARCH} == "i386"
25 . if ${CPUTYPE} == "nocona"
27 . elif ${CPUTYPE} == "core" || ${CPUTYPE} == "core2"
29 . elif ${CPUTYPE} == "p4"
31 . elif ${CPUTYPE} == "p4m"
33 . elif ${CPUTYPE} == "p3"
35 . elif ${CPUTYPE} == "p3m"
37 . elif ${CPUTYPE} == "p-m"
39 . elif ${CPUTYPE} == "p2"
41 . elif ${CPUTYPE} == "i686"
43 . elif ${CPUTYPE} == "i586/mmx"
45 . elif ${CPUTYPE} == "i586"
47 . elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || \
50 . elif ${CPUTYPE} == "k7"
53 . elif ${MACHINE_ARCH} == "amd64"
54 . if ${CPUTYPE} == "prescott" || ${CPUTYPE} == "core2"
59 ###############################################################################
60 # Logic to set up correct gcc optimization flag. This must be included
61 # after /etc/make.conf so it can react to the local value of CPUTYPE
62 # defined therein. Consult:
63 # http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html
64 # http://gcc.gnu.org/onlinedocs/gcc/IA_002d64-Options.html
65 # http://gcc.gnu.org/onlinedocs/gcc/RS_002f6000-and-PowerPC-Options.html
66 # http://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html
67 # http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html
69 . if ${MACHINE_ARCH} == "i386"
70 . if ${CPUTYPE} == "crusoe"
71 _CPUCFLAGS = -march=i686 -falign-functions=0 -falign-jumps=0 -falign-loops=0
72 . elif ${CPUTYPE} == "k5"
73 _CPUCFLAGS = -march=pentium
75 _CPUCFLAGS = -march=${CPUTYPE}
76 . endif # GCC on 'i386'
77 . if ${CPUTYPE} == "crusoe"
78 _ICC_CPUCFLAGS = -tpp6 -xiM
79 . elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || \
80 ${CPUTYPE} == "athlon-4"
81 _ICC_CPUCFLAGS = -tpp6 -xiMK
82 . elif ${CPUTYPE} == "athlon-tbird" || ${CPUTYPE} == "athlon"
83 _ICC_CPUCFLAGS = -tpp6 -xiM
84 . elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" || ${CPUTYPE} == "k6"
85 _ICC_CPUCFLAGS = -tpp6 -xi
86 . elif ${CPUTYPE} == "k5"
87 _ICC_CPUCFLAGS = -tpp5
88 . elif ${CPUTYPE} == "pentium4" || ${CPUTYPE} == "pentium4m"
89 _ICC_CPUCFLAGS = -tpp7 -xiMKW
90 . elif ${CPUTYPE} == "pentium3" || ${CPUTYPE} == "pentium3m" || \
91 ${CPUTYPE} == "pentium-m"
92 _ICC_CPUCFLAGS = -tpp6 -xiMK
93 . elif ${CPUTYPE} == "pentium2" || ${CPUTYPE} == "pentiumpro"
94 _ICC_CPUCFLAGS = -tpp6 -xiM
95 . elif ${CPUTYPE} == "pentium-mmx"
96 _ICC_CPUCFLAGS = -tpp5 -xM
97 . elif ${CPUTYPE} == "pentium"
98 _ICC_CPUCFLAGS = -tpp5
101 . endif # ICC on 'i386'
102 . elif ${MACHINE_ARCH} == "amd64"
103 _CPUCFLAGS = -march=${CPUTYPE}
104 . elif ${MACHINE_ARCH} == "arm"
105 . if ${CPUTYPE} == "xscale"
106 #XXX: gcc doesn't seem to like -mcpu=xscale, and dies while rebuilding itself
107 #_CPUCFLAGS = -mcpu=xscale
108 _CPUCFLAGS = -march=armv5te -D__XSCALE__
110 _CPUCFLAGS = -mcpu=${CPUTYPE}
112 . elif ${MACHINE_ARCH} == "powerpc"
113 _CPUCFLAGS = -mcpu=${CPUTYPE}
116 # Set up the list of CPU features based on the CPU type. This is an
117 # unordered list to make it easy for client makefiles to test for the
118 # presence of a CPU feature.
120 . if ${MACHINE_ARCH} == "i386"
121 . if ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64"
122 MACHINE_CPU = athlon-xp athlon k7 3dnow sse2 sse mmx k6 k5 i586 i486 i386
123 . elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || \
124 ${CPUTYPE} == "athlon-4"
125 MACHINE_CPU = athlon-xp athlon k7 3dnow sse mmx k6 k5 i586 i486 i386
126 . elif ${CPUTYPE} == "athlon" || ${CPUTYPE} == "athlon-tbird"
127 MACHINE_CPU = athlon k7 3dnow mmx k6 k5 i586 i486 i386
128 . elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2"
129 MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386
130 . elif ${CPUTYPE} == "k6"
131 MACHINE_CPU = mmx k6 k5 i586 i486 i386
132 . elif ${CPUTYPE} == "k5"
133 MACHINE_CPU = k5 i586 i486 i386
134 . elif ${CPUTYPE} == "c3"
135 MACHINE_CPU = 3dnow mmx i586 i486 i386
136 . elif ${CPUTYPE} == "c3-2"
137 MACHINE_CPU = sse mmx i586 i486 i386
138 . elif ${CPUTYPE} == "c7"
139 MACHINE_CPU = sse3 sse2 sse i686 mmx i586 i486 i386
140 . elif ${CPUTYPE} == "prescott"
141 MACHINE_CPU = sse3 sse2 sse i686 mmx i586 i486 i386
142 . elif ${CPUTYPE} == "pentium4" || ${CPUTYPE} == "pentium4m" || ${CPUTYPE} == "pentium-m"
143 MACHINE_CPU = sse2 sse i686 mmx i586 i486 i386
144 . elif ${CPUTYPE} == "pentium3" || ${CPUTYPE} == "pentium3m"
145 MACHINE_CPU = sse i686 mmx i586 i486 i386
146 . elif ${CPUTYPE} == "pentium2"
147 MACHINE_CPU = i686 mmx i586 i486 i386
148 . elif ${CPUTYPE} == "pentiumpro"
149 MACHINE_CPU = i686 i586 i486 i386
150 . elif ${CPUTYPE} == "pentium-mmx"
151 MACHINE_CPU = mmx i586 i486 i386
152 . elif ${CPUTYPE} == "pentium"
153 MACHINE_CPU = i586 i486 i386
154 . elif ${CPUTYPE} == "i486"
155 MACHINE_CPU = i486 i386
156 . elif ${CPUTYPE} == "i386"
159 . elif ${MACHINE_ARCH} == "amd64"
160 . if ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || ${CPUTYPE} == "k8"
161 MACHINE_CPU = k8 3dnow
162 . elif ${CPUTYPE} == "nocona"
165 MACHINE_CPU += amd64 sse2 sse mmx
166 . elif ${MACHINE_ARCH} == "ia64"
167 . if ${CPUTYPE} == "itanium"
168 MACHINE_CPU = itanium
173 .if ${MACHINE_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN)
174 CFLAGS += -mbig-endian
175 LDFLAGS += -mbig-endian
179 # NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk
181 .if !defined(NO_CPU_CFLAGS)
183 CFLAGS += ${_ICC_CPUCFLAGS}
185 CFLAGS += ${_CPUCFLAGS}