Merge branch 'vendor/AWK'
[dragonfly.git] / share / mk / bsd.cpu.gcc44.mk
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) || ${CPUTYPE} == "native"
6
7 . if defined(CPUTYPE) && !empty(CPUTYPE) && ${CPUTYPE} == "native"
8 _CPUCFLAGS = -march=native
9 . else
10 _CPUCFLAGS =
11 . endif
12
13 . if ${MACHINE_ARCH} == "i386"
14 MACHINE_CPU = i486 i386
15 . elif ${MACHINE_ARCH} == "x86_64"
16 MACHINE_CPU = x86_64 sse2 sse mmx
17 . endif
18
19 .else
20
21 _CPUCFLAGS_FIXUP =
22
23 # Old CPUTYPE compat shim
24 . if ${MACHINE_ARCH} == "i386"
25 .  if ${CPUTYPE} == "core"
26 CPUTYPE = nocona
27 .  elif ${CPUTYPE} == "p4"
28 CPUTYPE = pentium4
29 .  elif ${CPUTYPE} == "p4m"
30 CPUTYPE = pentium4m
31 .  elif ${CPUTYPE} == "p3"
32 CPUTYPE = pentium3
33 .  elif ${CPUTYPE} == "p3m"
34 CPUTYPE = pentium3m
35 .  elif ${CPUTYPE} == "p-m"
36 CPUTYPE = pentium-m
37 .  elif ${CPUTYPE} == "p2"
38 CPUTYPE = pentium2
39 .  elif ${CPUTYPE} == "i586/mmx"
40 CPUTYPE = pentium-mmx
41 .  elif ${CPUTYPE} == "k5"
42 CPUTYPE = pentium
43 .  elif ${CPUTYPE} == "k7"
44 CPUTYPE = athlon
45 .  elif ${CPUTYPE} == "crusoe"
46 CPUTYPE = pentiumpro
47 _CPUCFLAGS_FIXUP = -falign-functions=0 -falign-jumps=0 -falign-loops=0
48 .  endif
49 . elif ${MACHINE_ARCH} == "x86_64"
50 .  if ${CPUTYPE} == "prescott"
51 CPUTYPE = nocona
52 .  endif
53 . endif
54
55 # CPUTYPE alias
56 . if ${CPUTYPE} == "i586"
57 CPUTYPE = pentium
58 . elif ${CPUTYPE} == "i686"
59 CPUTYPE = pentiumpro
60 . elif ${CPUTYPE} == "pentium3m"
61 CPUTYPE = pentium3
62 . elif ${CPUTYPE} == "pentium4m"
63 CPUTYPE = pentium4
64 . elif ${CPUTYPE} == "k6-2"
65 CPUTYPE = k6-3
66 . elif ${CPUTYPE} == "athlon-tbird"
67 CPUTYPE = athlon
68 . elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-4"
69 CPUTYPE = athlon-xp
70 . elif ${CPUTYPE} == "k8" || ${CPUTYPE} == "opteron" || \
71        ${CPUTYPE} == "athlon-fx"
72 CPUTYPE = athlon64
73 . elif ${CPUTYPE} == "k8-sse3" || ${CPUTYPE} == "opteron-sse3"
74 CPUTYPE = athlon64-sse3
75 . elif ${CPUTYPE} == "amdfam10"
76 CPUTYPE = barcelona
77 . endif
78
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
84
85 _CPUCFLAGS = -march=${CPUTYPE} ${_CPUCFLAGS_FIXUP}
86
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.
90
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 \
94               i586 i486 i386
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} == "winchip2"
112 MACHINE_CPU = 3dnow mmx i486 i386
113 .  elif ${CPUTYPE} == "winchip-c6"
114 MACHINE_CPU = mmx i486 i386
115 .  elif ${CPUTYPE} == "core2"
116 MACHINE_CPU = ssse3 sse3 sse2 sse i686 mmx i586 i486 i386
117 .  elif ${CPUTYPE} == "prescott" || ${CPUTYPE} == "nocona"
118 MACHINE_CPU = sse3 sse2 sse i686 mmx i586 i486 i386
119 .  elif ${CPUTYPE} == "pentium4" || ${CPUTYPE} == "pentium-m"
120 MACHINE_CPU = sse2 sse i686 mmx i586 i486 i386
121 .  elif ${CPUTYPE} == "pentium3"
122 MACHINE_CPU = sse i686 mmx i586 i486 i386
123 .  elif ${CPUTYPE} == "pentium2"
124 MACHINE_CPU = i686 mmx i586 i486 i386
125 .  elif ${CPUTYPE} == "pentiumpro"
126 MACHINE_CPU = i686 i586 i486 i386
127 .  elif ${CPUTYPE} == "pentium-mmx"
128 MACHINE_CPU = mmx i586 i486 i386
129 .  elif ${CPUTYPE} == "pentium"
130 MACHINE_CPU = i586 i486 i386
131 .  elif ${CPUTYPE} == "i486"
132 MACHINE_CPU = i486 i386
133 .  elif ${CPUTYPE} == "i386"
134 MACHINE_CPU = i386
135 .  endif
136 . elif ${MACHINE_ARCH} == "x86_64"
137 .  if ${CPUTYPE} == "barcelona"
138 MACHINE_CPU = k8 3dnow abm sse4a sse3
139 .  elif ${CPUTYPE} == "athlon64-sse3"
140 MACHINE_CPU = k8 3dnow sse3
141 .  elif ${CPUTYPE} == "athlon64"
142 MACHINE_CPU = k8 3dnow
143 .  elif ${CPUTYPE} == "core2"
144 MACHINE_CPU = ssse3 sse3
145 .  elif ${CPUTYPE} == "nocona"
146 MACHINE_CPU = sse3
147 .  endif
148 MACHINE_CPU += x86_64 sse2 sse mmx
149 . endif
150
151 .endif