To introduce SWAR (SIMD within-a-register) techniques in go, we’ll implement the simplest thing I can think of: checking if a string is ASCII. SWAR is the technique of operating over multiple datapoints within one register of the cpu. In our case one 64-bit variable will contain 8 bytes of our string so we can process 8 bytes at a time. We’ll do this in go without any C functions or assembly.
Intel’s latest generations of consumer CPUs have lost the ability to run AVX-512 instructions. Because they run a mix of powerful cores and low-power ‘Efficiency’ cores that don’t support AVX-512, the instruction have been disabled in the P-cores to prevent any problems with software that expects all cores to have the same instructions available. This is an irritation for someone who would like to have the convenience of running AVX-512 code on your own PC.