From 1c1cfe1533a6d38cf3fcdd998637afdbb12910a8 Mon Sep 17 00:00:00 2001 From: Cody Tapscott Date: Fri, 8 Apr 2022 19:48:24 -0700 Subject: [PATCH] Skip `@rem`/`@mod` tests on stage2, due to missing `fmodl` implementation --- lib/std/special/compiler_rt.zig | 15 ++++++++++++--- test/behavior/math.zig | 14 ++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/std/special/compiler_rt.zig b/lib/std/special/compiler_rt.zig index 9ccf5619e1..b54a1e980e 100644 --- a/lib/std/special/compiler_rt.zig +++ b/lib/std/special/compiler_rt.zig @@ -721,11 +721,12 @@ comptime { @export(_aullrem, .{ .name = "\x01__aullrem", .linkage = strong_linkage }); } - const fmodq = @import("compiler_rt/floatfmodq.zig").fmodq; if (!is_test) { - @export(fmodq, .{ .name = "fmodq", .linkage = linkage }); + @export(fmodl, .{ .name = "fmodl", .linkage = linkage }); if (long_double_is_f128) { - @export(fmodq, .{ .name = "fmodl", .linkage = linkage }); + @export(fmodl, .{ .name = "fmodq", .linkage = linkage }); + } else { + @export(fmodq, .{ .name = "fmodq", .linkage = linkage }); } @export(floorf, .{ .name = "floorf", .linkage = linkage }); @@ -880,6 +881,14 @@ fn ceill(x: c_longdouble) callconv(.C) c_longdouble { return math.ceil(x); } +const fmodq = @import("compiler_rt/floatfmodq.zig").fmodq; +fn fmodl(x: c_longdouble, y: c_longdouble) callconv(.C) c_longdouble { + if (!long_double_is_f128) { + @panic("TODO implement this"); + } + return @floatCast(c_longdouble, fmodq(x, y)); +} + // Avoid dragging in the runtime safety mechanisms into this .o file, // unless we're trying to test this file. pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn { diff --git a/test/behavior/math.zig b/test/behavior/math.zig index 32945e452d..a41f638396 100644 --- a/test/behavior/math.zig +++ b/test/behavior/math.zig @@ -923,6 +923,8 @@ test "comptime float rem int" { } test "remainder division" { + if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + comptime try remdiv(f16); comptime try remdiv(f32); comptime try remdiv(f64); @@ -938,11 +940,7 @@ fn remdiv(comptime T: type) !void { } test "float remainder division using @rem" { - if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO + if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO comptime try frem(f16); comptime try frem(f32); @@ -973,11 +971,7 @@ fn frem(comptime T: type) !void { } test "float modulo division using @mod" { - if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO + if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO comptime try fmod(f16); comptime try fmod(f32);