Commit 7071d1b3c2

Meghan Denny <hello@nektro.net>
2024-08-19 20:49:02
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
1 parent 82b676e
Changed files (2)
lib
std
c
zig
system
darwin
lib/std/c/darwin.zig
@@ -1156,6 +1156,11 @@ pub const CPUFAMILY = enum(u32) {
     ARM_FIRESTORM_ICESTORM = 0x1b588bb3,
     ARM_BLIZZARD_AVALANCHE = 0xda33d83d,
     ARM_EVEREST_SAWTOOTH = 0x8765edea,
+    ARM_COLL = 0x2876f5b5,
+    ARM_IBIZA = 0xfa33415e,
+    ARM_LOBOS = 0x5f4dea93,
+    ARM_PALMA = 0x72015832,
+    ARM_DONAN = 0x6f5129ac,
     _,
 };
 
lib/std/zig/system/darwin/macos.zig
@@ -419,6 +419,11 @@ pub fn detectNativeCpuAndFeatures() ?Target.Cpu {
                 .ARM_TYPHOON => &Target.aarch64.cpu.apple_a8,
                 .ARM_CYCLONE => &Target.aarch64.cpu.cyclone,
                 else => return null,
+                .ARM_COLL => &Target.aarch64.cpu.apple_a17,
+                .ARM_IBIZA => &Target.aarch64.cpu.apple_m3, // base
+                .ARM_LOBOS => &Target.aarch64.cpu.apple_m3, // pro
+                .ARM_PALMA => &Target.aarch64.cpu.apple_m3, // max
+                // .ARM_DONAN => &Target.aarch64.cpu.apple_m4, // decl not available until llvm 19
             };
 
             return Target.Cpu{