File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22// Use of this source code is governed by a BSD-style
33// license that can be found in the LICENSE file.
44
5- //go:build !darwin && !linux && !netbsd && !openbsd && arm64
5+ //go:build !darwin && !linux && !netbsd && !openbsd && !windows && arm64
66
77package cpu
88
Original file line number Diff line number Diff line change 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+ //go:generate go run golang.org/x/sys/windows/mkwinsyscall -systemdll=false -output zcpu_windows.go cpu_windows.go
8+
9+ //sys isProcessorFeaturePresent(ProcessorFeature uint32) (ret bool) = kernel32.IsProcessorFeaturePresent
10+
11+ // The processor features to be tested for IsProcessorFeaturePresent, see
12+ // https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-isprocessorfeaturepresent
13+ const (
14+ _PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE = 30
15+ _PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE = 31
16+ _PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE = 34
17+ _PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE = 43
18+
19+ _PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE = 44
20+ _PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE = 45
21+ _PF_ARM_SVE_INSTRUCTIONS_AVAILABLE = 46
22+ _PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE = 47
23+
24+ _PF_ARM_SHA3_INSTRUCTIONS_AVAILABLE = 64
25+ _PF_ARM_SHA512_INSTRUCTIONS_AVAILABLE = 65
26+ )
Original file line number Diff line number Diff line change 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+ func doinit () {
8+ // set HasASIMD and HasFP to true as per
9+ // https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#base-requirements
10+ //
11+ // The ARM64 version of Windows always presupposes that it's running on an ARMv8 or later architecture.
12+ // Both floating-point and NEON support are presumed to be present in hardware.
13+ //
14+ ARM64 .HasASIMD = true
15+ ARM64 .HasFP = true
16+
17+ if isProcessorFeaturePresent (_PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE ) {
18+ ARM64 .HasAES = true
19+ ARM64 .HasPMULL = true
20+ ARM64 .HasSHA1 = true
21+ ARM64 .HasSHA2 = true
22+ }
23+ ARM64 .HasSHA3 = isProcessorFeaturePresent (_PF_ARM_SHA3_INSTRUCTIONS_AVAILABLE )
24+ ARM64 .HasCRC32 = isProcessorFeaturePresent (_PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE )
25+ ARM64 .HasSHA512 = isProcessorFeaturePresent (_PF_ARM_SHA512_INSTRUCTIONS_AVAILABLE )
26+ ARM64 .HasATOMICS = isProcessorFeaturePresent (_PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE )
27+ if isProcessorFeaturePresent (_PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE ) {
28+ ARM64 .HasASIMDDP = true
29+ ARM64 .HasASIMDRDM = true
30+ }
31+ if isProcessorFeaturePresent (_PF_ARM_V83_LRCPC_INSTRUCTIONS_AVAILABLE ) {
32+ ARM64 .HasLRCPC = true
33+ ARM64 .HasSM3 = true
34+ }
35+ ARM64 .HasSVE = isProcessorFeaturePresent (_PF_ARM_SVE_INSTRUCTIONS_AVAILABLE )
36+ ARM64 .HasSVE2 = isProcessorFeaturePresent (_PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE )
37+ ARM64 .HasJSCVT = isProcessorFeaturePresent (_PF_ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE )
38+ }
You can’t perform that action at this time.
0 commit comments