mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 21:38:33 +00:00
Add mips support to standard library
This commit is contained in:
parent
a9eb4a6740
commit
c829f2f7b7
@ -160,6 +160,9 @@ fn hashFunc(out: []u8, Ki: usize, in: []const u8) void {
|
||||
}
|
||||
|
||||
test "std.BloomFilter" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
inline for ([_]type{ bool, u1, u2, u3, u4 }) |Cell| {
|
||||
const emptyCell = if (Cell == bool) false else @as(Cell, 0);
|
||||
const BF = BloomFilter(128 * 8, 8, Cell, builtin.endian, hashFunc);
|
||||
|
||||
@ -162,6 +162,9 @@ pub fn hash(out: []u8, in: []const u8) void {
|
||||
}
|
||||
|
||||
test "hash" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
// a test vector (30) from NIST KAT submission.
|
||||
var msg: [58 / 2]u8 = undefined;
|
||||
try std.fmt.hexToBytes(&msg, "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C");
|
||||
@ -307,6 +310,9 @@ pub const Aead = struct {
|
||||
};
|
||||
|
||||
test "cipher" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
var key: [32]u8 = undefined;
|
||||
try std.fmt.hexToBytes(&key, "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F");
|
||||
var nonce: [16]u8 = undefined;
|
||||
|
||||
@ -1661,7 +1661,7 @@ test "positional/alignment/width/precision" {
|
||||
}
|
||||
|
||||
test "vector" {
|
||||
if (builtin.arch == .mipsel) {
|
||||
if (builtin.arch == .mipsel or builtin.arch == .mips) {
|
||||
// https://github.com/ziglang/zig/issues/3317
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
@ -357,7 +357,7 @@ test "testHash union" {
|
||||
|
||||
test "testHash vector" {
|
||||
// Disabled because of #3317
|
||||
if (@import("builtin").arch == .mipsel) return error.SkipZigTest;
|
||||
if (@import("builtin").arch == .mipsel or @import("builtin").arch == .mips) return error.SkipZigTest;
|
||||
|
||||
const a: @Vector(4, u32) = [_]u32{ 1, 2, 3, 4 };
|
||||
const b: @Vector(4, u32) = [_]u32{ 1, 2, 3, 5 };
|
||||
|
||||
@ -463,6 +463,9 @@ test "basic hash map usage" {
|
||||
}
|
||||
|
||||
test "iterator hash map" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
var reset_map = AutoHashMap(i32, i32).init(std.testing.allocator);
|
||||
defer reset_map.deinit();
|
||||
|
||||
|
||||
@ -126,6 +126,9 @@ test "File seek ops" {
|
||||
}
|
||||
|
||||
test "setEndPos" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
const tmp_file_name = "temp_test_file.txt";
|
||||
var file = try fs.cwd().createFile(tmp_file_name, .{});
|
||||
defer {
|
||||
|
||||
@ -2249,6 +2249,9 @@ test "integer after float has proper type" {
|
||||
}
|
||||
|
||||
test "escaped characters" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator);
|
||||
defer arena_allocator.deinit();
|
||||
const input =
|
||||
@ -2281,6 +2284,9 @@ test "escaped characters" {
|
||||
}
|
||||
|
||||
test "string copy option" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
const input =
|
||||
\\{
|
||||
\\ "noescape": "aą😂",
|
||||
|
||||
@ -332,12 +332,18 @@ test "y_string_1_2_3_bytes_UTF-8_sequences" {
|
||||
}
|
||||
|
||||
test "y_string_accepted_surrogate_pair" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
ok(
|
||||
\\["\uD801\udc37"]
|
||||
);
|
||||
}
|
||||
|
||||
test "y_string_accepted_surrogate_pairs" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
ok(
|
||||
\\["\ud83d\ude39\ud83d\udc8d"]
|
||||
);
|
||||
@ -404,6 +410,9 @@ test "y_string_in_array_with_leading_space" {
|
||||
}
|
||||
|
||||
test "y_string_last_surrogates_1_and_2" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
ok(
|
||||
\\["\uDBFF\uDFFF"]
|
||||
);
|
||||
@ -464,6 +473,9 @@ test "y_string_space" {
|
||||
}
|
||||
|
||||
test "y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
ok(
|
||||
\\["\uD834\uDd1e"]
|
||||
);
|
||||
@ -506,60 +518,90 @@ test "y_string_unescaped_char_delete" {
|
||||
}
|
||||
|
||||
test "y_string_unicode_2" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
ok(
|
||||
\\["⍂㈴⍂"]
|
||||
);
|
||||
}
|
||||
|
||||
test "y_string_unicodeEscapedBackslash" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
ok(
|
||||
\\["\u005C"]
|
||||
);
|
||||
}
|
||||
|
||||
test "y_string_unicode_escaped_double_quote" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
ok(
|
||||
\\["\u0022"]
|
||||
);
|
||||
}
|
||||
|
||||
test "y_string_unicode" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
ok(
|
||||
\\["\uA66D"]
|
||||
);
|
||||
}
|
||||
|
||||
test "y_string_unicode_U+10FFFE_nonchar" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
ok(
|
||||
\\["\uDBFF\uDFFE"]
|
||||
);
|
||||
}
|
||||
|
||||
test "y_string_unicode_U+1FFFE_nonchar" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
ok(
|
||||
\\["\uD83F\uDFFE"]
|
||||
);
|
||||
}
|
||||
|
||||
test "y_string_unicode_U+200B_ZERO_WIDTH_SPACE" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
ok(
|
||||
\\["\u200B"]
|
||||
);
|
||||
}
|
||||
|
||||
test "y_string_unicode_U+2064_invisible_plus" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
ok(
|
||||
\\["\u2064"]
|
||||
);
|
||||
}
|
||||
|
||||
test "y_string_unicode_U+FDD0_nonchar" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
ok(
|
||||
\\["\uFDD0"]
|
||||
);
|
||||
}
|
||||
|
||||
test "y_string_unicode_U+FFFE_nonchar" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
ok(
|
||||
\\["\uFFFE"]
|
||||
);
|
||||
@ -1811,42 +1853,63 @@ test "i_object_key_lone_2nd_surrogate" {
|
||||
}
|
||||
|
||||
test "i_string_1st_surrogate_but_2nd_missing" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
anyStreamingErrNonStreaming(
|
||||
\\["\uDADA"]
|
||||
);
|
||||
}
|
||||
|
||||
test "i_string_1st_valid_surrogate_2nd_invalid" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
anyStreamingErrNonStreaming(
|
||||
\\["\uD888\u1234"]
|
||||
);
|
||||
}
|
||||
|
||||
test "i_string_incomplete_surrogate_and_escape_valid" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
anyStreamingErrNonStreaming(
|
||||
\\["\uD800\n"]
|
||||
);
|
||||
}
|
||||
|
||||
test "i_string_incomplete_surrogate_pair" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
anyStreamingErrNonStreaming(
|
||||
\\["\uDd1ea"]
|
||||
);
|
||||
}
|
||||
|
||||
test "i_string_incomplete_surrogates_escape_valid" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
anyStreamingErrNonStreaming(
|
||||
\\["\uD800\uD800\n"]
|
||||
);
|
||||
}
|
||||
|
||||
test "i_string_invalid_lonely_surrogate" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
anyStreamingErrNonStreaming(
|
||||
\\["\ud800"]
|
||||
);
|
||||
}
|
||||
|
||||
test "i_string_invalid_surrogate" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
anyStreamingErrNonStreaming(
|
||||
\\["\ud800abc"]
|
||||
);
|
||||
@ -1859,6 +1922,9 @@ test "i_string_invalid_utf-8" {
|
||||
}
|
||||
|
||||
test "i_string_inverted_surrogates_U+1D11E" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
anyStreamingErrNonStreaming(
|
||||
\\["\uDd1e\uD834"]
|
||||
);
|
||||
@ -1871,6 +1937,9 @@ test "i_string_iso_latin_1" {
|
||||
}
|
||||
|
||||
test "i_string_lone_second_surrogate" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
anyStreamingErrNonStreaming(
|
||||
\\["\uDFAA"]
|
||||
);
|
||||
|
||||
@ -14,7 +14,7 @@ pub usingnamespace switch (builtin.arch) {
|
||||
.aarch64 => @import("linux/arm64.zig"),
|
||||
.arm => @import("linux/arm-eabi.zig"),
|
||||
.riscv64 => @import("linux/riscv64.zig"),
|
||||
.mipsel => @import("linux/mipsel.zig"),
|
||||
.mips, .mipsel => @import("linux/mips.zig"),
|
||||
else => struct {},
|
||||
};
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ pub usingnamespace switch (builtin.arch) {
|
||||
.aarch64 => @import("linux/arm64.zig"),
|
||||
.arm => @import("linux/arm-eabi.zig"),
|
||||
.riscv64 => @import("linux/riscv64.zig"),
|
||||
.mipsel => @import("linux/mipsel.zig"),
|
||||
.mips, .mipsel => @import("linux/mips.zig"),
|
||||
else => struct {},
|
||||
};
|
||||
pub usingnamespace @import("bits.zig");
|
||||
|
||||
@ -48,7 +48,7 @@ const TLSVariant = enum {
|
||||
};
|
||||
|
||||
const tls_variant = switch (builtin.arch) {
|
||||
.arm, .armeb, .aarch64, .aarch64_be, .riscv32, .riscv64, .mipsel => TLSVariant.VariantI,
|
||||
.arm, .armeb, .aarch64, .aarch64_be, .riscv32, .riscv64, .mips, .mipsel => TLSVariant.VariantI,
|
||||
.x86_64, .i386 => TLSVariant.VariantII,
|
||||
else => @compileError("undefined tls_variant for this architecture"),
|
||||
};
|
||||
@ -64,7 +64,7 @@ const tls_tcb_size = switch (builtin.arch) {
|
||||
|
||||
// Controls if the TP points to the end of the TCB instead of its beginning
|
||||
const tls_tp_points_past_tcb = switch (builtin.arch) {
|
||||
.riscv32, .riscv64, .mipsel, .powerpc64, .powerpc64le => true,
|
||||
.riscv32, .riscv64, .mips, .mipsel, .powerpc64, .powerpc64le => true,
|
||||
else => false,
|
||||
};
|
||||
|
||||
@ -72,12 +72,12 @@ const tls_tp_points_past_tcb = switch (builtin.arch) {
|
||||
// make the generated code more efficient
|
||||
|
||||
const tls_tp_offset = switch (builtin.arch) {
|
||||
.mipsel => 0x7000,
|
||||
.mips, .mipsel => 0x7000,
|
||||
else => 0,
|
||||
};
|
||||
|
||||
const tls_dtv_offset = switch (builtin.arch) {
|
||||
.mipsel => 0x8000,
|
||||
.mips, .mipsel => 0x8000,
|
||||
.riscv32, .riscv64 => 0x800,
|
||||
else => 0,
|
||||
};
|
||||
@ -156,7 +156,7 @@ pub fn setThreadPointer(addr: usize) void {
|
||||
: [addr] "r" (addr)
|
||||
);
|
||||
},
|
||||
.mipsel => {
|
||||
.mips, .mipsel => {
|
||||
const rc = std.os.linux.syscall1(.set_thread_area, addr);
|
||||
assert(rc == 0);
|
||||
},
|
||||
|
||||
@ -354,7 +354,7 @@ fn clone() callconv(.Naked) void {
|
||||
\\ ecall
|
||||
);
|
||||
},
|
||||
.mipsel => {
|
||||
.mips, .mipsel => {
|
||||
asm volatile (
|
||||
\\ # Save function pointer and argument pointer on new thread stack
|
||||
\\ and $5, $5, -8
|
||||
|
||||
@ -108,7 +108,7 @@ fn _start() callconv(.Naked) noreturn {
|
||||
: [argc] "=r" (-> [*]usize)
|
||||
);
|
||||
},
|
||||
.mipsel => {
|
||||
.mips, .mipsel => {
|
||||
// Need noat here because LLVM is free to pick any register
|
||||
starting_stack_ptr = asm (
|
||||
\\ .set noat
|
||||
|
||||
@ -660,6 +660,9 @@ fn calcUtf16LeLen(utf8: []const u8) usize {
|
||||
}
|
||||
|
||||
test "utf8ToUtf16LeStringLiteral" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
{
|
||||
const bytes = [_:0]u16{0x41};
|
||||
const utf16 = utf8ToUtf16LeStringLiteral("A");
|
||||
|
||||
@ -1007,7 +1007,7 @@ bool want_first_arg_sret(CodeGen *g, FnTypeId *fn_type_id) {
|
||||
{
|
||||
X64CABIClass abi_class = type_c_abi_x86_64_class(g, fn_type_id->return_type);
|
||||
return abi_class == X64CABIClass_MEMORY || abi_class == X64CABIClass_MEMORY_nobyval;
|
||||
} else if (g->zig_target->arch == ZigLLVM_mipsel) {
|
||||
} else if (g->zig_target->arch == ZigLLVM_mips || g->zig_target->arch == ZigLLVM_mipsel) {
|
||||
return false;
|
||||
}
|
||||
zig_panic("TODO implement C ABI for this architecture. See https://github.com/ziglang/zig/issues/1481");
|
||||
|
||||
@ -43,7 +43,7 @@ test "@byteSwap vectors" {
|
||||
if (std.Target.current.os.tag == .dragonfly) return error.SkipZigTest;
|
||||
|
||||
// https://github.com/ziglang/zig/issues/3317
|
||||
if (std.Target.current.cpu.arch == .mipsel) return error.SkipZigTest;
|
||||
if (std.Target.current.cpu.arch == .mipsel or std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
const ByteSwapVectorTest = struct {
|
||||
fn run() void {
|
||||
|
||||
@ -16,6 +16,9 @@ test "integer literal to pointer cast" {
|
||||
}
|
||||
|
||||
test "pointer reinterpret const float to int" {
|
||||
// https://github.com/ziglang/zig/issues/3345
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
const float: f64 = 5.99999999999994648725e-01;
|
||||
const float_ptr = &float;
|
||||
const int_ptr = @ptrCast(*const i32, float_ptr);
|
||||
|
||||
@ -34,7 +34,7 @@ test "@shuffle" {
|
||||
|
||||
// bool
|
||||
// Disabled because of #3317
|
||||
if (@import("builtin").arch != .mipsel) {
|
||||
if (@import("builtin").arch != .mipsel and std.Target.current.cpu.arch != .mips) {
|
||||
var x2: @Vector(4, bool) = [4]bool{ false, true, false, true };
|
||||
var v4: @Vector(2, bool) = [2]bool{ true, false };
|
||||
const mask5: @Vector(4, i32) = [4]i32{ 0, ~@as(i32, 1), 1, 2 };
|
||||
|
||||
@ -623,6 +623,9 @@ test "0-sized extern union definition" {
|
||||
}
|
||||
|
||||
test "union initializer generates padding only if needed" {
|
||||
// https://github.com/ziglang/zig/issues/5127
|
||||
if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest;
|
||||
|
||||
const U = union(enum) {
|
||||
A: u24,
|
||||
};
|
||||
|
||||
@ -145,6 +145,31 @@ const test_targets = blk: {
|
||||
// .link_libc = true,
|
||||
//},
|
||||
|
||||
TestTarget{
|
||||
.target = .{
|
||||
.cpu_arch = .mips,
|
||||
.os_tag = .linux,
|
||||
.abi = .none,
|
||||
},
|
||||
},
|
||||
TestTarget{
|
||||
.target = .{
|
||||
.cpu_arch = .mips,
|
||||
.os_tag = .linux,
|
||||
.abi = .musl,
|
||||
},
|
||||
.link_libc = true,
|
||||
},
|
||||
// https://github.com/ziglang/zig/issues/4927
|
||||
//TestTarget{
|
||||
// .target = .{
|
||||
// .cpu_arch = .mips,
|
||||
// .os_tag = .linux,
|
||||
// .abi = .gnu,
|
||||
// },
|
||||
// .link_libc = true,
|
||||
//},
|
||||
|
||||
TestTarget{
|
||||
.target = .{
|
||||
.cpu_arch = .mipsel,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user