Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
|
2002-07-27 22:04:05 +00:00
|
|
|
# Set default CPU compile flags and baseline CPUTYPE for each arch. The
|
|
|
|
# compile flags must support the minimum CPU type for each architecture but
|
|
|
|
# may tune support for more advanced processors.
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
|
2002-08-02 18:04:22 +00:00
|
|
|
.if !defined(CPUTYPE) || empty(CPUTYPE)
|
2004-01-30 19:51:26 +00:00
|
|
|
_CPUCFLAGS =
|
2015-07-02 13:42:57 +00:00
|
|
|
. if ${MACHINE_CPUARCH} == "aarch64"
|
|
|
|
MACHINE_CPU = arm64
|
|
|
|
. elif ${MACHINE_CPUARCH} == "amd64"
|
2010-04-21 01:13:08 +00:00
|
|
|
MACHINE_CPU = amd64 sse2 sse mmx
|
2010-09-13 07:22:14 +00:00
|
|
|
. elif ${MACHINE_CPUARCH} == "arm"
|
2004-05-14 13:34:15 +00:00
|
|
|
MACHINE_CPU = arm
|
2015-06-25 16:47:11 +00:00
|
|
|
. elif ${MACHINE_CPUARCH} == "i386"
|
|
|
|
MACHINE_CPU = i486
|
2010-09-13 07:22:14 +00:00
|
|
|
. elif ${MACHINE_CPUARCH} == "mips"
|
2008-03-19 12:20:44 +00:00
|
|
|
MACHINE_CPU = mips
|
2015-06-25 16:47:11 +00:00
|
|
|
. elif ${MACHINE_CPUARCH} == "powerpc"
|
|
|
|
MACHINE_CPU = aim
|
2015-12-11 22:55:23 +00:00
|
|
|
. elif ${MACHINE_CPUARCH} == "riscv"
|
|
|
|
MACHINE_CPU = riscv
|
2015-06-25 16:47:11 +00:00
|
|
|
. elif ${MACHINE_CPUARCH} == "sparc64"
|
|
|
|
MACHINE_CPU = ultrasparc
|
2002-07-27 22:15:42 +00:00
|
|
|
. endif
|
2002-07-27 22:04:05 +00:00
|
|
|
.else
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
|
|
|
|
# Handle aliases (not documented in make.conf to avoid user confusion
|
|
|
|
# between e.g. i586 and pentium)
|
|
|
|
|
2015-03-17 05:48:45 +00:00
|
|
|
. if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
|
Tidy up bsd.cpu.mk for X86 CPUs:
- Do not limit recent processors to "prescott" class for i386 target. There
is no reason for this hack because clang is default now. On top of that, it
will only grow indefinitely over time.
- Add more CPUTYPEs, i.e., "athlon-fx", "core-avx2", "atom", "penryn", and
"yonah". Note "penryn" and "yonah" are intentionally undocumented because
they are not supported by gcc and marked deprecated by clang.
- Add more CPUTYPE aliases, i.e., "barcelona" (-> amdfam10), "westmere" and
"nehalem" (-> corei7). Note these are intentionally undocumented because
they are not supported by (base) gcc and/or clang. However, LLVM (backend)
seems to "know" the differences. Most likely, they were deprecated with
other vendor code names and clang did not bother implementing them at all.
- Add i686 to MACHINE_CPU for "c3-2" (VIA Nehemiah). Both gcc & clang treat
it like an i686-class processor.
- Add IDT "winchip2" and "winchip-c6" for completeness (undocumented).
- Order processors per make.conf example, i.e., CPU vendors and models.
- Tidy up make.conf example, i.e., remove "by gcc" (because we have aliases)
and remove "prescott" from AMD64 architecture (because it is not correct).
2012-12-04 00:37:17 +00:00
|
|
|
. if ${CPUTYPE} == "barcelona"
|
|
|
|
CPUTYPE = amdfam10
|
2015-03-17 05:48:45 +00:00
|
|
|
. elif ${CPUTYPE} == "core-avx2"
|
|
|
|
CPUTYPE = haswell
|
|
|
|
. elif ${CPUTYPE} == "core-avx-i"
|
|
|
|
CPUTYPE = ivybridge
|
|
|
|
. elif ${CPUTYPE} == "corei7-avx"
|
|
|
|
CPUTYPE = sandybridge
|
|
|
|
. elif ${CPUTYPE} == "corei7"
|
|
|
|
CPUTYPE = nehalem
|
|
|
|
. elif ${CPUTYPE} == "slm"
|
|
|
|
CPUTYPE = silvermont
|
|
|
|
. elif ${CPUTYPE} == "atom"
|
|
|
|
CPUTYPE = bonnell
|
Tidy up bsd.cpu.mk for X86 CPUs:
- Do not limit recent processors to "prescott" class for i386 target. There
is no reason for this hack because clang is default now. On top of that, it
will only grow indefinitely over time.
- Add more CPUTYPEs, i.e., "athlon-fx", "core-avx2", "atom", "penryn", and
"yonah". Note "penryn" and "yonah" are intentionally undocumented because
they are not supported by gcc and marked deprecated by clang.
- Add more CPUTYPE aliases, i.e., "barcelona" (-> amdfam10), "westmere" and
"nehalem" (-> corei7). Note these are intentionally undocumented because
they are not supported by (base) gcc and/or clang. However, LLVM (backend)
seems to "know" the differences. Most likely, they were deprecated with
other vendor code names and clang did not bother implementing them at all.
- Add i686 to MACHINE_CPU for "c3-2" (VIA Nehemiah). Both gcc & clang treat
it like an i686-class processor.
- Add IDT "winchip2" and "winchip-c6" for completeness (undocumented).
- Order processors per make.conf example, i.e., CPU vendors and models.
- Tidy up make.conf example, i.e., remove "by gcc" (because we have aliases)
and remove "prescott" from AMD64 architecture (because it is not correct).
2012-12-04 00:37:17 +00:00
|
|
|
. elif ${CPUTYPE} == "core"
|
2007-01-17 14:49:13 +00:00
|
|
|
CPUTYPE = prescott
|
2015-03-17 05:48:45 +00:00
|
|
|
. endif
|
|
|
|
. if ${MACHINE_CPUARCH} == "amd64"
|
|
|
|
. if ${CPUTYPE} == "prescott"
|
|
|
|
CPUTYPE = nocona
|
|
|
|
. endif
|
|
|
|
. else
|
|
|
|
. if ${CPUTYPE} == "k7"
|
|
|
|
CPUTYPE = athlon
|
|
|
|
. elif ${CPUTYPE} == "p4"
|
2004-10-17 05:08:29 +00:00
|
|
|
CPUTYPE = pentium4
|
2015-03-17 05:48:45 +00:00
|
|
|
. elif ${CPUTYPE} == "p4m"
|
2004-10-17 05:08:29 +00:00
|
|
|
CPUTYPE = pentium4m
|
2015-03-17 05:48:45 +00:00
|
|
|
. elif ${CPUTYPE} == "p3"
|
2004-10-17 05:08:29 +00:00
|
|
|
CPUTYPE = pentium3
|
2015-03-17 05:48:45 +00:00
|
|
|
. elif ${CPUTYPE} == "p3m"
|
2004-10-17 05:08:29 +00:00
|
|
|
CPUTYPE = pentium3m
|
2015-03-17 05:48:45 +00:00
|
|
|
. elif ${CPUTYPE} == "p-m"
|
2004-10-17 05:08:29 +00:00
|
|
|
CPUTYPE = pentium-m
|
2015-03-17 05:48:45 +00:00
|
|
|
. elif ${CPUTYPE} == "p2"
|
2004-10-17 05:08:29 +00:00
|
|
|
CPUTYPE = pentium2
|
2015-03-17 05:48:45 +00:00
|
|
|
. elif ${CPUTYPE} == "i686"
|
2004-10-17 05:08:29 +00:00
|
|
|
CPUTYPE = pentiumpro
|
2015-03-17 05:48:45 +00:00
|
|
|
. elif ${CPUTYPE} == "i586/mmx"
|
2004-10-17 05:08:29 +00:00
|
|
|
CPUTYPE = pentium-mmx
|
2015-03-17 05:48:45 +00:00
|
|
|
. elif ${CPUTYPE} == "i586"
|
2004-10-17 05:08:29 +00:00
|
|
|
CPUTYPE = pentium
|
2015-03-17 05:48:45 +00:00
|
|
|
. endif
|
2004-10-17 05:19:45 +00:00
|
|
|
. endif
|
2010-12-30 15:58:23 +00:00
|
|
|
. elif ${MACHINE_ARCH} == "sparc64"
|
|
|
|
. if ${CPUTYPE} == "us"
|
|
|
|
CPUTYPE = ultrasparc
|
|
|
|
. elif ${CPUTYPE} == "us3"
|
|
|
|
CPUTYPE = ultrasparc3
|
|
|
|
. endif
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
. endif
|
|
|
|
|
2004-10-17 05:08:29 +00:00
|
|
|
###############################################################################
|
2002-05-11 20:18:54 +00:00
|
|
|
# Logic to set up correct gcc optimization flag. This must be included
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
# after /etc/make.conf so it can react to the local value of CPUTYPE
|
2002-05-11 20:18:54 +00:00
|
|
|
# defined therein. Consult:
|
2006-07-20 22:42:48 +00:00
|
|
|
# http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html
|
2015-11-14 06:18:50 +00:00
|
|
|
# http://gcc.gnu.org/onlinedocs/gcc/RS-6000-and-PowerPC-Options.html
|
2008-03-19 12:20:44 +00:00
|
|
|
# http://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html
|
2004-03-21 04:57:24 +00:00
|
|
|
# http://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html
|
2008-06-25 06:07:03 +00:00
|
|
|
# http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
|
2010-09-13 07:22:14 +00:00
|
|
|
. if ${MACHINE_CPUARCH} == "i386"
|
2004-04-05 09:55:50 +00:00
|
|
|
. if ${CPUTYPE} == "crusoe"
|
|
|
|
_CPUCFLAGS = -march=i686 -falign-functions=0 -falign-jumps=0 -falign-loops=0
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "k5"
|
|
|
|
_CPUCFLAGS = -march=pentium
|
Tidy up bsd.cpu.mk for X86 CPUs:
- Do not limit recent processors to "prescott" class for i386 target. There
is no reason for this hack because clang is default now. On top of that, it
will only grow indefinitely over time.
- Add more CPUTYPEs, i.e., "athlon-fx", "core-avx2", "atom", "penryn", and
"yonah". Note "penryn" and "yonah" are intentionally undocumented because
they are not supported by gcc and marked deprecated by clang.
- Add more CPUTYPE aliases, i.e., "barcelona" (-> amdfam10), "westmere" and
"nehalem" (-> corei7). Note these are intentionally undocumented because
they are not supported by (base) gcc and/or clang. However, LLVM (backend)
seems to "know" the differences. Most likely, they were deprecated with
other vendor code names and clang did not bother implementing them at all.
- Add i686 to MACHINE_CPU for "c3-2" (VIA Nehemiah). Both gcc & clang treat
it like an i686-class processor.
- Add IDT "winchip2" and "winchip-c6" for completeness (undocumented).
- Order processors per make.conf example, i.e., CPU vendors and models.
- Tidy up make.conf example, i.e., remove "by gcc" (because we have aliases)
and remove "prescott" from AMD64 architecture (because it is not correct).
2012-12-04 00:37:17 +00:00
|
|
|
. elif ${CPUTYPE} == "c7"
|
|
|
|
_CPUCFLAGS = -march=c3-2
|
2004-10-17 05:08:29 +00:00
|
|
|
. else
|
|
|
|
_CPUCFLAGS = -march=${CPUTYPE}
|
Tidy up bsd.cpu.mk for X86 CPUs:
- Do not limit recent processors to "prescott" class for i386 target. There
is no reason for this hack because clang is default now. On top of that, it
will only grow indefinitely over time.
- Add more CPUTYPEs, i.e., "athlon-fx", "core-avx2", "atom", "penryn", and
"yonah". Note "penryn" and "yonah" are intentionally undocumented because
they are not supported by gcc and marked deprecated by clang.
- Add more CPUTYPE aliases, i.e., "barcelona" (-> amdfam10), "westmere" and
"nehalem" (-> corei7). Note these are intentionally undocumented because
they are not supported by (base) gcc and/or clang. However, LLVM (backend)
seems to "know" the differences. Most likely, they were deprecated with
other vendor code names and clang did not bother implementing them at all.
- Add i686 to MACHINE_CPU for "c3-2" (VIA Nehemiah). Both gcc & clang treat
it like an i686-class processor.
- Add IDT "winchip2" and "winchip-c6" for completeness (undocumented).
- Order processors per make.conf example, i.e., CPU vendors and models.
- Tidy up make.conf example, i.e., remove "by gcc" (because we have aliases)
and remove "prescott" from AMD64 architecture (because it is not correct).
2012-12-04 00:37:17 +00:00
|
|
|
. endif
|
2010-09-13 07:22:14 +00:00
|
|
|
. elif ${MACHINE_CPUARCH} == "amd64"
|
2004-10-17 05:19:45 +00:00
|
|
|
_CPUCFLAGS = -march=${CPUTYPE}
|
2010-09-13 07:22:14 +00:00
|
|
|
. elif ${MACHINE_CPUARCH} == "arm"
|
2018-07-27 21:25:01 +00:00
|
|
|
. if ${CPUTYPE} == "xscale"
|
|
|
|
#XXX: gcc doesn't seem to like -mcpu=xscale, and dies while rebuilding itself
|
|
|
|
#_CPUCFLAGS = -mcpu=xscale
|
|
|
|
_CPUCFLAGS = -march=armv5te -D__XSCALE__
|
|
|
|
. elif ${CPUTYPE:M*soft*} != ""
|
2016-03-28 17:32:31 +00:00
|
|
|
_CPUCFLAGS = -mfloat-abi=softfp
|
|
|
|
. elif ${CPUTYPE} == "cortexa"
|
2017-08-13 04:10:47 +00:00
|
|
|
_CPUCFLAGS = -march=armv7 -mfpu=vfp
|
2016-03-28 17:32:31 +00:00
|
|
|
. elif ${CPUTYPE:Marmv[4567]*} != ""
|
2015-12-11 05:39:45 +00:00
|
|
|
# Handle all the armvX types that FreeBSD runs:
|
|
|
|
# armv4, armv4t, armv5, armv5te, armv6, armv6t2, armv7, armv7-a, armv7ve
|
|
|
|
# they require -march=. All the others require -mcpu=.
|
|
|
|
_CPUCFLAGS = -march=${CPUTYPE}
|
2016-03-28 17:32:31 +00:00
|
|
|
. else
|
2015-11-19 17:06:12 +00:00
|
|
|
# Common values for FreeBSD
|
2016-05-01 16:29:02 +00:00
|
|
|
# arm: (any arm v4 or v5 processor you are targeting)
|
2015-11-19 17:06:12 +00:00
|
|
|
# arm920t, arm926ej-s, marvell-pj4, fa526, fa626,
|
|
|
|
# fa606te, fa626te, fa726te
|
2016-05-01 16:29:02 +00:00
|
|
|
# armv6: (any arm v7 or v8 processor you are targeting and the arm1176jzf-s)
|
2015-11-19 17:06:12 +00:00
|
|
|
# arm1176jzf-s, generic-armv7-a, cortex-a5, cortex-a7, cortex-a8,
|
|
|
|
# cortex-a9, cortex-a12, cortex-a15, cortex-a17, cortex-a53, cortex-a57,
|
|
|
|
# cortex-a72, exynos-m1
|
2013-01-07 23:41:14 +00:00
|
|
|
_CPUCFLAGS = -mcpu=${CPUTYPE}
|
2015-12-11 05:39:45 +00:00
|
|
|
. endif
|
2010-11-14 01:37:08 +00:00
|
|
|
. elif ${MACHINE_ARCH} == "powerpc"
|
2008-03-03 20:40:20 +00:00
|
|
|
. if ${CPUTYPE} == "e500"
|
|
|
|
_CPUCFLAGS = -Wa,-me500 -msoft-float
|
2009-02-22 18:45:30 +00:00
|
|
|
. else
|
2009-04-04 00:22:44 +00:00
|
|
|
_CPUCFLAGS = -mcpu=${CPUTYPE} -mno-powerpc64
|
2008-03-03 20:40:20 +00:00
|
|
|
. endif
|
Create a new MACHINE_ARCH for Freescale PowerPC e500v2
Summary:
The Freescale e500v2 PowerPC core does not use a standard FPU.
Instead, it uses a Signal Processing Engine (SPE)--a DSP-style vector processor
unit, which doubles as a FPU. The PowerPC SPE ABI is incompatible with the
stock powerpc ABI, so a new MACHINE_ARCH was created to deal with this.
Additionaly, the SPE opcodes overlap with Altivec, so these are mutually
exclusive. Taking advantage of this fact, a new file, powerpc/booke/spe.c, was
created with the same function set as in powerpc/powerpc/altivec.c, so it
becomes effectively a drop-in replacement. setjmp/longjmp were modified to save
the upper 32-bits of the now-64-bit GPRs (upper 32-bits are only accessible by
the SPE).
Note: This does _not_ support the SPE in the e500v1, as the e500v1 SPE does not
support double-precision floating point.
Also, without a new MACHINE_ARCH it would be impossible to provide binary
packages which utilize the SPE.
Additionally, no work has been done to support ports, work is needed for this.
This also means no newer gcc can yet be used. However, gcc's powerpc support
has been refactored which would make adding a powerpcspe-freebsd target very
easy.
Test Plan:
This was lightly tested on a RouterBoard RB800 and an AmigaOne A1222
(P1022-based) board, compiled against the new ABI. Base system utilities
(/bin/sh, /bin/ls, etc) still function appropriately, the system is able to boot
multiuser.
Reviewed By: bdrewery, imp
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D5683
2016-10-22 01:57:15 +00:00
|
|
|
. elif ${MACHINE_ARCH} == "powerpcspe"
|
|
|
|
_CPUCFLAGS = -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double
|
2010-07-10 02:32:50 +00:00
|
|
|
. elif ${MACHINE_ARCH} == "powerpc64"
|
|
|
|
_CPUCFLAGS = -mcpu=${CPUTYPE}
|
2010-09-13 07:22:14 +00:00
|
|
|
. elif ${MACHINE_CPUARCH} == "mips"
|
2015-11-19 03:11:20 +00:00
|
|
|
# mips[1234], mips32, mips64, and all later releases need to have mips
|
|
|
|
# preserved (releases later than r2 require external toolchain)
|
|
|
|
. if ${CPUTYPE:Mmips32*} != "" || ${CPUTYPE:Mmips64*} != "" || \
|
|
|
|
${CPUTYPE:Mmips[1234]} != ""
|
|
|
|
_CPUCFLAGS = -march=${CPUTYPE}
|
|
|
|
. else
|
|
|
|
# Default -march to the CPUTYPE passed in, with mips stripped off so we
|
|
|
|
# accept either mips4kc or 4kc, mostly for historical reasons
|
|
|
|
# Typical values for cores:
|
|
|
|
# 4kc, 24kc, 34kc, 74kc, 1004kc, octeon, octeon+, octeon2, octeon3,
|
|
|
|
# sb1, xlp, xlr
|
|
|
|
_CPUCFLAGS = -march=${CPUTYPE:S/^mips//}
|
2015-11-19 03:55:44 +00:00
|
|
|
. endif
|
2010-12-30 15:58:23 +00:00
|
|
|
. elif ${MACHINE_ARCH} == "sparc64"
|
|
|
|
. if ${CPUTYPE} == "v9"
|
|
|
|
_CPUCFLAGS = -mcpu=v9
|
|
|
|
. elif ${CPUTYPE} == "ultrasparc"
|
|
|
|
_CPUCFLAGS = -mcpu=ultrasparc
|
|
|
|
. elif ${CPUTYPE} == "ultrasparc3"
|
|
|
|
_CPUCFLAGS = -mcpu=ultrasparc3
|
|
|
|
. endif
|
2015-11-20 21:49:49 +00:00
|
|
|
. elif ${MACHINE_CPUARCH} == "aarch64"
|
|
|
|
_CPUCFLAGS = -mcpu=${CPUTYPE}
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
. endif
|
|
|
|
|
|
|
|
# Set up the list of CPU features based on the CPU type. This is an
|
|
|
|
# unordered list to make it easy for client makefiles to test for the
|
|
|
|
# presence of a CPU feature.
|
|
|
|
|
2015-08-25 17:11:49 +00:00
|
|
|
########## i386
|
2010-09-13 07:22:14 +00:00
|
|
|
. if ${MACHINE_CPUARCH} == "i386"
|
2017-03-07 19:00:27 +00:00
|
|
|
. if ${CPUTYPE} == "znver1"
|
|
|
|
MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586
|
|
|
|
. elif ${CPUTYPE} == "bdver4"
|
2015-03-17 05:48:45 +00:00
|
|
|
MACHINE_CPU = xop avx2 avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586
|
|
|
|
. elif ${CPUTYPE} == "bdver3" || ${CPUTYPE} == "bdver2" || \
|
2014-03-20 19:17:46 +00:00
|
|
|
${CPUTYPE} == "bdver1"
|
2012-11-19 21:58:14 +00:00
|
|
|
MACHINE_CPU = xop avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586
|
2013-06-13 18:26:12 +00:00
|
|
|
. elif ${CPUTYPE} == "btver2"
|
|
|
|
MACHINE_CPU = avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586
|
2012-11-19 21:58:14 +00:00
|
|
|
. elif ${CPUTYPE} == "btver1"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586
|
2012-11-19 21:58:14 +00:00
|
|
|
. elif ${CPUTYPE} == "amdfam10"
|
|
|
|
MACHINE_CPU = athlon-xp athlon k7 3dnow sse4a sse3 sse2 sse mmx k6 k5 i586
|
|
|
|
. elif ${CPUTYPE} == "opteron-sse3" || ${CPUTYPE} == "athlon64-sse3"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = athlon-xp athlon k7 3dnow sse3 sse2 sse mmx k6 k5 i586
|
Tidy up bsd.cpu.mk for X86 CPUs:
- Do not limit recent processors to "prescott" class for i386 target. There
is no reason for this hack because clang is default now. On top of that, it
will only grow indefinitely over time.
- Add more CPUTYPEs, i.e., "athlon-fx", "core-avx2", "atom", "penryn", and
"yonah". Note "penryn" and "yonah" are intentionally undocumented because
they are not supported by gcc and marked deprecated by clang.
- Add more CPUTYPE aliases, i.e., "barcelona" (-> amdfam10), "westmere" and
"nehalem" (-> corei7). Note these are intentionally undocumented because
they are not supported by (base) gcc and/or clang. However, LLVM (backend)
seems to "know" the differences. Most likely, they were deprecated with
other vendor code names and clang did not bother implementing them at all.
- Add i686 to MACHINE_CPU for "c3-2" (VIA Nehemiah). Both gcc & clang treat
it like an i686-class processor.
- Add IDT "winchip2" and "winchip-c6" for completeness (undocumented).
- Order processors per make.conf example, i.e., CPU vendors and models.
- Tidy up make.conf example, i.e., remove "by gcc" (because we have aliases)
and remove "prescott" from AMD64 architecture (because it is not correct).
2012-12-04 00:37:17 +00:00
|
|
|
. elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || \
|
|
|
|
${CPUTYPE} == "athlon-fx"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = athlon-xp athlon k7 3dnow sse2 sse mmx k6 k5 i586
|
2004-10-17 05:19:45 +00:00
|
|
|
. elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || \
|
2004-01-31 02:17:11 +00:00
|
|
|
${CPUTYPE} == "athlon-4"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = athlon-xp athlon k7 3dnow sse mmx k6 k5 i586
|
2004-03-05 15:59:33 +00:00
|
|
|
. elif ${CPUTYPE} == "athlon" || ${CPUTYPE} == "athlon-tbird"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = athlon k7 3dnow mmx k6 k5 i586
|
2011-03-07 14:58:23 +00:00
|
|
|
. elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" || ${CPUTYPE} == "geode"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = 3dnow mmx k6 k5 i586
|
2002-09-18 20:51:25 +00:00
|
|
|
. elif ${CPUTYPE} == "k6"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = mmx k6 k5 i586
|
2002-09-18 20:51:25 +00:00
|
|
|
. elif ${CPUTYPE} == "k5"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = k5 i586
|
2018-04-03 23:11:08 +00:00
|
|
|
. elif ${CPUTYPE} == "cannonlake" || ${CPUTYPE} == "knm" || \
|
|
|
|
${CPUTYPE} == "skylake-avx512" || ${CPUTYPE} == "knl"
|
2015-03-17 05:48:45 +00:00
|
|
|
MACHINE_CPU = avx512 avx2 avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586
|
2018-04-03 23:11:08 +00:00
|
|
|
. elif ${CPUTYPE} == "skylake" || ${CPUTYPE} == "broadwell" || \
|
|
|
|
${CPUTYPE} == "haswell"
|
Tidy up bsd.cpu.mk for X86 CPUs:
- Do not limit recent processors to "prescott" class for i386 target. There
is no reason for this hack because clang is default now. On top of that, it
will only grow indefinitely over time.
- Add more CPUTYPEs, i.e., "athlon-fx", "core-avx2", "atom", "penryn", and
"yonah". Note "penryn" and "yonah" are intentionally undocumented because
they are not supported by gcc and marked deprecated by clang.
- Add more CPUTYPE aliases, i.e., "barcelona" (-> amdfam10), "westmere" and
"nehalem" (-> corei7). Note these are intentionally undocumented because
they are not supported by (base) gcc and/or clang. However, LLVM (backend)
seems to "know" the differences. Most likely, they were deprecated with
other vendor code names and clang did not bother implementing them at all.
- Add i686 to MACHINE_CPU for "c3-2" (VIA Nehemiah). Both gcc & clang treat
it like an i686-class processor.
- Add IDT "winchip2" and "winchip-c6" for completeness (undocumented).
- Order processors per make.conf example, i.e., CPU vendors and models.
- Tidy up make.conf example, i.e., remove "by gcc" (because we have aliases)
and remove "prescott" from AMD64 architecture (because it is not correct).
2012-12-04 00:37:17 +00:00
|
|
|
MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586
|
2015-03-17 05:48:45 +00:00
|
|
|
. elif ${CPUTYPE} == "ivybridge" || ${CPUTYPE} == "sandybridge"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586
|
2018-04-03 23:11:08 +00:00
|
|
|
. elif ${CPUTYPE} == "goldmont" || ${CPUTYPE} == "westmere" || \
|
|
|
|
${CPUTYPE} == "nehalem" || ${CPUTYPE} == "silvermont"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586
|
Tidy up bsd.cpu.mk for X86 CPUs:
- Do not limit recent processors to "prescott" class for i386 target. There
is no reason for this hack because clang is default now. On top of that, it
will only grow indefinitely over time.
- Add more CPUTYPEs, i.e., "athlon-fx", "core-avx2", "atom", "penryn", and
"yonah". Note "penryn" and "yonah" are intentionally undocumented because
they are not supported by gcc and marked deprecated by clang.
- Add more CPUTYPE aliases, i.e., "barcelona" (-> amdfam10), "westmere" and
"nehalem" (-> corei7). Note these are intentionally undocumented because
they are not supported by (base) gcc and/or clang. However, LLVM (backend)
seems to "know" the differences. Most likely, they were deprecated with
other vendor code names and clang did not bother implementing them at all.
- Add i686 to MACHINE_CPU for "c3-2" (VIA Nehemiah). Both gcc & clang treat
it like an i686-class processor.
- Add IDT "winchip2" and "winchip-c6" for completeness (undocumented).
- Order processors per make.conf example, i.e., CPU vendors and models.
- Tidy up make.conf example, i.e., remove "by gcc" (because we have aliases)
and remove "prescott" from AMD64 architecture (because it is not correct).
2012-12-04 00:37:17 +00:00
|
|
|
. elif ${CPUTYPE} == "penryn"
|
|
|
|
MACHINE_CPU = sse41 ssse3 sse3 sse2 sse i686 mmx i586
|
2015-03-17 05:48:45 +00:00
|
|
|
. elif ${CPUTYPE} == "core2" || ${CPUTYPE} == "bonnell"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = ssse3 sse3 sse2 sse i686 mmx i586
|
Tidy up bsd.cpu.mk for X86 CPUs:
- Do not limit recent processors to "prescott" class for i386 target. There
is no reason for this hack because clang is default now. On top of that, it
will only grow indefinitely over time.
- Add more CPUTYPEs, i.e., "athlon-fx", "core-avx2", "atom", "penryn", and
"yonah". Note "penryn" and "yonah" are intentionally undocumented because
they are not supported by gcc and marked deprecated by clang.
- Add more CPUTYPE aliases, i.e., "barcelona" (-> amdfam10), "westmere" and
"nehalem" (-> corei7). Note these are intentionally undocumented because
they are not supported by (base) gcc and/or clang. However, LLVM (backend)
seems to "know" the differences. Most likely, they were deprecated with
other vendor code names and clang did not bother implementing them at all.
- Add i686 to MACHINE_CPU for "c3-2" (VIA Nehemiah). Both gcc & clang treat
it like an i686-class processor.
- Add IDT "winchip2" and "winchip-c6" for completeness (undocumented).
- Order processors per make.conf example, i.e., CPU vendors and models.
- Tidy up make.conf example, i.e., remove "by gcc" (because we have aliases)
and remove "prescott" from AMD64 architecture (because it is not correct).
2012-12-04 00:37:17 +00:00
|
|
|
. elif ${CPUTYPE} == "yonah" || ${CPUTYPE} == "prescott"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = sse3 sse2 sse i686 mmx i586
|
2012-11-19 21:58:14 +00:00
|
|
|
. elif ${CPUTYPE} == "pentium4" || ${CPUTYPE} == "pentium4m" || \
|
|
|
|
${CPUTYPE} == "pentium-m"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = sse2 sse i686 mmx i586
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "pentium3" || ${CPUTYPE} == "pentium3m"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = sse i686 mmx i586
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "pentium2"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = i686 mmx i586
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "pentiumpro"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = i686 i586
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "pentium-mmx"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = mmx i586
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "pentium"
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU = i586
|
Tidy up bsd.cpu.mk for X86 CPUs:
- Do not limit recent processors to "prescott" class for i386 target. There
is no reason for this hack because clang is default now. On top of that, it
will only grow indefinitely over time.
- Add more CPUTYPEs, i.e., "athlon-fx", "core-avx2", "atom", "penryn", and
"yonah". Note "penryn" and "yonah" are intentionally undocumented because
they are not supported by gcc and marked deprecated by clang.
- Add more CPUTYPE aliases, i.e., "barcelona" (-> amdfam10), "westmere" and
"nehalem" (-> corei7). Note these are intentionally undocumented because
they are not supported by (base) gcc and/or clang. However, LLVM (backend)
seems to "know" the differences. Most likely, they were deprecated with
other vendor code names and clang did not bother implementing them at all.
- Add i686 to MACHINE_CPU for "c3-2" (VIA Nehemiah). Both gcc & clang treat
it like an i686-class processor.
- Add IDT "winchip2" and "winchip-c6" for completeness (undocumented).
- Order processors per make.conf example, i.e., CPU vendors and models.
- Tidy up make.conf example, i.e., remove "by gcc" (because we have aliases)
and remove "prescott" from AMD64 architecture (because it is not correct).
2012-12-04 00:37:17 +00:00
|
|
|
. elif ${CPUTYPE} == "c7"
|
|
|
|
MACHINE_CPU = sse3 sse2 sse i686 mmx i586
|
|
|
|
. elif ${CPUTYPE} == "c3-2"
|
|
|
|
MACHINE_CPU = sse i686 mmx i586
|
|
|
|
. elif ${CPUTYPE} == "c3"
|
|
|
|
MACHINE_CPU = 3dnow mmx i586
|
|
|
|
. elif ${CPUTYPE} == "winchip2"
|
|
|
|
MACHINE_CPU = 3dnow mmx
|
|
|
|
. elif ${CPUTYPE} == "winchip-c6"
|
|
|
|
MACHINE_CPU = mmx
|
2002-09-18 20:51:25 +00:00
|
|
|
. endif
|
2012-12-03 19:27:31 +00:00
|
|
|
MACHINE_CPU += i486
|
2015-08-25 17:11:49 +00:00
|
|
|
########## amd64
|
2010-09-13 07:22:14 +00:00
|
|
|
. elif ${MACHINE_CPUARCH} == "amd64"
|
2017-03-07 19:00:27 +00:00
|
|
|
. if ${CPUTYPE} == "znver1"
|
|
|
|
MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse4a sse3
|
|
|
|
. elif ${CPUTYPE} == "bdver4"
|
2015-03-17 05:48:45 +00:00
|
|
|
MACHINE_CPU = xop avx2 avx sse42 sse41 ssse3 sse4a sse3
|
|
|
|
. elif ${CPUTYPE} == "bdver3" || ${CPUTYPE} == "bdver2" || \
|
2014-03-20 19:17:46 +00:00
|
|
|
${CPUTYPE} == "bdver1"
|
2012-11-19 21:58:14 +00:00
|
|
|
MACHINE_CPU = xop avx sse42 sse41 ssse3 sse4a sse3
|
2013-06-13 18:26:12 +00:00
|
|
|
. elif ${CPUTYPE} == "btver2"
|
|
|
|
MACHINE_CPU = avx sse42 sse41 ssse3 sse4a sse3
|
2012-11-19 21:58:14 +00:00
|
|
|
. elif ${CPUTYPE} == "btver1"
|
|
|
|
MACHINE_CPU = ssse3 sse4a sse3
|
|
|
|
. elif ${CPUTYPE} == "amdfam10"
|
|
|
|
MACHINE_CPU = k8 3dnow sse4a sse3
|
|
|
|
. elif ${CPUTYPE} == "opteron-sse3" || ${CPUTYPE} == "athlon64-sse3" || \
|
|
|
|
${CPUTYPE} == "k8-sse3"
|
2011-02-20 22:32:21 +00:00
|
|
|
MACHINE_CPU = k8 3dnow sse3
|
2012-11-19 21:58:14 +00:00
|
|
|
. elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || \
|
Tidy up bsd.cpu.mk for X86 CPUs:
- Do not limit recent processors to "prescott" class for i386 target. There
is no reason for this hack because clang is default now. On top of that, it
will only grow indefinitely over time.
- Add more CPUTYPEs, i.e., "athlon-fx", "core-avx2", "atom", "penryn", and
"yonah". Note "penryn" and "yonah" are intentionally undocumented because
they are not supported by gcc and marked deprecated by clang.
- Add more CPUTYPE aliases, i.e., "barcelona" (-> amdfam10), "westmere" and
"nehalem" (-> corei7). Note these are intentionally undocumented because
they are not supported by (base) gcc and/or clang. However, LLVM (backend)
seems to "know" the differences. Most likely, they were deprecated with
other vendor code names and clang did not bother implementing them at all.
- Add i686 to MACHINE_CPU for "c3-2" (VIA Nehemiah). Both gcc & clang treat
it like an i686-class processor.
- Add IDT "winchip2" and "winchip-c6" for completeness (undocumented).
- Order processors per make.conf example, i.e., CPU vendors and models.
- Tidy up make.conf example, i.e., remove "by gcc" (because we have aliases)
and remove "prescott" from AMD64 architecture (because it is not correct).
2012-12-04 00:37:17 +00:00
|
|
|
${CPUTYPE} == "athlon-fx" || ${CPUTYPE} == "k8"
|
2004-12-11 18:36:42 +00:00
|
|
|
MACHINE_CPU = k8 3dnow
|
2018-04-03 23:11:08 +00:00
|
|
|
. elif ${CPUTYPE} == "cannonlake" || ${CPUTYPE} == "knm" || \
|
|
|
|
${CPUTYPE} == "skylake-avx512" || ${CPUTYPE} == "knl"
|
2015-03-17 05:48:45 +00:00
|
|
|
MACHINE_CPU = avx512 avx2 avx sse42 sse41 ssse3 sse3
|
2018-04-03 23:11:08 +00:00
|
|
|
. elif ${CPUTYPE} == "skylake" || ${CPUTYPE} == "broadwell" || \
|
|
|
|
${CPUTYPE} == "haswell"
|
Tidy up bsd.cpu.mk for X86 CPUs:
- Do not limit recent processors to "prescott" class for i386 target. There
is no reason for this hack because clang is default now. On top of that, it
will only grow indefinitely over time.
- Add more CPUTYPEs, i.e., "athlon-fx", "core-avx2", "atom", "penryn", and
"yonah". Note "penryn" and "yonah" are intentionally undocumented because
they are not supported by gcc and marked deprecated by clang.
- Add more CPUTYPE aliases, i.e., "barcelona" (-> amdfam10), "westmere" and
"nehalem" (-> corei7). Note these are intentionally undocumented because
they are not supported by (base) gcc and/or clang. However, LLVM (backend)
seems to "know" the differences. Most likely, they were deprecated with
other vendor code names and clang did not bother implementing them at all.
- Add i686 to MACHINE_CPU for "c3-2" (VIA Nehemiah). Both gcc & clang treat
it like an i686-class processor.
- Add IDT "winchip2" and "winchip-c6" for completeness (undocumented).
- Order processors per make.conf example, i.e., CPU vendors and models.
- Tidy up make.conf example, i.e., remove "by gcc" (because we have aliases)
and remove "prescott" from AMD64 architecture (because it is not correct).
2012-12-04 00:37:17 +00:00
|
|
|
MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse3
|
2015-03-17 05:48:45 +00:00
|
|
|
. elif ${CPUTYPE} == "ivybridge" || ${CPUTYPE} == "sandybridge"
|
2012-11-19 21:58:14 +00:00
|
|
|
MACHINE_CPU = avx sse42 sse41 ssse3 sse3
|
2018-04-03 23:11:08 +00:00
|
|
|
. elif ${CPUTYPE} == "goldmont" || ${CPUTYPE} == "westmere" || \
|
|
|
|
${CPUTYPE} == "nehalem" || ${CPUTYPE} == "silvermont"
|
2012-11-19 21:58:14 +00:00
|
|
|
MACHINE_CPU = sse42 sse41 ssse3 sse3
|
Tidy up bsd.cpu.mk for X86 CPUs:
- Do not limit recent processors to "prescott" class for i386 target. There
is no reason for this hack because clang is default now. On top of that, it
will only grow indefinitely over time.
- Add more CPUTYPEs, i.e., "athlon-fx", "core-avx2", "atom", "penryn", and
"yonah". Note "penryn" and "yonah" are intentionally undocumented because
they are not supported by gcc and marked deprecated by clang.
- Add more CPUTYPE aliases, i.e., "barcelona" (-> amdfam10), "westmere" and
"nehalem" (-> corei7). Note these are intentionally undocumented because
they are not supported by (base) gcc and/or clang. However, LLVM (backend)
seems to "know" the differences. Most likely, they were deprecated with
other vendor code names and clang did not bother implementing them at all.
- Add i686 to MACHINE_CPU for "c3-2" (VIA Nehemiah). Both gcc & clang treat
it like an i686-class processor.
- Add IDT "winchip2" and "winchip-c6" for completeness (undocumented).
- Order processors per make.conf example, i.e., CPU vendors and models.
- Tidy up make.conf example, i.e., remove "by gcc" (because we have aliases)
and remove "prescott" from AMD64 architecture (because it is not correct).
2012-12-04 00:37:17 +00:00
|
|
|
. elif ${CPUTYPE} == "penryn"
|
|
|
|
MACHINE_CPU = sse41 ssse3 sse3
|
2015-03-17 05:48:45 +00:00
|
|
|
. elif ${CPUTYPE} == "core2" || ${CPUTYPE} == "bonnell"
|
2011-03-14 13:36:51 +00:00
|
|
|
MACHINE_CPU = ssse3 sse3
|
|
|
|
. elif ${CPUTYPE} == "nocona"
|
2004-12-11 18:36:42 +00:00
|
|
|
MACHINE_CPU = sse3
|
2004-10-17 05:19:45 +00:00
|
|
|
. endif
|
2004-12-11 18:36:42 +00:00
|
|
|
MACHINE_CPU += amd64 sse2 sse mmx
|
2015-11-19 03:11:20 +00:00
|
|
|
########## Mips
|
|
|
|
. elif ${MACHINE_CPUARCH} == "mips"
|
|
|
|
MACHINE_CPU = mips
|
2015-08-25 17:11:49 +00:00
|
|
|
########## powerpc
|
2010-12-30 15:58:23 +00:00
|
|
|
. elif ${MACHINE_ARCH} == "powerpc"
|
|
|
|
. if ${CPUTYPE} == "e500"
|
2015-08-25 17:11:49 +00:00
|
|
|
MACHINE_CPU = booke softfp
|
2010-12-30 15:58:23 +00:00
|
|
|
. endif
|
2015-12-11 22:55:23 +00:00
|
|
|
########## riscv
|
|
|
|
. elif ${MACHINE_CPUARCH} == "riscv"
|
|
|
|
MACHINE_CPU = riscv
|
2015-08-25 17:11:49 +00:00
|
|
|
########## sparc64
|
2010-12-30 15:58:23 +00:00
|
|
|
. elif ${MACHINE_ARCH} == "sparc64"
|
|
|
|
. if ${CPUTYPE} == "v9"
|
|
|
|
MACHINE_CPU = v9
|
|
|
|
. elif ${CPUTYPE} == "ultrasparc"
|
|
|
|
MACHINE_CPU = v9 ultrasparc
|
|
|
|
. elif ${CPUTYPE} == "ultrasparc3"
|
|
|
|
MACHINE_CPU = v9 ultrasparc ultrasparc3
|
|
|
|
. endif
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
. endif
|
|
|
|
.endif
|
2002-09-18 20:48:54 +00:00
|
|
|
|
2010-12-30 15:58:23 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "mips"
|
2010-03-02 07:44:38 +00:00
|
|
|
CFLAGS += -G0
|
2016-11-16 03:19:36 +00:00
|
|
|
. if ${MACHINE_ARCH:Mmips*el*} != ""
|
|
|
|
AFLAGS += -EL
|
|
|
|
CFLAGS += -EL
|
|
|
|
LDFLAGS += -EL
|
|
|
|
. else
|
|
|
|
AFLAGS += -EB
|
|
|
|
CFLAGS += -EB
|
|
|
|
LDFLAGS += -EB
|
|
|
|
. endif
|
2017-04-07 20:02:01 +00:00
|
|
|
. if ${MACHINE_ARCH:Mmips64*} != ""
|
|
|
|
AFLAGS+= -mabi=64
|
|
|
|
CFLAGS+= -mabi=64
|
|
|
|
LDFLAGS+= -mabi=64
|
|
|
|
. elif ${MACHINE_ARCH:Mmipsn32*} != ""
|
|
|
|
AFLAGS+= -mabi=n32
|
|
|
|
CFLAGS+= -mabi=n32
|
|
|
|
LDFLAGS+= -mabi=n32
|
|
|
|
. else
|
|
|
|
AFLAGS+= -mabi=32
|
|
|
|
CFLAGS+= -mabi=32
|
|
|
|
LDFLAGS+= -mabi=32
|
|
|
|
. endif
|
2016-11-16 03:19:36 +00:00
|
|
|
. if ${MACHINE_ARCH:Mmips*hf}
|
2016-10-31 15:33:58 +00:00
|
|
|
CFLAGS += -mhard-float
|
2016-11-16 03:19:36 +00:00
|
|
|
. else
|
|
|
|
CFLAGS += -msoft-float
|
|
|
|
. endif
|
2008-03-19 12:20:44 +00:00
|
|
|
.endif
|
|
|
|
|
2015-08-25 17:11:49 +00:00
|
|
|
########## arm
|
|
|
|
.if ${MACHINE_CPUARCH} == "arm"
|
|
|
|
MACHINE_CPU += arm
|
|
|
|
. if ${MACHINE_ARCH:Marmv6*} != ""
|
|
|
|
MACHINE_CPU += armv6
|
|
|
|
. endif
|
2017-10-05 23:01:33 +00:00
|
|
|
. if ${MACHINE_ARCH:Marmv7*} != ""
|
|
|
|
MACHINE_CPU += armv7
|
|
|
|
. endif
|
|
|
|
# armv6 and armv7 are a hybrid. It can use the softfp ABI, but doesn't emulate
|
|
|
|
# floating point in the general case, so don't define softfp for it at this
|
2018-07-17 23:23:54 +00:00
|
|
|
# time. arm is pure softfp, so define it for them.
|
2017-10-05 23:01:33 +00:00
|
|
|
. if ${MACHINE_ARCH:Marmv[67]*} == ""
|
2015-08-25 17:11:49 +00:00
|
|
|
MACHINE_CPU += softfp
|
|
|
|
. endif
|
2017-10-05 23:01:33 +00:00
|
|
|
# Normally armv6 and armv7 are hard float ABI from FreeBSD 11 onwards. However
|
|
|
|
# when CPUTYPE has 'soft' in it, we use the soft-float ABI to allow building of
|
|
|
|
# soft-float ABI libraries. In this case, we have to add the -mfloat-abi=softfp
|
|
|
|
# to force that.
|
|
|
|
.if ${MACHINE_ARCH:Marmv[67]*} && defined(CPUTYPE) && ${CPUTYPE:M*soft*} != ""
|
2015-08-24 00:03:51 +00:00
|
|
|
# Needs to be CFLAGS not _CPUCFLAGS because it's needed for the ABI
|
|
|
|
# not a nice optimization.
|
|
|
|
CFLAGS += -mfloat-abi=softfp
|
2015-01-19 04:56:17 +00:00
|
|
|
.endif
|
2015-08-25 17:11:49 +00:00
|
|
|
.endif
|
2015-01-19 04:56:17 +00:00
|
|
|
|
Create a new MACHINE_ARCH for Freescale PowerPC e500v2
Summary:
The Freescale e500v2 PowerPC core does not use a standard FPU.
Instead, it uses a Signal Processing Engine (SPE)--a DSP-style vector processor
unit, which doubles as a FPU. The PowerPC SPE ABI is incompatible with the
stock powerpc ABI, so a new MACHINE_ARCH was created to deal with this.
Additionaly, the SPE opcodes overlap with Altivec, so these are mutually
exclusive. Taking advantage of this fact, a new file, powerpc/booke/spe.c, was
created with the same function set as in powerpc/powerpc/altivec.c, so it
becomes effectively a drop-in replacement. setjmp/longjmp were modified to save
the upper 32-bits of the now-64-bit GPRs (upper 32-bits are only accessible by
the SPE).
Note: This does _not_ support the SPE in the e500v1, as the e500v1 SPE does not
support double-precision floating point.
Also, without a new MACHINE_ARCH it would be impossible to provide binary
packages which utilize the SPE.
Additionally, no work has been done to support ports, work is needed for this.
This also means no newer gcc can yet be used. However, gcc's powerpc support
has been refactored which would make adding a powerpcspe-freebsd target very
easy.
Test Plan:
This was lightly tested on a RouterBoard RB800 and an AmigaOne A1222
(P1022-based) board, compiled against the new ABI. Base system utilities
(/bin/sh, /bin/ls, etc) still function appropriately, the system is able to boot
multiuser.
Reviewed By: bdrewery, imp
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D5683
2016-10-22 01:57:15 +00:00
|
|
|
.if ${MACHINE_ARCH} == "powerpcspe"
|
|
|
|
CFLAGS += -mcpu=8540 -Wa,-me500 -mspe=yes -mabi=spe -mfloat-gprs=double
|
|
|
|
.endif
|
|
|
|
|
2016-08-11 13:42:31 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "riscv"
|
2018-06-19 13:28:02 +00:00
|
|
|
.if ${MACHINE_ARCH:Mriscv*sf}
|
2018-09-03 14:43:16 +00:00
|
|
|
CFLAGS += -march=rv64imac -mabi=lp64
|
2017-08-10 14:18:09 +00:00
|
|
|
.else
|
2018-09-03 14:43:16 +00:00
|
|
|
CFLAGS += -march=rv64imafdc -mabi=lp64d
|
2016-08-11 13:42:31 +00:00
|
|
|
.endif
|
2016-11-16 15:21:32 +00:00
|
|
|
.endif
|
2016-08-11 13:42:31 +00:00
|
|
|
|
2004-01-10 18:01:08 +00:00
|
|
|
# NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk
|
2002-09-18 20:48:54 +00:00
|
|
|
|
|
|
|
.if !defined(NO_CPU_CFLAGS)
|
|
|
|
CFLAGS += ${_CPUCFLAGS}
|
|
|
|
.endif
|
2014-03-19 18:54:53 +00:00
|
|
|
|
Disable SSE in libthr
Clang emits SSE instructions on amd64 in the common path of
pthread_mutex_unlock. If the thread does not otherwise use SSE,
this usage incurs a context-switch of the FPU/SSE state, which
reduces the performance of multiple real-world applications by a
non-trivial amount (3-5% in one application).
Instead of this change, I experimented with eagerly switching the
FPU state at context-switch time. This did not help. Most of the
cost seems to be in the read/write of memory--as kib@ stated--and
not in the #NM handling. I tested on machines with and without
XSAVEOPT.
One counter-argument to this change is that most applications already
use SIMD, and the number of applications and amount of SIMD usage
are only increasing. This is absolutely true. I agree that--in
general and in principle--this change is in the wrong direction.
However, there are applications that do not use enough SSE to offset
the extra context-switch cost. SSE does not provide a clear benefit
in the current libthr code with the current compiler, but it does
provide a clear loss in some cases. Therefore, disabling SSE in
libthr is a non-loss for most, and a gain for some.
I refrained from disabling SSE in libc--as was suggested--because
I can't make the above argument for libc. It provides a wide variety
of code; each case should be analyzed separately.
https://lists.freebsd.org/pipermail/freebsd-current/2015-March/055193.html
Suggestions from: dim, jmg, rpaulo
Approved by: kib (mentor)
MFC after: 2 weeks
Sponsored by: Dell Inc.
2015-08-05 12:53:55 +00:00
|
|
|
#
|
|
|
|
# Prohibit the compiler from emitting SIMD instructions.
|
|
|
|
# These flags are added to CFLAGS in areas where the extra context-switch
|
|
|
|
# cost outweighs the advantages of SIMD instructions.
|
|
|
|
#
|
|
|
|
# gcc:
|
|
|
|
# Setting -mno-mmx implies -mno-3dnow
|
|
|
|
# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3 and -mfpmath=387
|
|
|
|
#
|
|
|
|
# clang:
|
|
|
|
# Setting -mno-mmx implies -mno-3dnow and -mno-3dnowa
|
|
|
|
# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and
|
|
|
|
# -mno-sse42
|
|
|
|
# (-mfpmath= is not supported)
|
|
|
|
#
|
|
|
|
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
|
2017-11-20 22:41:22 +00:00
|
|
|
CFLAGS_NO_SIMD.clang= -mno-avx -mno-avx2
|
Disable SSE in libthr
Clang emits SSE instructions on amd64 in the common path of
pthread_mutex_unlock. If the thread does not otherwise use SSE,
this usage incurs a context-switch of the FPU/SSE state, which
reduces the performance of multiple real-world applications by a
non-trivial amount (3-5% in one application).
Instead of this change, I experimented with eagerly switching the
FPU state at context-switch time. This did not help. Most of the
cost seems to be in the read/write of memory--as kib@ stated--and
not in the #NM handling. I tested on machines with and without
XSAVEOPT.
One counter-argument to this change is that most applications already
use SIMD, and the number of applications and amount of SIMD usage
are only increasing. This is absolutely true. I agree that--in
general and in principle--this change is in the wrong direction.
However, there are applications that do not use enough SSE to offset
the extra context-switch cost. SSE does not provide a clear benefit
in the current libthr code with the current compiler, but it does
provide a clear loss in some cases. Therefore, disabling SSE in
libthr is a non-loss for most, and a gain for some.
I refrained from disabling SSE in libc--as was suggested--because
I can't make the above argument for libc. It provides a wide variety
of code; each case should be analyzed separately.
https://lists.freebsd.org/pipermail/freebsd-current/2015-March/055193.html
Suggestions from: dim, jmg, rpaulo
Approved by: kib (mentor)
MFC after: 2 weeks
Sponsored by: Dell Inc.
2015-08-05 12:53:55 +00:00
|
|
|
CFLAGS_NO_SIMD= -mno-mmx -mno-sse
|
|
|
|
.endif
|
|
|
|
CFLAGS_NO_SIMD += ${CFLAGS_NO_SIMD.${COMPILER_TYPE}}
|
|
|
|
|
2017-08-12 21:26:46 +00:00
|
|
|
# Add in any architecture-specific CFLAGS.
|
2014-03-19 18:54:53 +00:00
|
|
|
# These come from make.conf or the command line or the environment.
|
|
|
|
CFLAGS += ${CFLAGS.${MACHINE_ARCH}}
|
2014-07-08 14:37:01 +00:00
|
|
|
CXXFLAGS += ${CXXFLAGS.${MACHINE_ARCH}}
|