authorgravatar for iridescentrosesfall@gmail.comNathan Bourgeois <iridescentrosesfall@gmail.com> 2026-03-21 19:39:04-04:00
committergravatar for iridescentrosesfall@gmail.comNathan Bourgeois <iridescentrosesfall@gmail.com> 2026-03-21 19:39:04-04:00
logc824ce954ee81d438613ea7cf1e9a8111f730732
tree1dd798b3bc97a5200ddf23e9bd7fd43bad29fe64
parent2037dba90f5815f6fc3137c2485e908700c009e5

misc: Add allegrex CPU & features, run tool, update semver


3 files changed, 33 insertions(+), 2 deletions(-)

lib/std/Target.zig+4-2
......@@ -616,7 +616,9 @@ pub const Os = struct {
616616
617617 .psp => .{
618618 .semver = .{
619 .min = .{ .major = 1, .minor = 0, .patch = 0 },
619 // https://www.psdevwiki.com/psp/Official_Firmware_(OFW)#1.XX_Kernel
620 // It appears that the kernel started with semver for 1.XX before later changing to MAJ.MINPATCH in later releases (e.g. 3.60, 6.61)
621 .min = .{ .major = 1, .minor = 0, .patch = 3 },
620622 .max = .{ .major = 6, .minor = 61, .patch = 0 },
621623 },
622624 },
......@@ -2034,7 +2036,7 @@ pub const Cpu = struct {
20342036 .loongarch64 => &loongarch.cpu.la64v1_0,
20352037 .m68k => &m68k.cpu.M68000,
20362038 .mips, .mipsel => switch (os.tag) {
2037 .psp => &mips.cpu.mips2, // mips2 with some custom instructions, no trap instructions
2039 .psp => &mips.cpu.allegrex,
20382040 else => &mips.cpu.mips32r2,
20392041 },
20402042 .mips64, .mips64el => &mips.cpu.mips64r2,
lib/std/Target/mips.zig+15
......@@ -49,6 +49,7 @@ pub const Feature = enum {
4949 noabicalls,
5050 nomadd4,
5151 nooddspreg,
52 notraps,
5253 p5600,
5354 ptr64,
5455 single_float,
......@@ -353,6 +354,11 @@ pub const all_features = blk: {
353354 .description = "Disable odd numbered single-precision registers",
354355 .dependencies = featureSet(&[_]Feature{}),
355356 };
357 result[@intFromEnum(Feature.notraps)] = .{
358 .llvm_name = null,
359 .description = "Disable trap instructions",
360 .dependencies = featureSet(&[_]Feature{}),
361 };
356362 result[@intFromEnum(Feature.p5600)] = .{
357363 .llvm_name = "p5600",
358364 .description = "The P5600 Processor",
......@@ -419,6 +425,15 @@ pub const all_features = blk: {
419425};
420426
421427pub const cpu = struct {
428 pub const allegrex: CpuModel = .{
429 .name = "allegrex",
430 .llvm_name = null,
431 .features = featureSet(&[_]Feature{
432 .mips2,
433 .notraps,
434 .single_float,
435 }),
436 };
422437 pub const generic: CpuModel = .{
423438 .name = "generic",
424439 .llvm_name = "generic",
tools/update_cpu_features.zig+14
......@@ -1299,6 +1299,20 @@ const targets = [_]ArchTarget{
12991299 .name = "Mips",
13001300 .td_name = "Mips",
13011301 },
1302 .extra_features = &.{
1303 .{
1304 .zig_name = "notraps",
1305 .desc = "Disable trap instructions",
1306 .deps = &.{},
1307 },
1308 },
1309 .extra_cpus = &.{
1310 .{
1311 .llvm_name = null,
1312 .zig_name = "allegrex",
1313 .features = &.{ "mips2", "single_float", "notraps" },
1314 },
1315 },
13021316 },
13031317 .{
13041318 .zig_name = "nvptx",