git: 69d8cd0cd0f3 - main - lang/go{-devel,118}: Add GOAMD64 knobs
Date: Fri, 08 Jul 2022 19:53:32 UTC
The branch main has been updated by dmgk:
URL: https://cgit.FreeBSD.org/ports/commit/?id=69d8cd0cd0f31aa9578ce0fd795374308730ea81
commit 69d8cd0cd0f31aa9578ce0fd795374308730ea81
Author: Dmitri Goutnik <dmgk@FreeBSD.org>
AuthorDate: 2022-07-08 19:38:47 +0000
Commit: Dmitri Goutnik <dmgk@FreeBSD.org>
CommitDate: 2022-07-08 19:53:00 +0000
lang/go{-devel,118}: Add GOAMD64 knobs
Add amd64 microarchitecture level knobs for the Go compiler. Note that
this will affect only the compiler itself, port users will still need to
set GOAMD64 in the environment to adjust the microarchitecture of the
compiled code [1, 2].
Set default to the baseline level for the maximum backward
compatibility.
GOAMD64=v1 (default): The baseline. Exclusively generates instructions
that all 64-bit x86 processors can execute.
GOAMD64=v2: all v1 instructions, plus CMPXCHG16B, LAHF, SAHF, POPCNT,
SSE3, SSE4.1, SSE4.2, SSSE3.
GOAMD64=v3: all v2 instructions, plus AVX, AVX2, BMI1, BMI2, F16C, FMA,
LZCNT, MOVBE, OSXSAVE.
GOAMD64=v4: all v3 instructions, plus AVX512F, AVX512BW, AVX512CD,
AVX512DQ, AVX512VL.
[1] https://github.com/golang/go/wiki/MinimumRequirements#microarchitecture-support
[2] https://tip.golang.org/doc/go1.18#amd64
---
lang/go-devel/Makefile | 17 ++++++++++++++++-
lang/go118/Makefile | 2 +-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/lang/go-devel/Makefile b/lang/go-devel/Makefile
index 90b0e076ff1d..17d0f59e4c55 100644
--- a/lang/go-devel/Makefile
+++ b/lang/go-devel/Makefile
@@ -2,7 +2,7 @@
PORTNAME= go
DISTVERSION?= g20220706
-PORTREVISION?= 0
+PORTREVISION?= 1
CATEGORIES= lang
MASTER_SITES?= https://github.com/dmgk/go-bootstrap/releases/download/${BOOTSTRAP_TAG}/:bootstrap \
LOCAL/dmgk:bootstrap
@@ -48,8 +48,21 @@ SHEBANG_GLOB= *.bash *.pl *.sh
EXTRACT_CMD= ${SETENV} LC_ALL=en_US.UTF-8 ${TAR}
OPTIONS_DEFINE_i386= SOFTFLOAT
+OPTIONS_DEFAULT_amd64= V1
+OPTIONS_SINGLE= ${OPTIONS_SINGLE_${ARCH}}
+OPTIONS_SINGLE_amd64= GOAMD64
+OPTIONS_SINGLE_GOAMD64= V1 V2 V3 V4
+
SOFTFLOAT_DESC= Use soft float on non-SSE2 processors (Pentium 4 and older)
SOFTFLOAT_VARS= GO386=softfloat
+V1_DESC= Use baseline x86-64 instruction set
+V1_VARS= GOAMD64=v1
+V2_DESC= V1 instructions plus CMPXCHG16B, LAHF, SAHF, POPCNT, SSE*
+V2_VARS= GOAMD64=v2
+V3_DESC= V2 instructions plus AVX*, BMI*, F16C, FMA, LZCNT, MOVBE, OSXSAVE
+V3_VARS= GOAMD64=v3
+V4_DESC= V3 instructions plus AVX512*
+V4_VARS= GOAMD64=v4
BOOTSTRAP_TAG= go1.17.9
GO_SUFFIX= ${PKGNAMESUFFIX}
@@ -86,6 +99,7 @@ do-build:
GOARCH=${GOARCH_${ARCH}} \
GO386=${GO386} \
GOARM=${GOARM_${ARCH}} \
+ GOAMD64=${GOAMD64} \
CC=${CC} \
${SH} make.bash -v
@@ -109,6 +123,7 @@ do-test:
GOARCH=${GOARCH_${ARCH}} \
GO386=${GO386} \
GOARM=${GOARM_${ARCH}} \
+ GOAMD64=${GOAMD64} \
CC=${CC} \
${SH} run.bash -no-rebuild
diff --git a/lang/go118/Makefile b/lang/go118/Makefile
index 0d25c03786f1..34d23cfd78c5 100644
--- a/lang/go118/Makefile
+++ b/lang/go118/Makefile
@@ -2,7 +2,7 @@
DISTVERSION= 1.18.3
# Always set PORTREVISION explicitly as otherwise they are inherited from lang/go-devel
-PORTREVISION= 0
+PORTREVISION= 1
MASTER_SITES= https://golang.org/dl/ \
https://github.com/dmgk/go-bootstrap/releases/download/${BOOTSTRAP_TAG}/:bootstrap \
LOCAL/dmgk:bootstrap