pub fn baseline(arch: Arch, os: Os) *const Model {
return switch (arch) {
.alpha => &alpha.cpu.ev6,
.amdgcn => &amdgcn.cpu.gfx906,
.arm => switch (os.tag) {
.@"3ds" => &arm.cpu.mpcore,
.vita => &arm.cpu.cortex_a9,
.gba => &arm.cpu.arm7tdmi,
else => &arm.cpu.baseline,
},
.thumb => switch (os.tag) {
.vita => &arm.cpu.cortex_a9,
.gba => &arm.cpu.arm7tdmi,
else => &arm.cpu.baseline,
},
.armeb, .thumbeb => &arm.cpu.baseline,
.aarch64 => switch (os.tag) {
.haiku => &aarch64.cpu.cortex_a55,
.driverkit, .maccatalyst, .macos => &aarch64.cpu.apple_m1,
.ios, .tvos => &aarch64.cpu.apple_a7,
.visionos => &aarch64.cpu.apple_m2,
.watchos => &aarch64.cpu.apple_s4,
.@"switch" => &aarch64.cpu.cortex_a57,
else => generic(arch),
},
.avr => &avr.cpu.avr2,
.bpfel, .bpfeb => &bpf.cpu.v3,
.csky => &csky.cpu.ck810, // gcc/clang do not have a generic csky model.
.hexagon => &hexagon.cpu.hexagonv68, // gcc/clang do not have a generic hexagon model.
.hppa => &hppa.cpu.pa_7300lc,
.kvx => &kvx.cpu.coolidge_v2,
.lanai => &lanai.cpu.v11, // clang does not have a generic lanai model.
.loongarch32 => &loongarch.cpu.la32v1_0,
.loongarch64 => &loongarch.cpu.la64v1_0,
.m68k => &m68k.cpu.M68030,
.mips => &mips.cpu.mips32r2,
.mipsel => switch (os.tag) {
.psx => &mips.cpu.r3000a,
.psp => &mips.cpu.allegrex,
else => &mips.cpu.mips32r2,
},
.mips64 => switch (os.tag) {
.openbsd => &mips.cpu.octeon,
else => &mips.cpu.mips64r2,
},
.mips64el => &mips.cpu.mips64r2,
.msp430 => &msp430.cpu.msp430,
.nvptx, .nvptx64 => &nvptx.cpu.sm_52,
.powerpc => switch (os.tag) {
.openbsd, .wiiu => &powerpc.cpu.@"750",
else => generic(arch),
},
.powerpc64 => switch (os.tag) {
.linux, .freebsd => &powerpc.cpu.pwr8,
.openbsd => &powerpc.cpu.pwr9,
else => generic(arch),
},
.powerpc64le => &powerpc.cpu.ppc64le,
.riscv32, .riscv32be => &riscv.cpu.baseline_rv32,
.riscv64, .riscv64be => &riscv.cpu.baseline_rv64,
.s390x => &s390x.cpu.arch11,
.sparc => switch (os.tag) {
.linux => &sparc.cpu.v9, // glibc does not work with 'plain' v8.
else => generic(arch),
},
.sparc64 => &sparc.cpu.ultrasparc,
.x86 => &x86.cpu.pentium4,
.x86_64 => switch (os.tag) {
.driverkit, .maccatalyst => &x86.cpu.nehalem,
.macos => &x86.cpu.core2,
.ps4 => &x86.cpu.btver2,
.ps5 => &x86.cpu.znver2,
else => generic(arch),
},
.xcore => &xcore.cpu.xs1b_generic,
.xtensa => &xtensa.cpu.esp32,
.wasm32, .wasm64 => &wasm.cpu.lime1,
else => generic(arch),
};
}
Returns a conservative CPU model for
archthat is expected to be compatible with the vast majority of hardware available. This function is guaranteed to return CPU models that are understood by both LLVM and Clang, unlikegeneric.For certain
osvalues, this function will additionally bump the baseline higher than the baseline would be forarchin isolation; for example, foraarch64-macos, the baseline is considered to beapple_m1. To avoid this behavior entirely, passOs.Tag.freestanding.