1 // Copyright 2026 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4 5 package cpu
6 7 import (
8 "golang.org/x/sys/windows"
9 )
10 11 func doinit() {
12 // set HasASIMD and HasFP to true as per
13 // https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#base-requirements
14 //
15 // The ARM64 version of Windows always presupposes that it's running on an ARMv8 or later architecture.
16 // Both floating-point and NEON support are presumed to be present in hardware.
17 //
18 ARM64.HasASIMD = true
19 ARM64.HasFP = true
20 21 if windows.IsProcessorFeaturePresent(windows.PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) {
22 ARM64.HasAES = true
23 ARM64.HasPMULL = true
24 ARM64.HasSHA1 = true
25 ARM64.HasSHA2 = true
26 }
27 ARM64.HasSHA3 = windows.IsProcessorFeaturePresent(windows.PF_ARM_SHA3_INSTRUCTIONS_AVAILABLE)
28 ARM64.HasCRC32 = windows.IsProcessorFeaturePresent(windows.PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE)
29 ARM64.HasSHA512 = windows.IsProcessorFeaturePresent(windows.PF_ARM_SHA512_INSTRUCTIONS_AVAILABLE)
30 ARM64.HasATOMICS = windows.IsProcessorFeaturePresent(windows.PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE)
31 if windows.IsProcessorFeaturePresent(windows.PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE) {
32 ARM64.HasASIMDDP = true
33 ARM64.HasASIMDRDM = true
34 }
35 if windows.IsProcessorFeaturePresent(windows.PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE) {
36 ARM64.HasLRCPC = true
37 ARM64.HasSM3 = true
38 }
39 ARM64.HasSVE = windows.IsProcessorFeaturePresent(windows.PF_ARM_SVE_INSTRUCTIONS_AVAILABLE)
40 ARM64.HasSVE2 = windows.IsProcessorFeaturePresent(windows.PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE)
41 ARM64.HasJSCVT = windows.IsProcessorFeaturePresent(windows.PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE)
42 }
43