Function baseline [src]
Returns a conservative CPU model for arch that 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, unlike generic.
For certain os values, this function will additionally bump the baseline higher than
the baseline would be for arch in isolation; for example, for aarch64-macos, the
baseline is considered to be apple_m1. To avoid this behavior entirely, pass
Os.Tag.freestanding.
Prototype
pub fn baseline(arch: Arch, os: Os) *const Model
Parameters
arch: Arch
os: Os
Source
pub fn baseline(arch: Arch, os: Os) *const Model {
return switch (arch) {
.amdgcn => &amdgcn.cpu.gfx906,
.arm, .armeb, .thumb, .thumbeb => &arm.cpu.baseline,
.aarch64 => switch (os.tag) {
.driverkit, .macos => &aarch64.cpu.apple_m1,
.ios, .tvos => &aarch64.cpu.apple_a7,
.visionos => &aarch64.cpu.apple_m2,
.watchos => &aarch64.cpu.apple_s4,
else => generic(arch),
},
.avr => &avr.cpu.avr2,
.bpfel, .bpfeb => &bpf.cpu.v1,
.csky => &csky.cpu.ck810, // gcc/clang do not have a generic csky model.
.hexagon => &hexagon.cpu.hexagonv60, // gcc/clang do not have a generic hexagon model.
.lanai => &lanai.cpu.v11, // clang does not have a generic lanai model.
.loongarch64 => &loongarch.cpu.loongarch64,
.m68k => &m68k.cpu.M68000,
.mips, .mipsel => &mips.cpu.mips32r2,
.mips64, .mips64el => &mips.cpu.mips64r2,
.msp430 => &msp430.cpu.msp430,
.nvptx, .nvptx64 => &nvptx.cpu.sm_52,
.powerpc64le => &powerpc.cpu.ppc64le,
.riscv32 => &riscv.cpu.baseline_rv32,
.riscv64 => &riscv.cpu.baseline_rv64,
.s390x => &s390x.cpu.arch8, // gcc/clang do not have a generic s390x model.
.sparc => &sparc.cpu.v9, // glibc does not work with 'plain' v8.
.x86 => &x86.cpu.pentium4,
.x86_64 => switch (os.tag) {
.driverkit => &x86.cpu.nehalem,
.ios, .macos, .tvos, .visionos, .watchos => &x86.cpu.core2,
.ps4 => &x86.cpu.btver2,
.ps5 => &x86.cpu.znver2,
else => generic(arch),
},
.xcore => &xcore.cpu.xs1b_generic,
.wasm32, .wasm64 => &wasm.cpu.lime1,
else => generic(arch),
};
}