diff --git a/lib/std/Target.zig b/lib/std/Target.zig index 36c7c522fb..53cbd49e31 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -616,7 +616,9 @@ pub const Os = struct { .psp => .{ .semver = .{ - .min = .{ .major = 1, .minor = 0, .patch = 0 }, + // https://www.psdevwiki.com/psp/Official_Firmware_(OFW)#1.XX_Kernel + // 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) + .min = .{ .major = 1, .minor = 0, .patch = 3 }, .max = .{ .major = 6, .minor = 61, .patch = 0 }, }, }, @@ -2034,7 +2036,7 @@ pub const Cpu = struct { .loongarch64 => &loongarch.cpu.la64v1_0, .m68k => &m68k.cpu.M68000, .mips, .mipsel => switch (os.tag) { - .psp => &mips.cpu.mips2, // mips2 with some custom instructions, no trap instructions + .psp => &mips.cpu.allegrex, else => &mips.cpu.mips32r2, }, .mips64, .mips64el => &mips.cpu.mips64r2, diff --git a/lib/std/Target/mips.zig b/lib/std/Target/mips.zig index fb6bb1abab..2a1bedd713 100644 --- a/lib/std/Target/mips.zig +++ b/lib/std/Target/mips.zig @@ -49,6 +49,7 @@ pub const Feature = enum { noabicalls, nomadd4, nooddspreg, + notraps, p5600, ptr64, single_float, @@ -353,6 +354,11 @@ pub const all_features = blk: { .description = "Disable odd numbered single-precision registers", .dependencies = featureSet(&[_]Feature{}), }; + result[@intFromEnum(Feature.notraps)] = .{ + .llvm_name = null, + .description = "Disable trap instructions", + .dependencies = featureSet(&[_]Feature{}), + }; result[@intFromEnum(Feature.p5600)] = .{ .llvm_name = "p5600", .description = "The P5600 Processor", @@ -419,6 +425,15 @@ pub const all_features = blk: { }; pub const cpu = struct { + pub const allegrex: CpuModel = .{ + .name = "allegrex", + .llvm_name = null, + .features = featureSet(&[_]Feature{ + .mips2, + .notraps, + .single_float, + }), + }; pub const generic: CpuModel = .{ .name = "generic", .llvm_name = "generic", diff --git a/tools/update_cpu_features.zig b/tools/update_cpu_features.zig index eaa6a9afd2..636f45fa86 100644 --- a/tools/update_cpu_features.zig +++ b/tools/update_cpu_features.zig @@ -1299,6 +1299,20 @@ const targets = [_]ArchTarget{ .name = "Mips", .td_name = "Mips", }, + .extra_features = &.{ + .{ + .zig_name = "notraps", + .desc = "Disable trap instructions", + .deps = &.{}, + }, + }, + .extra_cpus = &.{ + .{ + .llvm_name = null, + .zig_name = "allegrex", + .features = &.{ "mips2", "single_float", "notraps" }, + }, + }, }, .{ .zig_name = "nvptx",