Skip to content

Commit 7071d1b

Browse files
authored
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 commit 7071d1b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/std/c/darwin.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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{

0 commit comments

Comments
 (0)