summaryrefslogtreecommitdiffstats
path: root/share/mk/bsd.cpu.mk
diff options
context:
space:
mode:
Diffstat (limited to 'share/mk/bsd.cpu.mk')
-rw-r--r--share/mk/bsd.cpu.mk45
1 files changed, 43 insertions, 2 deletions
diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk
index 6ba87cc..112c2d5 100644
--- a/share/mk/bsd.cpu.mk
+++ b/share/mk/bsd.cpu.mk
@@ -150,6 +150,7 @@ _CPUCFLAGS = -mcpu=ultrasparc3
# unordered list to make it easy for client makefiles to test for the
# presence of a CPU feature.
+########## i386
. if ${MACHINE_CPUARCH} == "i386"
. if ${CPUTYPE} == "bdver4"
MACHINE_CPU = xop avx2 avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586
@@ -218,6 +219,7 @@ MACHINE_CPU = 3dnow mmx
MACHINE_CPU = mmx
. endif
MACHINE_CPU += i486
+########## amd64
. elif ${MACHINE_CPUARCH} == "amd64"
. if ${CPUTYPE} == "bdver4"
MACHINE_CPU = xop avx2 avx sse42 sse41 ssse3 sse4a sse3
@@ -253,10 +255,12 @@ MACHINE_CPU = ssse3 sse3
MACHINE_CPU = sse3
. endif
MACHINE_CPU += amd64 sse2 sse mmx
+########## powerpc
. elif ${MACHINE_ARCH} == "powerpc"
. if ${CPUTYPE} == "e500"
-MACHINE_CPU = booke
+MACHINE_CPU = booke softfp
. endif
+########## sparc64
. elif ${MACHINE_ARCH} == "sparc64"
. if ${CPUTYPE} == "v9"
MACHINE_CPU = v9
@@ -272,8 +276,24 @@ MACHINE_CPU = v9 ultrasparc ultrasparc3
CFLAGS += -G0
.endif
+########## arm
+.if ${MACHINE_CPUARCH} == "arm"
+MACHINE_CPU += arm
+. if ${MACHINE_ARCH:Marmv6*} != ""
+MACHINE_CPU += armv6
+. endif
+# armv6 is a hybrid. It uses the softfp ABI, but doesn't emulate
+# floating point in the general case, so don't define softfp for
+# it at this time. arm and armeb are pure softfp, so define it
+# for them.
+. if ${MACHINE_ARCH:Marmv6*} == ""
+MACHINE_CPU += softfp
+. endif
.if ${MACHINE_ARCH} == "armv6"
-_CPUCFLAGS += -mfloat-abi=softfp
+# Needs to be CFLAGS not _CPUCFLAGS because it's needed for the ABI
+# not a nice optimization.
+CFLAGS += -mfloat-abi=softfp
+.endif
.endif
# NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk
@@ -282,6 +302,27 @@ _CPUCFLAGS += -mfloat-abi=softfp
CFLAGS += ${_CPUCFLAGS}
.endif
+#
+# 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"
+CFLAGS_NO_SIMD.clang= -mno-avx
+CFLAGS_NO_SIMD= -mno-mmx -mno-sse
+.endif
+CFLAGS_NO_SIMD += ${CFLAGS_NO_SIMD.${COMPILER_TYPE}}
+
# Add in any architecture-specific CFLAGS.
# These come from make.conf or the command line or the environment.
CFLAGS += ${CFLAGS.${MACHINE_ARCH}}
OpenPOWER on IntegriCloud