var PPC64 ppc64
-// For ppc64x, it is safe to check only for ISA level starting on ISA v3.00,
+// For ppc64(le), it is safe to check only for ISA level starting on ISA v3.00,
// since there are no optional categories. There are some exceptions that also
// require kernel support to work (darn, scv), so there are feature bits for
-// those as well. The minimum processor requirement is POWER8 (ISA 2.07), so we
-// maintain some of the old feature checks for optional categories for
-// safety.
+// those as well. The minimum processor requirement is POWER8 (ISA 2.07).
// The struct is padded to avoid false sharing.
type ppc64 struct {
- _ CacheLinePad
- HasVMX bool // Vector unit (Altivec)
- HasDFP bool // Decimal Floating Point unit
- HasVSX bool // Vector-scalar unit
- HasHTM bool // Hardware Transactional Memory
- HasISEL bool // Integer select
- HasVCRYPTO bool // Vector cryptography
- HasHTMNOSC bool // HTM: kernel-aborted transaction in syscalls
- HasDARN bool // Hardware random number generator (requires kernel enablement)
- HasSCV bool // Syscall vectored (requires kernel enablement)
- IsPOWER8 bool // ISA v2.07 (POWER8)
- IsPOWER9 bool // ISA v3.00 (POWER9)
- _ CacheLinePad
+ _ CacheLinePad
+ HasDARN bool // Hardware random number generator (requires kernel enablement)
+ HasSCV bool // Syscall vectored (requires kernel enablement)
+ IsPOWER8 bool // ISA v2.07 (POWER8)
+ IsPOWER9 bool // ISA v3.00 (POWER9)
+ _ CacheLinePad
}
var ARM arm
_PPC_FEATURE2_ARCH_3_00 = 0x00800000
// CPU features
- _PPC_FEATURE_HAS_ALTIVEC = 0x10000000
- _PPC_FEATURE_HAS_DFP = 0x00000400
- _PPC_FEATURE_HAS_VSX = 0x00000080
- _PPC_FEATURE2_HAS_HTM = 0x40000000
- _PPC_FEATURE2_HAS_ISEL = 0x08000000
- _PPC_FEATURE2_HAS_VEC_CRYPTO = 0x02000000
- _PPC_FEATURE2_HTM_NOSC = 0x01000000
- _PPC_FEATURE2_DARN = 0x00200000
- _PPC_FEATURE2_SCV = 0x00100000
+ _PPC_FEATURE2_DARN = 0x00200000
+ _PPC_FEATURE2_SCV = 0x00100000
)
func doinit() {
options = []option{
- {Name: "htm", Feature: &PPC64.HasHTM},
- {Name: "htmnosc", Feature: &PPC64.HasHTMNOSC},
{Name: "darn", Feature: &PPC64.HasDARN},
{Name: "scv", Feature: &PPC64.HasSCV},
+ {Name: "power9", Feature: &PPC64.IsPOWER9},
// These capabilities should always be enabled on ppc64 and ppc64le:
{Name: "power8", Feature: &PPC64.IsPOWER8, Required: true},
- {Name: "vmx", Feature: &PPC64.HasVMX, Required: true},
- {Name: "dfp", Feature: &PPC64.HasDFP, Required: true},
- {Name: "vsx", Feature: &PPC64.HasVSX, Required: true},
- {Name: "isel", Feature: &PPC64.HasISEL, Required: true},
- {Name: "vcrypto", Feature: &PPC64.HasVCRYPTO, Required: true},
}
- // HWCAP feature bits
- PPC64.HasVMX = isSet(HWCap, _PPC_FEATURE_HAS_ALTIVEC)
- PPC64.HasDFP = isSet(HWCap, _PPC_FEATURE_HAS_DFP)
- PPC64.HasVSX = isSet(HWCap, _PPC_FEATURE_HAS_VSX)
-
// HWCAP2 feature bits
PPC64.IsPOWER8 = isSet(HWCap2, _PPC_FEATURE2_ARCH_2_07)
- PPC64.HasHTM = isSet(HWCap2, _PPC_FEATURE2_HAS_HTM)
- PPC64.HasISEL = isSet(HWCap2, _PPC_FEATURE2_HAS_ISEL)
- PPC64.HasVCRYPTO = isSet(HWCap2, _PPC_FEATURE2_HAS_VEC_CRYPTO)
- PPC64.HasHTMNOSC = isSet(HWCap2, _PPC_FEATURE2_HTM_NOSC)
PPC64.IsPOWER9 = isSet(HWCap2, _PPC_FEATURE2_ARCH_3_00)
PPC64.HasDARN = isSet(HWCap2, _PPC_FEATURE2_DARN)
PPC64.HasSCV = isSet(HWCap2, _PPC_FEATURE2_SCV)