authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-01 06:37:25+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-03 05:01:24+02:00
log7d71e794dd22e4c2a38d3aafd4fc604b36d2ac5e
tree1124c1b92e5828ca1d7fddb65233f422717b613b
parentcb1ac0bb2fb95424118404160704d53a3ff2a2c0
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.Target: Fix Cpu.Model.generic() for arc, csky, and xtensa.

Only targets for which we don't source CPU models/features from LLVM should use the fallback prong in this switch. Also make it exhaustive to catch similar mistakes in the future.

1 files changed, 6 insertions(+), 1 deletions(-)

lib/std/Target.zig+6-1
......@@ -1526,10 +1526,12 @@ pub const Cpu = struct {
15261526 };
15271527 };
15281528 return switch (arch) {
1529 .arc => &arc.cpu.generic,
15291530 .arm, .armeb, .thumb, .thumbeb => &arm.cpu.generic,
15301531 .aarch64, .aarch64_be => &aarch64.cpu.generic,
15311532 .avr => &avr.cpu.avr2,
15321533 .bpfel, .bpfeb => &bpf.cpu.generic,
1534 .csky => &csky.cpu.generic,
15331535 .hexagon => &hexagon.cpu.generic,
15341536 .lanai => &lanai.cpu.generic,
15351537 .loongarch32 => &loongarch.cpu.generic_la32,
......@@ -1555,8 +1557,11 @@ pub const Cpu = struct {
15551557 .ve => &ve.cpu.generic,
15561558 .wasm32, .wasm64 => &wasm.cpu.generic,
15571559 .xcore => &xcore.cpu.generic,
1560 .xtensa => &xtensa.cpu.generic,
15581561
1559 else => &S.generic_model,
1562 .kalimba,
1563 .spu_2,
1564 => &S.generic_model,
15601565 };
15611566 }
15621567