CPUTYPE: Add support for Via C7 and AMD Geode (gcc44)
[dragonfly.git] / share / mk / bsd.cpu.gcc44.mk
CommitLineData
cdefb602
SS
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
b7648db0
SZ
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
cdefb602 13. if ${MACHINE_ARCH} == "i386"
b7648db0 14MACHINE_CPU = i486 i386
b2b3ffcd 15. elif ${MACHINE_ARCH} == "x86_64"
b7648db0 16MACHINE_CPU = x86_64 sse2 sse mmx
cdefb602 17. endif
cdefb602 18
b7648db0 19.else
cdefb602 20
b7648db0
SZ
21_CPUCFLAGS_FIXUP =
22
23# Old CPUTYPE compat shim
24. if ${MACHINE_ARCH} == "i386"
25. if ${CPUTYPE} == "core"
cdefb602 26CPUTYPE = nocona
b7648db0 27. elif ${CPUTYPE} == "p4"
cdefb602 28CPUTYPE = pentium4
b7648db0 29. elif ${CPUTYPE} == "p4m"
cdefb602 30CPUTYPE = pentium4m
b7648db0 31. elif ${CPUTYPE} == "p3"
cdefb602 32CPUTYPE = pentium3
b7648db0 33. elif ${CPUTYPE} == "p3m"
cdefb602 34CPUTYPE = pentium3m
b7648db0 35. elif ${CPUTYPE} == "p-m"
cdefb602 36CPUTYPE = pentium-m
b7648db0 37. elif ${CPUTYPE} == "p2"
cdefb602 38CPUTYPE = pentium2
b7648db0 39. elif ${CPUTYPE} == "i586/mmx"
cdefb602 40CPUTYPE = pentium-mmx
b7648db0 41. elif ${CPUTYPE} == "k5"
cdefb602 42CPUTYPE = pentium
b7648db0 43. elif ${CPUTYPE} == "k7"
cdefb602 44CPUTYPE = athlon
b7648db0
SZ
45. elif ${CPUTYPE} == "crusoe"
46CPUTYPE = 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"
51CPUTYPE = nocona
52. endif
53. endif
54
55# CPUTYPE alias
56. if ${CPUTYPE} == "i586"
57CPUTYPE = pentium
58. elif ${CPUTYPE} == "i686"
59CPUTYPE = pentiumpro
60. elif ${CPUTYPE} == "pentium3m"
61CPUTYPE = pentium3
62. elif ${CPUTYPE} == "pentium4m"
63CPUTYPE = pentium4
64. elif ${CPUTYPE} == "k6-2"
65CPUTYPE = k6-3
66. elif ${CPUTYPE} == "athlon-tbird"
67CPUTYPE = athlon
68. elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-4"
69CPUTYPE = athlon-xp
70. elif ${CPUTYPE} == "k8" || ${CPUTYPE} == "opteron" || \
71 ${CPUTYPE} == "athlon-fx"
72CPUTYPE = athlon64
73. elif ${CPUTYPE} == "k8-sse3" || ${CPUTYPE} == "opteron-sse3"
74CPUTYPE = athlon64-sse3
75. elif ${CPUTYPE} == "amdfam10"
76CPUTYPE = barcelona
77. endif
cdefb602
SS
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:
cdefb602
SS
83# http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86-64-Options.html
84
b7648db0 85_CPUCFLAGS = -march=${CPUTYPE} ${_CPUCFLAGS_FIXUP}
cdefb602
SS
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
b7648db0
SZ
91. if ${MACHINE_ARCH} == "i386"
92. if ${CPUTYPE} == "barcelona"
93MACHINE_CPU = athlon-xp athlon k7 3dnow abm sse4a sse3 sse2 sse mmx k6 k5 \
94 i586 i486 i386
95. elif ${CPUTYPE} == "athlon64-sse3"
cdefb602 96MACHINE_CPU = athlon-xp athlon k7 3dnow sse3 sse2 sse mmx k6 k5 i586 i486 i386
b7648db0 97. elif ${CPUTYPE} == "athlon64"
cdefb602 98MACHINE_CPU = athlon-xp athlon k7 3dnow sse2 sse mmx k6 k5 i586 i486 i386
b7648db0 99. elif ${CPUTYPE} == "athlon-xp"
cdefb602 100MACHINE_CPU = athlon-xp athlon k7 3dnow sse mmx k6 k5 i586 i486 i386
b7648db0 101. elif ${CPUTYPE} == "athlon"
cdefb602 102MACHINE_CPU = athlon k7 3dnow mmx k6 k5 i586 i486 i386
90c721f7 103. elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "geode"
cdefb602 104MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386
b7648db0 105. elif ${CPUTYPE} == "k6"
cdefb602 106MACHINE_CPU = mmx k6 k5 i586 i486 i386
b7648db0 107. elif ${CPUTYPE} == "c3"
cdefb602 108MACHINE_CPU = 3dnow mmx i586 i486 i386
b7648db0 109. elif ${CPUTYPE} == "c3-2"
cdefb602 110MACHINE_CPU = sse mmx i586 i486 i386
90c721f7
JM
111. elif ${CPUTYPE} == "c7"
112MACHINE_CPU = sse3 sse2 sse i686 mmx i586 i486 i386
b7648db0
SZ
113. elif ${CPUTYPE} == "winchip2"
114MACHINE_CPU = 3dnow mmx i486 i386
115. elif ${CPUTYPE} == "winchip-c6"
116MACHINE_CPU = mmx i486 i386
117. elif ${CPUTYPE} == "core2"
cdefb602 118MACHINE_CPU = ssse3 sse3 sse2 sse i686 mmx i586 i486 i386
b7648db0 119. elif ${CPUTYPE} == "prescott" || ${CPUTYPE} == "nocona"
cdefb602 120MACHINE_CPU = sse3 sse2 sse i686 mmx i586 i486 i386
b7648db0 121. elif ${CPUTYPE} == "pentium4" || ${CPUTYPE} == "pentium-m"
cdefb602 122MACHINE_CPU = sse2 sse i686 mmx i586 i486 i386
b7648db0 123. elif ${CPUTYPE} == "pentium3"
cdefb602 124MACHINE_CPU = sse i686 mmx i586 i486 i386
b7648db0 125. elif ${CPUTYPE} == "pentium2"
cdefb602 126MACHINE_CPU = i686 mmx i586 i486 i386
b7648db0 127. elif ${CPUTYPE} == "pentiumpro"
cdefb602 128MACHINE_CPU = i686 i586 i486 i386
b7648db0 129. elif ${CPUTYPE} == "pentium-mmx"
cdefb602 130MACHINE_CPU = mmx i586 i486 i386
b7648db0 131. elif ${CPUTYPE} == "pentium"
cdefb602 132MACHINE_CPU = i586 i486 i386
b7648db0 133. elif ${CPUTYPE} == "i486"
cdefb602 134MACHINE_CPU = i486 i386
b7648db0 135. elif ${CPUTYPE} == "i386"
cdefb602 136MACHINE_CPU = i386
b7648db0
SZ
137. endif
138. elif ${MACHINE_ARCH} == "x86_64"
139. if ${CPUTYPE} == "barcelona"
140MACHINE_CPU = k8 3dnow abm sse4a sse3
141. elif ${CPUTYPE} == "athlon64-sse3"
cdefb602 142MACHINE_CPU = k8 3dnow sse3
b7648db0 143. elif ${CPUTYPE} == "athlon64"
cdefb602 144MACHINE_CPU = k8 3dnow
b7648db0 145. elif ${CPUTYPE} == "core2"
cdefb602 146MACHINE_CPU = ssse3 sse3
b7648db0
SZ
147. elif ${CPUTYPE} == "nocona"
148MACHINE_CPU = sse3
149. endif
b2b3ffcd 150MACHINE_CPU += x86_64 sse2 sse mmx
b7648db0
SZ
151. endif
152
cdefb602 153.endif