aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/internal/cpu
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-12-31 11:23:30 -0800
committerIan Lance Taylor <iant@golang.org>2021-01-01 15:10:06 -0800
commitabca6705969b59edae86f11233f9d207cbdd1e06 (patch)
tree29e98635d93a1d559f1c07cc7a0d025c3520a56b /libgo/go/internal/cpu
parentd816b0c144d15e6570eb5b124b9f3ccbe3d40082 (diff)
downloadgcc-abca6705969b59edae86f11233f9d207cbdd1e06.zip
gcc-abca6705969b59edae86f11233f9d207cbdd1e06.tar.gz
gcc-abca6705969b59edae86f11233f9d207cbdd1e06.tar.bz2
internal/cpu, golang.org/x/sys/cpu: support other GOARCH values
Add support (mostly dummy support) for GOARCH values supported by gofrontend but not gc. Fix PPC handling. Fixes https://gcc.gnu.org/PR98493 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/280932
Diffstat (limited to 'libgo/go/internal/cpu')
-rw-r--r--libgo/go/internal/cpu/cpu_amd64p32.go7
-rw-r--r--libgo/go/internal/cpu/cpu_other.go21
-rw-r--r--libgo/go/internal/cpu/cpu_ppc64x_aix.go2
-rw-r--r--libgo/go/internal/cpu/cpu_ppc64x_linux.go2
-rw-r--r--libgo/go/internal/cpu/cpu_ppcx.go44
-rw-r--r--libgo/go/internal/cpu/cpu_x86.go4
6 files changed, 32 insertions, 48 deletions
diff --git a/libgo/go/internal/cpu/cpu_amd64p32.go b/libgo/go/internal/cpu/cpu_amd64p32.go
new file mode 100644
index 0000000..a6cff4f
--- /dev/null
+++ b/libgo/go/internal/cpu/cpu_amd64p32.go
@@ -0,0 +1,7 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cpu
+
+const GOARCH = "amd64p32"
diff --git a/libgo/go/internal/cpu/cpu_other.go b/libgo/go/internal/cpu/cpu_other.go
new file mode 100644
index 0000000..d0f1f2e
--- /dev/null
+++ b/libgo/go/internal/cpu/cpu_other.go
@@ -0,0 +1,21 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build !386
+// +build !amd64
+// +build !amd64p32
+// +build !arm
+// +build !arm64
+// +build !mips64
+// +build !mips64le
+// +build !ppc
+// +build !ppc64
+// +build !ppc64le
+// +build !riscv64
+// +build !s390x
+
+package cpu
+
+func doinit() {
+}
diff --git a/libgo/go/internal/cpu/cpu_ppc64x_aix.go b/libgo/go/internal/cpu/cpu_ppc64x_aix.go
index b840b82..a932684 100644
--- a/libgo/go/internal/cpu/cpu_ppc64x_aix.go
+++ b/libgo/go/internal/cpu/cpu_ppc64x_aix.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build ppc64 ppc64le
+// +build ppc ppc64 ppc64le
package cpu
diff --git a/libgo/go/internal/cpu/cpu_ppc64x_linux.go b/libgo/go/internal/cpu/cpu_ppc64x_linux.go
index 73b1914..068a799 100644
--- a/libgo/go/internal/cpu/cpu_ppc64x_linux.go
+++ b/libgo/go/internal/cpu/cpu_ppc64x_linux.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build ppc64 ppc64le
+// +build ppc ppc64 ppc64le
package cpu
diff --git a/libgo/go/internal/cpu/cpu_ppcx.go b/libgo/go/internal/cpu/cpu_ppcx.go
deleted file mode 100644
index 56ff875..0000000
--- a/libgo/go/internal/cpu/cpu_ppcx.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ppc ppc64 ppc64le
-
-package cpu
-
-// ppc64x doesn't have a 'cpuid' equivalent, so we rely on HWCAP/HWCAP2.
-// These are initialized by archauxv and should not be changed after they are
-// initialized.
-// On aix/ppc64, these values are initialized early in the runtime in runtime/os_aix.go.
-var HWCap uint
-var HWCap2 uint
-
-// HWCAP/HWCAP2 bits. These are exposed by the kernel.
-const (
- // ISA Level
- PPC_FEATURE2_ARCH_2_07 = 0x80000000
- PPC_FEATURE2_ARCH_3_00 = 0x00800000
-
- // CPU features
- PPC_FEATURE2_DARN = 0x00200000
- PPC_FEATURE2_SCV = 0x00100000
-)
-
-func doinit() {
- options = []option{
- {Name: "darn", Feature: &PPC64.HasDARN},
- {Name: "scv", Feature: &PPC64.HasSCV},
- {Name: "power9", Feature: &PPC64.IsPOWER9},
- {Name: "power8", Feature: &PPC64.IsPOWER8},
- }
-
- // HWCAP2 feature bits
- PPC64.IsPOWER8 = isSet(HWCap2, PPC_FEATURE2_ARCH_2_07)
- PPC64.IsPOWER9 = isSet(HWCap2, PPC_FEATURE2_ARCH_3_00)
- PPC64.HasDARN = isSet(HWCap2, PPC_FEATURE2_DARN)
- PPC64.HasSCV = isSet(HWCap2, PPC_FEATURE2_SCV)
-}
-
-func isSet(hwc uint, value uint) bool {
- return hwc&value != 0
-}
diff --git a/libgo/go/internal/cpu/cpu_x86.go b/libgo/go/internal/cpu/cpu_x86.go
index 62853a1..9aa5c3a 100644
--- a/libgo/go/internal/cpu/cpu_x86.go
+++ b/libgo/go/internal/cpu/cpu_x86.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build 386 amd64
+// +build 386 amd64 amd64p32
package cpu
@@ -56,7 +56,7 @@ func doinit() {
{Name: "ssse3", Feature: &X86.HasSSSE3},
// These capabilities should always be enabled on amd64:
- {Name: "sse2", Feature: &X86.HasSSE2, Required: GOARCH == "amd64"},
+ {Name: "sse2", Feature: &X86.HasSSE2, Required: GOARCH == "amd64" || GOARCH == "amd64p32"},
}
maxID, _, _, _ := cpuid(0, 0)