ppc64{,le} processor level selection allows the compiler to generate instructions
targeting newer processors and processor-specific optimizations without breaking
compatibility with our current baseline. This feature introduces a new environment
variable, GOPPC64.
GOPPC64 is a GOARCH=ppc64{,le} specific option, for a choice between different
processor levels (i.e. Instruction Set Architecture versions) for which the
compiler will target. The default is 'power8'.
Change-Id: Ic152e283ae1c47084ece4346fa002a3eabb3bb9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/163758
Run-TryBot: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
</p>
</li>
+<li><code>$GOPPC64</code> (for <code>ppc64</code> and <code>ppc64le</code> only)
+<p>
+This variable sets the processor level (i.e. Instruction Set Architecture version)
+for which the compiler will target. The default is <code>power8</code>.
+</p>
+<ul>
+ <li><code>GOPPC64=power8</code>: generate ISA v2.07 instructions</li>
+ <li><code>GOPPC64=power9</code>: generate ISA v3.00 instructions</li>
+</ul>
+</li>
+
</ul>
<p>
go386 string
gomips string
gomips64 string
+ goppc64 string
goroot string
goroot_final string
goextlinkenabled string
}
gomips64 = b
+ b = os.Getenv("GOPPC64")
+ if b == "" {
+ b = "power8"
+ }
+ goppc64 = b
+
if p := pathf("%s/src/all.bash", goroot); !isfile(p) {
fatalf("$GOROOT is not set correctly or not exported\n"+
"\tGOROOT=%s\n"+
os.Setenv("GOOS", goos)
os.Setenv("GOMIPS", gomips)
os.Setenv("GOMIPS64", gomips64)
+ os.Setenv("GOPPC64", goppc64)
os.Setenv("GOROOT", goroot)
os.Setenv("GOROOT_FINAL", goroot_final)
if goarch == "mips64" || goarch == "mips64le" {
xprintf(format, "GOMIPS64", gomips64)
}
+ if goarch == "ppc64" || goarch == "ppc64le" {
+ xprintf(format, "GOPPC64", goppc64)
+ }
if *path {
sep := ":"
// const defaultGOARM = <goarm>
// const defaultGOMIPS = <gomips>
// const defaultGOMIPS64 = <gomips64>
+// const defaultGOPPC64 = <goppc64>
// const defaultGOOS = runtime.GOOS
// const defaultGOARCH = runtime.GOARCH
// const defaultGO_EXTLINK_ENABLED = <goextlinkenabled>
fmt.Fprintf(&buf, "const defaultGOARM = `%s`\n", goarm)
fmt.Fprintf(&buf, "const defaultGOMIPS = `%s`\n", gomips)
fmt.Fprintf(&buf, "const defaultGOMIPS64 = `%s`\n", gomips64)
+ fmt.Fprintf(&buf, "const defaultGOPPC64 = `%s`\n", goppc64)
fmt.Fprintf(&buf, "const defaultGOOS = runtime.GOOS\n")
fmt.Fprintf(&buf, "const defaultGOARCH = runtime.GOARCH\n")
fmt.Fprintf(&buf, "const defaultGO_EXTLINK_ENABLED = `%s`\n", goextlinkenabled)
GO386 = objabi.GO386
GOMIPS = objabi.GOMIPS
GOMIPS64 = objabi.GOMIPS64
+ GOPPC64 = fmt.Sprintf("%s%d", "power", objabi.GOPPC64)
)
// Update build context to use our computed GOROOT.
env = append(env, cfg.EnvVar{Name: "GOMIPS", Value: cfg.GOMIPS})
case "mips64", "mips64le":
env = append(env, cfg.EnvVar{Name: "GOMIPS64", Value: cfg.GOMIPS64})
+ case "ppc64", "ppc64le":
+ env = append(env, cfg.EnvVar{Name: "GOPPC64", Value: cfg.GOPPC64})
}
cc := cfg.DefaultCC(cfg.Goos, cfg.Goarch)
GOARM = goarm()
GOMIPS = gomips()
GOMIPS64 = gomips64()
+ GOPPC64 = goppc64()
GO_LDSO = defaultGO_LDSO
Version = version
)
panic("unreachable")
}
+func goppc64() int {
+ switch v := envOr("GOPPC64", defaultGOPPC64); v {
+ case "power8":
+ return 8
+ case "power9":
+ return 9
+ }
+ log.Fatalf("Invalid GOPPC64 value. Must be power8 or power9.")
+ panic("unreachable")
+}
+
func Getgoextlinkenabled() string {
return envOr("GO_EXTLINK_ENABLED", defaultGO_EXTLINK_ENABLED)
}
"arm64": {},
"mips": {"GOMIPS", "hardfloat", "softfloat"},
"mips64": {"GOMIPS64", "hardfloat", "softfloat"},
- "ppc64": {},
- "ppc64le": {},
+ "ppc64": {"GOPPC64", "power8", "power9"},
+ "ppc64le": {"GOPPC64", "power8", "power9"},
"s390x": {},
}
)