genericCpuAndNativeFeatures
If the fine-grained detection of CPU features via Win registry fails,
we fallback to a generic CPU model but we override the feature set
using SharedUserData contents.
This is effectively what LLVM does for all ARM chips on Windows.
Function parameters
Parameters
- arch:Target.Cpu.Arch
Type definitions in this namespace
Types
Functions in this namespace
Functions
- detectRuntimeVersion
- Returns the highest known WindowsVersion deduced from reported runtime information.
Source
Implementation
fn genericCpuAndNativeFeatures(arch: Target.Cpu.Arch) Target.Cpu {
var cpu = Target.Cpu{
.arch = arch,
.model = Target.Cpu.Model.generic(arch),
.features = Target.Cpu.Feature.Set.empty,
};
switch (arch) {
.aarch64, .aarch64_be => {
const Feature = Target.aarch64.Feature;
// Override any features that are either present or absent
setFeature(Feature, &cpu, .neon, IsProcessorFeaturePresent(PF.ARM_NEON_INSTRUCTIONS_AVAILABLE));
setFeature(Feature, &cpu, .crc, IsProcessorFeaturePresent(PF.ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE));
setFeature(Feature, &cpu, .crypto, IsProcessorFeaturePresent(PF.ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE));
setFeature(Feature, &cpu, .lse, IsProcessorFeaturePresent(PF.ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE));
setFeature(Feature, &cpu, .dotprod, IsProcessorFeaturePresent(PF.ARM_V82_DP_INSTRUCTIONS_AVAILABLE));
setFeature(Feature, &cpu, .jsconv, IsProcessorFeaturePresent(PF.ARM_V83_JSCVT_INSTRUCTIONS_AVAILABLE));
},
else => {},
}
return cpu;
}