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 {...@@ -1526,10 +1526,12 @@ pub const Cpu = struct {
1526 };1526 };
1527 };1527 };
1528 return switch (arch) {1528 return switch (arch) {
1529 .arc => &arc.cpu.generic,
1529 .arm, .armeb, .thumb, .thumbeb => &arm.cpu.generic,1530 .arm, .armeb, .thumb, .thumbeb => &arm.cpu.generic,
1530 .aarch64, .aarch64_be => &aarch64.cpu.generic,1531 .aarch64, .aarch64_be => &aarch64.cpu.generic,
1531 .avr => &avr.cpu.avr2,1532 .avr => &avr.cpu.avr2,
1532 .bpfel, .bpfeb => &bpf.cpu.generic,1533 .bpfel, .bpfeb => &bpf.cpu.generic,
1534 .csky => &csky.cpu.generic,
1533 .hexagon => &hexagon.cpu.generic,1535 .hexagon => &hexagon.cpu.generic,
1534 .lanai => &lanai.cpu.generic,1536 .lanai => &lanai.cpu.generic,
1535 .loongarch32 => &loongarch.cpu.generic_la32,1537 .loongarch32 => &loongarch.cpu.generic_la32,
...@@ -1555,8 +1557,11 @@ pub const Cpu = struct {...@@ -1555,8 +1557,11 @@ pub const Cpu = struct {
1555 .ve => &ve.cpu.generic,1557 .ve => &ve.cpu.generic,
1556 .wasm32, .wasm64 => &wasm.cpu.generic,1558 .wasm32, .wasm64 => &wasm.cpu.generic,
1557 .xcore => &xcore.cpu.generic,1559 .xcore => &xcore.cpu.generic,
1560 .xtensa => &xtensa.cpu.generic,
15581561
1559 else => &S.generic_model,1562 .kalimba,
1563 .spu_2,
1564 => &S.generic_model,
1560 };1565 };
1561 }1566 }
15621567