| author | |
| committer | |
| log | 1c1cfe1533a6d38cf3fcdd998637afdbb12910a8 |
| tree | 03b48373d49a0e8e37afdba9f11b1ebe97631f90 |
| parent | b5d5685a4e3a536999d3e69ce92cc786f052d4ec |
2 files changed, 16 insertions(+), 13 deletions(-)
lib/std/special/compiler_rt.zig+12-3| ... | @@ -721,11 +721,12 @@ comptime { | ... | @@ -721,11 +721,12 @@ comptime { |
| 721 | @export(_aullrem, .{ .name = "\x01__aullrem", .linkage = strong_linkage }); | 721 | @export(_aullrem, .{ .name = "\x01__aullrem", .linkage = strong_linkage }); |
| 722 | } | 722 | } |
| 723 | 723 | ||
| 724 | const fmodq = @import("compiler_rt/floatfmodq.zig").fmodq; | ||
| 725 | if (!is_test) { | 724 | if (!is_test) { |
| 726 | @export(fmodq, .{ .name = "fmodq", .linkage = linkage }); | 725 | @export(fmodl, .{ .name = "fmodl", .linkage = linkage }); |
| 727 | if (long_double_is_f128) { | 726 | 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 }); | ||
| 729 | } | 730 | } |
| 730 | 731 | ||
| 731 | @export(floorf, .{ .name = "floorf", .linkage = linkage }); | 732 | @export(floorf, .{ .name = "floorf", .linkage = linkage }); |
| ... | @@ -880,6 +881,14 @@ fn ceill(x: c_longdouble) callconv(.C) c_longdouble { | ... | @@ -880,6 +881,14 @@ fn ceill(x: c_longdouble) callconv(.C) c_longdouble { |
| 880 | return math.ceil(x); | 881 | return math.ceil(x); |
| 881 | } | 882 | } |
| 882 | 883 | ||
| 884 | const fmodq = @import("compiler_rt/floatfmodq.zig").fmodq; | ||
| 885 | fn 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 | |||
| 883 | // Avoid dragging in the runtime safety mechanisms into this .o file, | 892 | // Avoid dragging in the runtime safety mechanisms into this .o file, |
| 884 | // unless we're trying to test this file. | 893 | // unless we're trying to test this file. |
| 885 | pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn { | 894 | pub 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" { | ... | @@ -923,6 +923,8 @@ test "comptime float rem int" { |
| 923 | } | 923 | } |
| 924 | 924 | ||
| 925 | test "remainder division" { | 925 | test "remainder division" { |
| 926 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | ||
| 927 | |||
| 926 | comptime try remdiv(f16); | 928 | comptime try remdiv(f16); |
| 927 | comptime try remdiv(f32); | 929 | comptime try remdiv(f32); |
| 928 | comptime try remdiv(f64); | 930 | comptime try remdiv(f64); |
| ... | @@ -938,11 +940,7 @@ fn remdiv(comptime T: type) !void { | ... | @@ -938,11 +940,7 @@ fn remdiv(comptime T: type) !void { |
| 938 | } | 940 | } |
| 939 | 941 | ||
| 940 | test "float remainder division using @rem" { | 942 | test "float remainder division using @rem" { |
| 941 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 943 | if (builtin.zig_backend != .stage1) 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 | ||
| 946 | 944 | ||
| 947 | comptime try frem(f16); | 945 | comptime try frem(f16); |
| 948 | comptime try frem(f32); | 946 | comptime try frem(f32); |
| ... | @@ -973,11 +971,7 @@ fn frem(comptime T: type) !void { | ... | @@ -973,11 +971,7 @@ fn frem(comptime T: type) !void { |
| 973 | } | 971 | } |
| 974 | 972 | ||
| 975 | test "float modulo division using @mod" { | 973 | test "float modulo division using @mod" { |
| 976 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 974 | if (builtin.zig_backend != .stage1) 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 | ||
| 981 | 975 | ||
| 982 | comptime try fmod(f16); | 976 | comptime try fmod(f16); |
| 983 | comptime try fmod(f32); | 977 | comptime try fmod(f32); |