authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-08-19 11:49:02-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-08-19 11:49:02-07:00
log7071d1b3c2ed908bb8f1170673b50568ed56da7b
tree9abf79c366354622d41e2e538c21453286108c14
parent82b676ef798f8d7ae91af2f87dff0ffbfa0b4644
signaturebadge-check Signed by PGP key B5690EEEBB952194

std: add native cpu detection for apple m3 (#21116)

* std.c.darwin: add missing CPUFAMILY fields * std.zig.system.detectNativeCpuAndFeatures: add missing darwin fields * add comment so the prong isnt lost and easily discoverable during next llvm upgrade

2 files changed, 10 insertions(+), 0 deletions(-)

lib/std/c/darwin.zig+5
......@@ -1156,6 +1156,11 @@ pub const CPUFAMILY = enum(u32) {
11561156 ARM_FIRESTORM_ICESTORM = 0x1b588bb3,
11571157 ARM_BLIZZARD_AVALANCHE = 0xda33d83d,
11581158 ARM_EVEREST_SAWTOOTH = 0x8765edea,
1159 ARM_COLL = 0x2876f5b5,
1160 ARM_IBIZA = 0xfa33415e,
1161 ARM_LOBOS = 0x5f4dea93,
1162 ARM_PALMA = 0x72015832,
1163 ARM_DONAN = 0x6f5129ac,
11591164 _,
11601165};
11611166
lib/std/zig/system/darwin/macos.zig+5
......@@ -419,6 +419,11 @@ pub fn detectNativeCpuAndFeatures() ?Target.Cpu {
419419 .ARM_TYPHOON => &Target.aarch64.cpu.apple_a8,
420420 .ARM_CYCLONE => &Target.aarch64.cpu.cyclone,
421421 else => return null,
422 .ARM_COLL => &Target.aarch64.cpu.apple_a17,
423 .ARM_IBIZA => &Target.aarch64.cpu.apple_m3, // base
424 .ARM_LOBOS => &Target.aarch64.cpu.apple_m3, // pro
425 .ARM_PALMA => &Target.aarch64.cpu.apple_m3, // max
426 // .ARM_DONAN => &Target.aarch64.cpu.apple_m4, // decl not available until llvm 19
422427 };
423428
424429 return Target.Cpu{