authorgravatar for topolarity@tapscott.meCody Tapscott <topolarity@tapscott.me> 2022-04-08 19:48:24-07:00
committergravatar for topolarity@tapscott.meCody Tapscott <topolarity@tapscott.me> 2022-04-12 10:25:29-07:00
log1c1cfe1533a6d38cf3fcdd998637afdbb12910a8
tree03b48373d49a0e8e37afdba9f11b1ebe97631f90
parentb5d5685a4e3a536999d3e69ce92cc786f052d4ec

Skip `@rem`/`@mod` tests on stage2, due to missing `fmodl` implementation


2 files changed, 16 insertions(+), 13 deletions(-)

lib/std/special/compiler_rt.zig+12-3
......@@ -721,11 +721,12 @@ comptime {
721721 @export(_aullrem, .{ .name = "\x01__aullrem", .linkage = strong_linkage });
722722 }
723723
724 const fmodq = @import("compiler_rt/floatfmodq.zig").fmodq;
725724 if (!is_test) {
726 @export(fmodq, .{ .name = "fmodq", .linkage = linkage });
725 @export(fmodl, .{ .name = "fmodl", .linkage = linkage });
727726 if (long_double_is_f128) {
728 @export(fmodq, .{ .name = "fmodl", .linkage = linkage });
727 @export(fmodl, .{ .name = "fmodq", .linkage = linkage });
728 } else {
729 @export(fmodq, .{ .name = "fmodq", .linkage = linkage });
729730 }
730731
731732 @export(floorf, .{ .name = "floorf", .linkage = linkage });
......@@ -880,6 +881,14 @@ fn ceill(x: c_longdouble) callconv(.C) c_longdouble {
880881 return math.ceil(x);
881882}
882883
884const fmodq = @import("compiler_rt/floatfmodq.zig").fmodq;
885fn fmodl(x: c_longdouble, y: c_longdouble) callconv(.C) c_longdouble {
886 if (!long_double_is_f128) {
887 @panic("TODO implement this");
888 }
889 return @floatCast(c_longdouble, fmodq(x, y));
890}
891
883892// Avoid dragging in the runtime safety mechanisms into this .o file,
884893// unless we're trying to test this file.
885894pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn {
test/behavior/math.zig+4-10
......@@ -923,6 +923,8 @@ test "comptime float rem int" {
923923}
924924
925925test "remainder division" {
926 if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
927
926928 comptime try remdiv(f16);
927929 comptime try remdiv(f32);
928930 comptime try remdiv(f64);
......@@ -938,11 +940,7 @@ fn remdiv(comptime T: type) !void {
938940}
939941
940942test "float remainder division using @rem" {
941 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
942 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
943 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
944 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
945 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
943 if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
946944
947945 comptime try frem(f16);
948946 comptime try frem(f32);
......@@ -973,11 +971,7 @@ fn frem(comptime T: type) !void {
973971}
974972
975973test "float modulo division using @mod" {
976 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
977 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
978 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
979 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
980 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
974 if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
981975
982976 comptime try fmod(f16);
983977 comptime try fmod(f32);