Debian Codegraph @

simd/cpu_amd64.go

raw symbols SCIP
1 //go:build amd64
2
3 package simd
4
5 import (
6 "golang.org/x/sys/cpu"
7 )
8
9 // hasAVX2 gates every AVX2 kernel in this package. golang.org/x/sys/cpu
10 // verifies both the CPU capability and OS support for saving the YMM
11 // register state, and the value is read once at init so the per-call
12 // dispatch is a single predictable branch.
13 var hasAVX2 = cpu.X86.HasAVX2
14
15 // hasPOPCNT gates countNonASCIIAVX2, the one kernel that reaches outside
16 // the AVX/AVX2 instruction set: it turns each vector's high-bit mask into
17 // a lane count with POPCNT, whose CPUID bit (01H:ECX[23]) is independent
18 // of AVX2's. Every shipping AVX2 part has POPCNT, but a hypervisor can
19 // mask the two separately, and an ungated POPCNT would be SIGILL rather
20 // than a fallback — so the count dispatch checks both and drops to the
21 // SWAR path if either is missing.
22 var hasPOPCNT = cpu.X86.HasPOPCNT