// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.

//go:build (386 && !gccgo && !noasm && !appengine) || (amd64 && !gccgo && !noasm && !appengine)
// +build 386,!gccgo,!noasm,!appengine amd64,!gccgo,!noasm,!appengine

package cpuid

func asmCpuid( uint32) (, , ,  uint32)
func asmCpuidex(,  uint32) (, , ,  uint32)
func asmXgetbv( uint32) (,  uint32)
func asmRdtscpAsm() (, , ,  uint32)
func asmDarwinHasAVX512() bool

func initCPU() {
	cpuid = asmCpuid
	cpuidex = asmCpuidex
	xgetbv = asmXgetbv
	rdtscpAsm = asmRdtscpAsm
	darwinHasAVX512 = asmDarwinHasAVX512
}

func addInfo( *CPUInfo,  bool) {
	.maxFunc = maxFunctionID()
	.maxExFunc = maxExtendedFunction()
	.BrandName = brandName()
	.CacheLine = cacheLine()
	.Family, .Model, .Stepping = familyModel()
	.featureSet = support()
	.SGX = hasSGX(.featureSet.inSet(SGX), .featureSet.inSet(SGXLC))
	.AMDMemEncryption = hasAMDMemEncryption(.featureSet.inSet(SME) || .featureSet.inSet(SEV))
	.ThreadsPerCore = threadsPerCore()
	.LogicalCores = logicalCores()
	.PhysicalCores = physicalCores()
	.VendorID, .VendorString = vendorID()
	.HypervisorVendorID, .HypervisorVendorString = hypervisorVendorID()
	.AVX10Level = .supportAVX10()
	.cacheSize()
	.frequencies()
	if .maxFunc >= 0x0A {
		, , ,  := cpuid(0x0A)
		.PMU = parseLeaf0AH(, , , )
	}
}

func getVectorLength() (,  uint64) { return 0, 0 }