| ... | ... | @@ -75,6 +75,7 @@ pub fn detectNativeCpuAndFeatures(arch: Target.Cpu.Arch, os: Target.Os, query: T |
| 75 | 75 | if (switch (vendor) { |
| 76 | 76 | 0x756e6547 => detectIntelProcessor(&cpu, family, model, brand_id), |
| 77 | 77 | 0x68747541 => detectAmdProcessor(&cpu, family, model), |
| 78 | 0x6f677948 => detectHygonProcessor(family, model), |
| 78 | 79 | else => null, |
| 79 | 80 | }) |m| b: { |
| 80 | 81 | // Some hypervisors are evil liars and will operate in long mode while identifying as a |
| ... | ... | @@ -218,6 +219,19 @@ fn detectAmdProcessor(cpu: *const Target.Cpu, family: u32, model: u32) ?*const T |
| 218 | 219 | }; |
| 219 | 220 | } |
| 220 | 221 | |
| 222 | fn detectHygonProcessor(family: u32, model: u32) ?*const Target.Cpu.Model { |
| 223 | return switch (family) { |
| 224 | 24 => switch (model) { |
| 225 | 4 => &Target.x86.cpu.c86_4g_m4, |
| 226 | 6 => &Target.x86.cpu.c86_4g_m6, |
| 227 | 7 => &Target.x86.cpu.c86_4g_m7, |
| 228 | 8 => &Target.x86.cpu.c86_4g_m8, |
| 229 | else => null, |
| 230 | }, |
| 231 | else => null, |
| 232 | }; |
| 233 | } |
| 234 | |
| 221 | 235 | fn detectNativeFeatures(cpu: *Target.Cpu, os_tag: Target.Os.Tag) void { |
| 222 | 236 | var leaf = cpuid(0, 0); |
| 223 | 237 | |