diff --git a/lib/compiler_rt/absvdi2.zig b/lib/compiler_rt/absvdi2.zig index 1875d5bbaa..7ebf561ae5 100644 --- a/lib/compiler_rt/absvdi2.zig +++ b/lib/compiler_rt/absvdi2.zig @@ -7,6 +7,6 @@ comptime { @export(__absvdi2, .{ .name = "__absvdi2", .linkage = common.linkage }); } -fn __absvdi2(a: i64) callconv(.C) i64 { +pub fn __absvdi2(a: i64) callconv(.C) i64 { return absv(i64, a); } diff --git a/lib/compiler_rt/absvdi2_test.zig b/lib/compiler_rt/absvdi2_test.zig index 4aa73513ee..e861ef0ff3 100644 --- a/lib/compiler_rt/absvdi2_test.zig +++ b/lib/compiler_rt/absvdi2_test.zig @@ -1,8 +1,9 @@ -const absv = @import("absv.zig"); const testing = @import("std").testing; +const __absvdi2 = @import("absvdi2.zig").__absvdi2; + fn test__absvdi2(a: i64, expected: i64) !void { - var result = absv.__absvdi2(a); + var result = __absvdi2(a); try testing.expectEqual(expected, result); } diff --git a/lib/compiler_rt/absvsi2.zig b/lib/compiler_rt/absvsi2.zig index 965e39bc9b..664925f8f9 100644 --- a/lib/compiler_rt/absvsi2.zig +++ b/lib/compiler_rt/absvsi2.zig @@ -7,6 +7,6 @@ comptime { @export(__absvsi2, .{ .name = "__absvsi2", .linkage = common.linkage }); } -fn __absvsi2(a: i32) callconv(.C) i32 { +pub fn __absvsi2(a: i32) callconv(.C) i32 { return absv(i32, a); } diff --git a/lib/compiler_rt/absvsi2_test.zig b/lib/compiler_rt/absvsi2_test.zig index 2cc3dbf991..9c74ebee67 100644 --- a/lib/compiler_rt/absvsi2_test.zig +++ b/lib/compiler_rt/absvsi2_test.zig @@ -1,8 +1,9 @@ -const absv = @import("absv.zig"); const testing = @import("std").testing; +const __absvsi2 = @import("absvsi2.zig").__absvsi2; + fn test__absvsi2(a: i32, expected: i32) !void { - var result = absv.__absvsi2(a); + var result = __absvsi2(a); try testing.expectEqual(expected, result); } diff --git a/lib/compiler_rt/absvti2.zig b/lib/compiler_rt/absvti2.zig index ada06c6563..f7d0f796b0 100644 --- a/lib/compiler_rt/absvti2.zig +++ b/lib/compiler_rt/absvti2.zig @@ -7,6 +7,6 @@ comptime { @export(__absvti2, .{ .name = "__absvti2", .linkage = common.linkage }); } -fn __absvti2(a: i128) callconv(.C) i128 { +pub fn __absvti2(a: i128) callconv(.C) i128 { return absv(i128, a); } diff --git a/lib/compiler_rt/absvti2_test.zig b/lib/compiler_rt/absvti2_test.zig index 5b4deb3640..fbed961775 100644 --- a/lib/compiler_rt/absvti2_test.zig +++ b/lib/compiler_rt/absvti2_test.zig @@ -1,8 +1,9 @@ -const absv = @import("absv.zig"); const testing = @import("std").testing; +const __absvti2 = @import("absvti2.zig").__absvti2; + fn test__absvti2(a: i128, expected: i128) !void { - var result = absv.__absvti2(a); + var result = __absvti2(a); try testing.expectEqual(expected, result); } diff --git a/lib/compiler_rt/addf3_test.zig b/lib/compiler_rt/addf3_test.zig index cd3f3ab89c..1df87a889f 100644 --- a/lib/compiler_rt/addf3_test.zig +++ b/lib/compiler_rt/addf3_test.zig @@ -7,7 +7,9 @@ const std = @import("std"); const math = std.math; const qnan128 = @bitCast(f128, @as(u128, 0x7fff800000000000) << 64); -const __addtf3 = @import("addf3.zig").__addtf3; +const __addtf3 = @import("addtf3.zig").__addtf3; +const __addxf3 = @import("addxf3.zig").__addxf3; +const __subtf3 = @import("subtf3.zig").__subtf3; fn test__addtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void { const x = __addtf3(a, b); @@ -48,8 +50,6 @@ test "addtf3" { try test__addtf3(0x1.edcba52449872455634654321fp-1, 0x1.23456734245345543849abcdefp+5, 0x40042afc95c8b579, 0x61e58dd6c51eb77c); } -const __subtf3 = @import("addf3.zig").__subtf3; - fn test__subtf3(a: f128, b: f128, expected_hi: u64, expected_lo: u64) !void { const x = __subtf3(a, b); @@ -87,7 +87,6 @@ test "subtf3" { try test__subtf3(0x1.ee9d7c52354a6936ab8d7654321fp-1, 0x1.234567829a3bcdef5678ade36734p+5, 0xc0041b8af1915166, 0xa44a7bca780a166c); } -const __addxf3 = @import("addf3.zig").__addxf3; const qnan80 = @bitCast(f80, @bitCast(u80, math.nan(f80)) | (1 << (math.floatFractionalBits(f80) - 1))); fn test__addxf3(a: f80, b: f80, expected: u80) !void { diff --git a/lib/compiler_rt/addtf3.zig b/lib/compiler_rt/addtf3.zig index f7c33ba969..2a22493ded 100644 --- a/lib/compiler_rt/addtf3.zig +++ b/lib/compiler_rt/addtf3.zig @@ -13,7 +13,7 @@ comptime { } } -fn __addtf3(a: f128, b: f128) callconv(.C) f128 { +pub fn __addtf3(a: f128, b: f128) callconv(.C) f128 { return addf3(f128, a, b); } diff --git a/lib/compiler_rt/addxf3.zig b/lib/compiler_rt/addxf3.zig index 67e7dd8491..72cf955632 100644 --- a/lib/compiler_rt/addxf3.zig +++ b/lib/compiler_rt/addxf3.zig @@ -7,6 +7,6 @@ comptime { @export(__addxf3, .{ .name = "__addxf3", .linkage = common.linkage }); } -fn __addxf3(a: f80, b: f80) callconv(.C) f80 { +pub fn __addxf3(a: f80, b: f80) callconv(.C) f80 { return addf3(f80, a, b); } diff --git a/lib/compiler_rt/cmpdf2.zig b/lib/compiler_rt/cmpdf2.zig index f1661731fb..67dbcd8b4d 100644 --- a/lib/compiler_rt/cmpdf2.zig +++ b/lib/compiler_rt/cmpdf2.zig @@ -31,27 +31,27 @@ fn __cmpdf2(a: f64, b: f64) callconv(.C) i32 { /// "These functions return a value less than or equal to zero if neither argument is NaN, /// and a is less than or equal to b." -fn __ledf2(a: f64, b: f64) callconv(.C) i32 { +pub fn __ledf2(a: f64, b: f64) callconv(.C) i32 { return __cmpdf2(a, b); } /// "These functions return zero if neither argument is NaN, and a and b are equal." /// Note that due to some kind of historical accident, __eqdf2 and __nedf2 are defined /// to have the same return value. -fn __eqdf2(a: f64, b: f64) callconv(.C) i32 { +pub fn __eqdf2(a: f64, b: f64) callconv(.C) i32 { return __cmpdf2(a, b); } /// "These functions return a nonzero value if either argument is NaN, or if a and b are unequal." /// Note that due to some kind of historical accident, __eqdf2 and __nedf2 are defined /// to have the same return value. -fn __nedf2(a: f64, b: f64) callconv(.C) i32 { +pub fn __nedf2(a: f64, b: f64) callconv(.C) i32 { return __cmpdf2(a, b); } /// "These functions return a value less than zero if neither argument is NaN, and a /// is strictly less than b." -fn __ltdf2(a: f64, b: f64) callconv(.C) i32 { +pub fn __ltdf2(a: f64, b: f64) callconv(.C) i32 { return __cmpdf2(a, b); } diff --git a/lib/compiler_rt/cmpsf2.zig b/lib/compiler_rt/cmpsf2.zig index 23be99c3f7..1ac40ef6e2 100644 --- a/lib/compiler_rt/cmpsf2.zig +++ b/lib/compiler_rt/cmpsf2.zig @@ -31,27 +31,27 @@ fn __cmpsf2(a: f32, b: f32) callconv(.C) i32 { /// "These functions return a value less than or equal to zero if neither argument is NaN, /// and a is less than or equal to b." -fn __lesf2(a: f32, b: f32) callconv(.C) i32 { +pub fn __lesf2(a: f32, b: f32) callconv(.C) i32 { return __cmpsf2(a, b); } /// "These functions return zero if neither argument is NaN, and a and b are equal." /// Note that due to some kind of historical accident, __eqsf2 and __nesf2 are defined /// to have the same return value. -fn __eqsf2(a: f32, b: f32) callconv(.C) i32 { +pub fn __eqsf2(a: f32, b: f32) callconv(.C) i32 { return __cmpsf2(a, b); } /// "These functions return a nonzero value if either argument is NaN, or if a and b are unequal." /// Note that due to some kind of historical accident, __eqsf2 and __nesf2 are defined /// to have the same return value. -fn __nesf2(a: f32, b: f32) callconv(.C) i32 { +pub fn __nesf2(a: f32, b: f32) callconv(.C) i32 { return __cmpsf2(a, b); } /// "These functions return a value less than zero if neither argument is NaN, and a /// is strictly less than b." -fn __ltsf2(a: f32, b: f32) callconv(.C) i32 { +pub fn __ltsf2(a: f32, b: f32) callconv(.C) i32 { return __cmpsf2(a, b); } diff --git a/lib/compiler_rt/comparedf2_test.zig b/lib/compiler_rt/comparedf2_test.zig index a80297ffbf..a77718e57c 100644 --- a/lib/compiler_rt/comparedf2_test.zig +++ b/lib/compiler_rt/comparedf2_test.zig @@ -6,7 +6,15 @@ const std = @import("std"); const builtin = @import("builtin"); const is_test = builtin.is_test; -const comparedf2 = @import("compareXf2.zig"); +const __eqdf2 = @import("./cmpdf2.zig").__eqdf2; +const __ledf2 = @import("./cmpdf2.zig").__ledf2; +const __ltdf2 = @import("./cmpdf2.zig").__ltdf2; +const __nedf2 = @import("./cmpdf2.zig").__nedf2; + +const __gedf2 = @import("./gedf2.zig").__gedf2; +const __gtdf2 = @import("./gedf2.zig").__gtdf2; + +const __unorddf2 = @import("./unorddf2.zig").__unorddf2; const TestVector = struct { a: f64, @@ -21,25 +29,25 @@ const TestVector = struct { }; fn test__cmpdf2(vector: TestVector) bool { - if (comparedf2.__eqdf2(vector.a, vector.b) != vector.eqReference) { + if (__eqdf2(vector.a, vector.b) != vector.eqReference) { return false; } - if (comparedf2.__gedf2(vector.a, vector.b) != vector.geReference) { + if (__gedf2(vector.a, vector.b) != vector.geReference) { return false; } - if (comparedf2.__gtdf2(vector.a, vector.b) != vector.gtReference) { + if (__gtdf2(vector.a, vector.b) != vector.gtReference) { return false; } - if (comparedf2.__ledf2(vector.a, vector.b) != vector.leReference) { + if (__ledf2(vector.a, vector.b) != vector.leReference) { return false; } - if (comparedf2.__ltdf2(vector.a, vector.b) != vector.ltReference) { + if (__ltdf2(vector.a, vector.b) != vector.ltReference) { return false; } - if (comparedf2.__nedf2(vector.a, vector.b) != vector.neReference) { + if (__nedf2(vector.a, vector.b) != vector.neReference) { return false; } - if (comparedf2.__unorddf2(vector.a, vector.b) != vector.unReference) { + if (__unorddf2(vector.a, vector.b) != vector.unReference) { return false; } return true; diff --git a/lib/compiler_rt/comparesf2_test.zig b/lib/compiler_rt/comparesf2_test.zig index 8bc2c67956..b2fafd38dd 100644 --- a/lib/compiler_rt/comparesf2_test.zig +++ b/lib/compiler_rt/comparesf2_test.zig @@ -6,7 +6,15 @@ const std = @import("std"); const builtin = @import("builtin"); const is_test = builtin.is_test; -const comparesf2 = @import("compareXf2.zig"); +const __eqsf2 = @import("./cmpsf2.zig").__eqsf2; +const __lesf2 = @import("./cmpsf2.zig").__lesf2; +const __ltsf2 = @import("./cmpsf2.zig").__ltsf2; +const __nesf2 = @import("./cmpsf2.zig").__nesf2; + +const __gesf2 = @import("./gesf2.zig").__gesf2; +const __gtsf2 = @import("./gesf2.zig").__gtsf2; + +const __unordsf2 = @import("./unordsf2.zig").__unordsf2; const TestVector = struct { a: f32, @@ -21,25 +29,25 @@ const TestVector = struct { }; fn test__cmpsf2(vector: TestVector) bool { - if (comparesf2.__eqsf2(vector.a, vector.b) != vector.eqReference) { + if (__eqsf2(vector.a, vector.b) != vector.eqReference) { return false; } - if (comparesf2.__gesf2(vector.a, vector.b) != vector.geReference) { + if (__gesf2(vector.a, vector.b) != vector.geReference) { return false; } - if (comparesf2.__gtsf2(vector.a, vector.b) != vector.gtReference) { + if (__gtsf2(vector.a, vector.b) != vector.gtReference) { return false; } - if (comparesf2.__lesf2(vector.a, vector.b) != vector.leReference) { + if (__lesf2(vector.a, vector.b) != vector.leReference) { return false; } - if (comparesf2.__ltsf2(vector.a, vector.b) != vector.ltReference) { + if (__ltsf2(vector.a, vector.b) != vector.ltReference) { return false; } - if (comparesf2.__nesf2(vector.a, vector.b) != vector.neReference) { + if (__nesf2(vector.a, vector.b) != vector.neReference) { return false; } - if (comparesf2.__unordsf2(vector.a, vector.b) != vector.unReference) { + if (__unordsf2(vector.a, vector.b) != vector.unReference) { return false; } return true; diff --git a/lib/compiler_rt/divtf3.zig b/lib/compiler_rt/divtf3.zig index 66e01e1843..b6cabeab91 100644 --- a/lib/compiler_rt/divtf3.zig +++ b/lib/compiler_rt/divtf3.zig @@ -17,6 +17,10 @@ comptime { } } +pub fn __divtf3(a: f128, b: f128) callconv(.C) f128 { + return div(a, b); +} + fn __divkf3(a: f128, b: f128) callconv(.C) f128 { return div(a, b); } @@ -25,10 +29,6 @@ fn _Qp_div(c: *f128, a: *const f128, b: *const f128) callconv(.C) void { c.* = div(a.*, b.*); } -fn __divtf3(a: f128, b: f128) callconv(.C) f128 { - return div(a, b); -} - inline fn div(a: f128, b: f128) f128 { const Z = std.meta.Int(.unsigned, 128); diff --git a/lib/compiler_rt/extenddftf2.zig b/lib/compiler_rt/extenddftf2.zig index fa0053ad5c..21e497b3a4 100644 --- a/lib/compiler_rt/extenddftf2.zig +++ b/lib/compiler_rt/extenddftf2.zig @@ -13,7 +13,7 @@ comptime { } } -fn __extenddftf2(a: f64) callconv(.C) f128 { +pub fn __extenddftf2(a: f64) callconv(.C) f128 { return extendf(f128, f64, @bitCast(u64, a)); } @@ -22,6 +22,5 @@ fn __extenddfkf2(a: f64) callconv(.C) f128 { } fn _Qp_dtoq(c: *f128, a: f64) callconv(.C) void { - c.* = @import("extendXfYf2.zig").__extenddftf2(a); c.* = extendf(f128, f64, @bitCast(u64, a)); } diff --git a/lib/compiler_rt/extendf.zig b/lib/compiler_rt/extendf.zig index 15fa1ce0e8..8eb23c1d82 100644 --- a/lib/compiler_rt/extendf.zig +++ b/lib/compiler_rt/extendf.zig @@ -138,5 +138,5 @@ pub inline fn extend_f80(comptime src_t: type, a: std.meta.Int(.unsigned, @typeI } test { - _ = @import("extendXfYf2_test.zig"); + _ = @import("extendf_test.zig"); } diff --git a/lib/compiler_rt/extendXfYf2_test.zig b/lib/compiler_rt/extendf_test.zig similarity index 87% rename from lib/compiler_rt/extendXfYf2_test.zig rename to lib/compiler_rt/extendf_test.zig index d0c4f82e97..1102092a04 100644 --- a/lib/compiler_rt/extendXfYf2_test.zig +++ b/lib/compiler_rt/extendf_test.zig @@ -1,22 +1,22 @@ const builtin = @import("builtin"); -const __extendhfsf2 = @import("extendXfYf2.zig").__extendhfsf2; -const __extendhftf2 = @import("extendXfYf2.zig").__extendhftf2; -const __extendsftf2 = @import("extendXfYf2.zig").__extendsftf2; -const __extenddftf2 = @import("extendXfYf2.zig").__extenddftf2; -const F16T = @import("extendXfYf2.zig").F16T; +const __extendhfsf2 = @import("extendhfsf2.zig").__extendhfsf2; +const __extendhftf2 = @import("extendhftf2.zig").__extendhftf2; +const __extendsftf2 = @import("extendsftf2.zig").__extendsftf2; +const __extenddftf2 = @import("extenddftf2.zig").__extenddftf2; +const F16T = @import("./common.zig").F16T; -fn test__extenddftf2(a: f64, expectedHi: u64, expectedLo: u64) !void { +fn test__extenddftf2(a: f64, expected_hi: u64, expected_lo: u64) !void { const x = __extenddftf2(a); const rep = @bitCast(u128, x); const hi = @intCast(u64, rep >> 64); const lo = @truncate(u64, rep); - if (hi == expectedHi and lo == expectedLo) + if (hi == expected_hi and lo == expected_lo) return; // test other possible NaN representation(signal NaN) - if (expectedHi == 0x7fff800000000000 and expectedLo == 0x0) { + if (expected_hi == 0x7fff800000000000 and expected_lo == 0x0) { if ((hi & 0x7fff000000000000) == 0x7fff000000000000 and ((hi & 0xffffffffffff) > 0 or lo > 0)) { @@ -43,18 +43,18 @@ fn test__extendhfsf2(a: u16, expected: u32) !void { return error.TestFailure; } -fn test__extendsftf2(a: f32, expectedHi: u64, expectedLo: u64) !void { +fn test__extendsftf2(a: f32, expected_hi: u64, expected_lo: u64) !void { const x = __extendsftf2(a); const rep = @bitCast(u128, x); const hi = @intCast(u64, rep >> 64); const lo = @truncate(u64, rep); - if (hi == expectedHi and lo == expectedLo) + if (hi == expected_hi and lo == expected_lo) return; // test other possible NaN representation(signal NaN) - if (expectedHi == 0x7fff800000000000 and expectedLo == 0x0) { + if (expected_hi == 0x7fff800000000000 and expected_lo == 0x0) { if ((hi & 0x7fff000000000000) == 0x7fff000000000000 and ((hi & 0xffffffffffff) > 0 or lo > 0)) { @@ -159,18 +159,18 @@ fn makeInf32() f32 { return @bitCast(f32, @as(u32, 0x7f800000)); } -fn test__extendhftf2(a: u16, expectedHi: u64, expectedLo: u64) !void { +fn test__extendhftf2(a: u16, expected_hi: u64, expected_lo: u64) !void { const x = __extendhftf2(@bitCast(F16T, a)); const rep = @bitCast(u128, x); const hi = @intCast(u64, rep >> 64); const lo = @truncate(u64, rep); - if (hi == expectedHi and lo == expectedLo) + if (hi == expected_hi and lo == expected_lo) return; // test other possible NaN representation(signal NaN) - if (expectedHi == 0x7fff800000000000 and expectedLo == 0x0) { + if (expected_hi == 0x7fff800000000000 and expected_lo == 0x0) { if ((hi & 0x7fff000000000000) == 0x7fff000000000000 and ((hi & 0xffffffffffff) > 0 or lo > 0)) { diff --git a/lib/compiler_rt/extendhfsf2.zig b/lib/compiler_rt/extendhfsf2.zig index 6ad4ff37df..56e6b9c01b 100644 --- a/lib/compiler_rt/extendhfsf2.zig +++ b/lib/compiler_rt/extendhfsf2.zig @@ -13,7 +13,7 @@ comptime { } } -fn __extendhfsf2(a: common.F16T) callconv(.C) f32 { +pub fn __extendhfsf2(a: common.F16T) callconv(.C) f32 { return extendf(f32, f16, @bitCast(u16, a)); } diff --git a/lib/compiler_rt/extendhftf2.zig b/lib/compiler_rt/extendhftf2.zig index a0c8eb5a1e..5d339fabce 100644 --- a/lib/compiler_rt/extendhftf2.zig +++ b/lib/compiler_rt/extendhftf2.zig @@ -7,6 +7,6 @@ comptime { @export(__extendhftf2, .{ .name = "__extendhftf2", .linkage = common.linkage }); } -fn __extendhftf2(a: common.F16T) callconv(.C) f128 { +pub fn __extendhftf2(a: common.F16T) callconv(.C) f128 { return extendf(f128, f16, @bitCast(u16, a)); } diff --git a/lib/compiler_rt/extendsftf2.zig b/lib/compiler_rt/extendsftf2.zig index a3b29802e6..acdc0d586d 100644 --- a/lib/compiler_rt/extendsftf2.zig +++ b/lib/compiler_rt/extendsftf2.zig @@ -13,7 +13,7 @@ comptime { } } -fn __extendsftf2(a: f32) callconv(.C) f128 { +pub fn __extendsftf2(a: f32) callconv(.C) f128 { return extendf(f128, f32, @bitCast(u32, a)); } diff --git a/lib/compiler_rt/fixdfdi.zig b/lib/compiler_rt/fixdfdi.zig index 2c3204db65..5935f23524 100644 --- a/lib/compiler_rt/fixdfdi.zig +++ b/lib/compiler_rt/fixdfdi.zig @@ -11,7 +11,7 @@ comptime { } } -fn __fixdfdi(a: f64) callconv(.C) i64 { +pub fn __fixdfdi(a: f64) callconv(.C) i64 { return floatToInt(i64, a); } diff --git a/lib/compiler_rt/fixdfsi.zig b/lib/compiler_rt/fixdfsi.zig index 415160f1de..983c84ccb1 100644 --- a/lib/compiler_rt/fixdfsi.zig +++ b/lib/compiler_rt/fixdfsi.zig @@ -11,7 +11,7 @@ comptime { } } -fn __fixdfsi(a: f64) callconv(.C) i32 { +pub fn __fixdfsi(a: f64) callconv(.C) i32 { return floatToInt(i32, a); } diff --git a/lib/compiler_rt/fixdfti.zig b/lib/compiler_rt/fixdfti.zig index 56ae2bbeb2..b2476ce2f3 100644 --- a/lib/compiler_rt/fixdfti.zig +++ b/lib/compiler_rt/fixdfti.zig @@ -7,6 +7,6 @@ comptime { @export(__fixdfti, .{ .name = "__fixdfti", .linkage = common.linkage }); } -fn __fixdfti(a: f64) callconv(.C) i128 { +pub fn __fixdfti(a: f64) callconv(.C) i128 { return floatToInt(i128, a); } diff --git a/lib/compiler_rt/fixsfdi.zig b/lib/compiler_rt/fixsfdi.zig index 71b0f047e2..0c4fb7f3f6 100644 --- a/lib/compiler_rt/fixsfdi.zig +++ b/lib/compiler_rt/fixsfdi.zig @@ -11,7 +11,7 @@ comptime { } } -fn __fixsfdi(a: f32) callconv(.C) i64 { +pub fn __fixsfdi(a: f32) callconv(.C) i64 { return floatToInt(i64, a); } diff --git a/lib/compiler_rt/fixsfsi.zig b/lib/compiler_rt/fixsfsi.zig index d48162928b..f48e354cd2 100644 --- a/lib/compiler_rt/fixsfsi.zig +++ b/lib/compiler_rt/fixsfsi.zig @@ -11,7 +11,7 @@ comptime { } } -fn __fixsfsi(a: f32) callconv(.C) i32 { +pub fn __fixsfsi(a: f32) callconv(.C) i32 { return floatToInt(i32, a); } diff --git a/lib/compiler_rt/fixsfti.zig b/lib/compiler_rt/fixsfti.zig index aefde49768..4bf68ec8b0 100644 --- a/lib/compiler_rt/fixsfti.zig +++ b/lib/compiler_rt/fixsfti.zig @@ -7,6 +7,6 @@ comptime { @export(__fixsfti, .{ .name = "__fixsfti", .linkage = common.linkage }); } -fn __fixsfti(a: f32) callconv(.C) i128 { +pub fn __fixsfti(a: f32) callconv(.C) i128 { return floatToInt(i128, a); } diff --git a/lib/compiler_rt/fixtfdi.zig b/lib/compiler_rt/fixtfdi.zig index 20bc4d89d6..9cc9835352 100644 --- a/lib/compiler_rt/fixtfdi.zig +++ b/lib/compiler_rt/fixtfdi.zig @@ -13,7 +13,7 @@ comptime { } } -fn __fixtfdi(a: f128) callconv(.C) i64 { +pub fn __fixtfdi(a: f128) callconv(.C) i64 { return floatToInt(i64, a); } diff --git a/lib/compiler_rt/fixtfsi.zig b/lib/compiler_rt/fixtfsi.zig index 44cac245fb..f46208f02b 100644 --- a/lib/compiler_rt/fixtfsi.zig +++ b/lib/compiler_rt/fixtfsi.zig @@ -13,7 +13,7 @@ comptime { } } -fn __fixtfsi(a: f128) callconv(.C) i32 { +pub fn __fixtfsi(a: f128) callconv(.C) i32 { return floatToInt(i32, a); } diff --git a/lib/compiler_rt/fixtfti.zig b/lib/compiler_rt/fixtfti.zig index a50ee5aa7c..9ba761729e 100644 --- a/lib/compiler_rt/fixtfti.zig +++ b/lib/compiler_rt/fixtfti.zig @@ -7,6 +7,6 @@ comptime { @export(__fixtfti, .{ .name = "__fixtfti", .linkage = common.linkage }); } -fn __fixtfti(a: f128) callconv(.C) i128 { +pub fn __fixtfti(a: f128) callconv(.C) i128 { return floatToInt(i128, a); } diff --git a/lib/compiler_rt/fixunsdfdi.zig b/lib/compiler_rt/fixunsdfdi.zig index afcb969ac6..edc0806405 100644 --- a/lib/compiler_rt/fixunsdfdi.zig +++ b/lib/compiler_rt/fixunsdfdi.zig @@ -11,7 +11,7 @@ comptime { } } -fn __fixunsdfdi(a: f64) callconv(.C) u64 { +pub fn __fixunsdfdi(a: f64) callconv(.C) u64 { return floatToInt(u64, a); } diff --git a/lib/compiler_rt/fixunsdfsi.zig b/lib/compiler_rt/fixunsdfsi.zig index 3675eb2c6f..cc413f3983 100644 --- a/lib/compiler_rt/fixunsdfsi.zig +++ b/lib/compiler_rt/fixunsdfsi.zig @@ -11,7 +11,7 @@ comptime { } } -fn __fixunsdfsi(a: f64) callconv(.C) u32 { +pub fn __fixunsdfsi(a: f64) callconv(.C) u32 { return floatToInt(u32, a); } diff --git a/lib/compiler_rt/fixunsdfti.zig b/lib/compiler_rt/fixunsdfti.zig index 96dd242f6d..ce3c4aabdd 100644 --- a/lib/compiler_rt/fixunsdfti.zig +++ b/lib/compiler_rt/fixunsdfti.zig @@ -7,6 +7,6 @@ comptime { @export(__fixunsdfti, .{ .name = "__fixunsdfti", .linkage = common.linkage }); } -fn __fixunsdfti(a: f64) callconv(.C) u128 { +pub fn __fixunsdfti(a: f64) callconv(.C) u128 { return floatToInt(u128, a); } diff --git a/lib/compiler_rt/fixunshfti.zig b/lib/compiler_rt/fixunshfti.zig index ac013263eb..b804c52f96 100644 --- a/lib/compiler_rt/fixunshfti.zig +++ b/lib/compiler_rt/fixunshfti.zig @@ -7,6 +7,6 @@ comptime { @export(__fixunshfti, .{ .name = "__fixunshfti", .linkage = common.linkage }); } -fn __fixunshfti(a: f16) callconv(.C) u128 { +pub fn __fixunshfti(a: f16) callconv(.C) u128 { return floatToInt(u128, a); } diff --git a/lib/compiler_rt/fixunssfdi.zig b/lib/compiler_rt/fixunssfdi.zig index 223bbcc2b5..544dfcd97e 100644 --- a/lib/compiler_rt/fixunssfdi.zig +++ b/lib/compiler_rt/fixunssfdi.zig @@ -11,7 +11,7 @@ comptime { } } -fn __fixunssfdi(a: f32) callconv(.C) u64 { +pub fn __fixunssfdi(a: f32) callconv(.C) u64 { return floatToInt(u64, a); } diff --git a/lib/compiler_rt/fixunssfsi.zig b/lib/compiler_rt/fixunssfsi.zig index 0a113af529..24b1e86694 100644 --- a/lib/compiler_rt/fixunssfsi.zig +++ b/lib/compiler_rt/fixunssfsi.zig @@ -11,7 +11,7 @@ comptime { } } -fn __fixunssfsi(a: f32) callconv(.C) u32 { +pub fn __fixunssfsi(a: f32) callconv(.C) u32 { return floatToInt(u32, a); } diff --git a/lib/compiler_rt/fixunssfti.zig b/lib/compiler_rt/fixunssfti.zig index 6b7690784d..7b1965b5ab 100644 --- a/lib/compiler_rt/fixunssfti.zig +++ b/lib/compiler_rt/fixunssfti.zig @@ -7,6 +7,6 @@ comptime { @export(__fixunssfti, .{ .name = "__fixunssfti", .linkage = common.linkage }); } -fn __fixunssfti(a: f32) callconv(.C) u128 { +pub fn __fixunssfti(a: f32) callconv(.C) u128 { return floatToInt(u128, a); } diff --git a/lib/compiler_rt/fixunstfdi.zig b/lib/compiler_rt/fixunstfdi.zig index f8b9aa7ac4..0657bf20c1 100644 --- a/lib/compiler_rt/fixunstfdi.zig +++ b/lib/compiler_rt/fixunstfdi.zig @@ -13,7 +13,7 @@ comptime { } } -fn __fixunstfdi(a: f128) callconv(.C) u64 { +pub fn __fixunstfdi(a: f128) callconv(.C) u64 { return floatToInt(u64, a); } diff --git a/lib/compiler_rt/fixunstfsi.zig b/lib/compiler_rt/fixunstfsi.zig index 64f70af649..70725ddf38 100644 --- a/lib/compiler_rt/fixunstfsi.zig +++ b/lib/compiler_rt/fixunstfsi.zig @@ -13,7 +13,7 @@ comptime { } } -fn __fixunstfsi(a: f128) callconv(.C) u32 { +pub fn __fixunstfsi(a: f128) callconv(.C) u32 { return floatToInt(u32, a); } diff --git a/lib/compiler_rt/fixunstfti.zig b/lib/compiler_rt/fixunstfti.zig index ba3a3ed12e..5e39db1065 100644 --- a/lib/compiler_rt/fixunstfti.zig +++ b/lib/compiler_rt/fixunstfti.zig @@ -7,6 +7,6 @@ comptime { @export(__fixunstfti, .{ .name = "__fixunstfti", .linkage = common.linkage }); } -fn __fixunstfti(a: f128) callconv(.C) u128 { +pub fn __fixunstfti(a: f128) callconv(.C) u128 { return floatToInt(u128, a); } diff --git a/lib/compiler_rt/fixunsxfti.zig b/lib/compiler_rt/fixunsxfti.zig index f2cd85cf2f..acd41469be 100644 --- a/lib/compiler_rt/fixunsxfti.zig +++ b/lib/compiler_rt/fixunsxfti.zig @@ -7,6 +7,6 @@ comptime { @export(__fixunsxfti, .{ .name = "__fixunsxfti", .linkage = common.linkage }); } -fn __fixunsxfti(a: f80) callconv(.C) u128 { +pub fn __fixunsxfti(a: f80) callconv(.C) u128 { return floatToInt(u128, a); } diff --git a/lib/compiler_rt/float_to_int_test.zig b/lib/compiler_rt/float_to_int_test.zig index 00ed455609..676c12e914 100644 --- a/lib/compiler_rt/float_to_int_test.zig +++ b/lib/compiler_rt/float_to_int_test.zig @@ -1,31 +1,33 @@ const std = @import("std"); const testing = std.testing; const math = std.math; -const fixXfYi = @import("fixXfYi.zig").fixXfYi; + +const __fixunshfti = @import("fixunshfti.zig").__fixunshfti; +const __fixunsxfti = @import("fixunsxfti.zig").__fixunsxfti; // Conversion from f32 -const __fixsfsi = @import("fixXfYi.zig").__fixsfsi; -const __fixunssfsi = @import("fixXfYi.zig").__fixunssfsi; -const __fixsfdi = @import("fixXfYi.zig").__fixsfdi; -const __fixunssfdi = @import("fixXfYi.zig").__fixunssfdi; -const __fixsfti = @import("fixXfYi.zig").__fixsfti; -const __fixunssfti = @import("fixXfYi.zig").__fixunssfti; +const __fixsfsi = @import("fixsfsi.zig").__fixsfsi; +const __fixunssfsi = @import("fixunssfsi.zig").__fixunssfsi; +const __fixsfdi = @import("fixsfdi.zig").__fixsfdi; +const __fixunssfdi = @import("fixunssfdi.zig").__fixunssfdi; +const __fixsfti = @import("fixsfti.zig").__fixsfti; +const __fixunssfti = @import("fixunssfti.zig").__fixunssfti; // Conversion from f64 -const __fixdfsi = @import("fixXfYi.zig").__fixdfsi; -const __fixunsdfsi = @import("fixXfYi.zig").__fixunsdfsi; -const __fixdfdi = @import("fixXfYi.zig").__fixdfdi; -const __fixunsdfdi = @import("fixXfYi.zig").__fixunsdfdi; -const __fixdfti = @import("fixXfYi.zig").__fixdfti; -const __fixunsdfti = @import("fixXfYi.zig").__fixunsdfti; +const __fixdfsi = @import("fixdfsi.zig").__fixdfsi; +const __fixunsdfsi = @import("fixunsdfsi.zig").__fixunsdfsi; +const __fixdfdi = @import("fixdfdi.zig").__fixdfdi; +const __fixunsdfdi = @import("fixunsdfdi.zig").__fixunsdfdi; +const __fixdfti = @import("fixdfti.zig").__fixdfti; +const __fixunsdfti = @import("fixunsdfti.zig").__fixunsdfti; // Conversion from f128 -const __fixtfsi = @import("fixXfYi.zig").__fixtfsi; -const __fixunstfsi = @import("fixXfYi.zig").__fixunstfsi; -const __fixtfdi = @import("fixXfYi.zig").__fixtfdi; -const __fixunstfdi = @import("fixXfYi.zig").__fixunstfdi; -const __fixtfti = @import("fixXfYi.zig").__fixtfti; -const __fixunstfti = @import("fixXfYi.zig").__fixunstfti; +const __fixtfsi = @import("fixtfsi.zig").__fixtfsi; +const __fixunstfsi = @import("fixunstfsi.zig").__fixunstfsi; +const __fixtfdi = @import("fixtfdi.zig").__fixtfdi; +const __fixunstfdi = @import("fixunstfdi.zig").__fixunstfdi; +const __fixtfti = @import("fixtfti.zig").__fixtfti; +const __fixunstfti = @import("fixunstfti.zig").__fixunstfti; fn test__fixsfsi(a: f32, expected: i32) !void { const x = __fixsfsi(a); @@ -927,21 +929,21 @@ test "fixunstfti" { } fn test__fixunshfti(a: f16, expected: u128) !void { - const x = fixXfYi(u128, a); + const x = __fixunshfti(a); try testing.expect(x == expected); } -test "fixXfYi for f16" { +test "fixunshfti for f16" { try test__fixunshfti(math.inf(f16), math.maxInt(u128)); try test__fixunshfti(math.floatMax(f16), 65504); } fn test__fixunsxfti(a: f80, expected: u128) !void { - const x = fixXfYi(u128, a); + const x = __fixunsxfti(a); try testing.expect(x == expected); } -test "fixXfYi for f80" { +test "fixunsxfti for f80" { try test__fixunsxfti(math.inf(f80), math.maxInt(u128)); try test__fixunsxfti(math.floatMax(f80), math.maxInt(u128)); try test__fixunsxfti(math.maxInt(u64), math.maxInt(u64)); diff --git a/lib/compiler_rt/floatdidf.zig b/lib/compiler_rt/floatdidf.zig index 9a0ecc6ed4..9117e2189d 100644 --- a/lib/compiler_rt/floatdidf.zig +++ b/lib/compiler_rt/floatdidf.zig @@ -11,7 +11,7 @@ comptime { } } -fn __floatdidf(a: i64) callconv(.C) f64 { +pub fn __floatdidf(a: i64) callconv(.C) f64 { return intToFloat(f64, a); } diff --git a/lib/compiler_rt/floatdisf.zig b/lib/compiler_rt/floatdisf.zig index d2ad3bb04b..3de94c5103 100644 --- a/lib/compiler_rt/floatdisf.zig +++ b/lib/compiler_rt/floatdisf.zig @@ -11,7 +11,7 @@ comptime { } } -fn __floatdisf(a: i64) callconv(.C) f32 { +pub fn __floatdisf(a: i64) callconv(.C) f32 { return intToFloat(f32, a); } diff --git a/lib/compiler_rt/floatditf.zig b/lib/compiler_rt/floatditf.zig index eb1ce3337b..731c6d8d86 100644 --- a/lib/compiler_rt/floatditf.zig +++ b/lib/compiler_rt/floatditf.zig @@ -13,7 +13,7 @@ comptime { } } -fn __floatditf(a: i64) callconv(.C) f128 { +pub fn __floatditf(a: i64) callconv(.C) f128 { return intToFloat(f128, a); } diff --git a/lib/compiler_rt/floatsidf.zig b/lib/compiler_rt/floatsidf.zig index 1775b08032..e31c2616fd 100644 --- a/lib/compiler_rt/floatsidf.zig +++ b/lib/compiler_rt/floatsidf.zig @@ -11,7 +11,7 @@ comptime { } } -fn __floatsidf(a: i32) callconv(.C) f64 { +pub fn __floatsidf(a: i32) callconv(.C) f64 { return intToFloat(f64, a); } diff --git a/lib/compiler_rt/floatsisf.zig b/lib/compiler_rt/floatsisf.zig index 45c7f8d6e4..87f83315c1 100644 --- a/lib/compiler_rt/floatsisf.zig +++ b/lib/compiler_rt/floatsisf.zig @@ -11,7 +11,7 @@ comptime { } } -fn __floatsisf(a: i32) callconv(.C) f32 { +pub fn __floatsisf(a: i32) callconv(.C) f32 { return intToFloat(f32, a); } diff --git a/lib/compiler_rt/floatsitf.zig b/lib/compiler_rt/floatsitf.zig index 0f43800436..0954199170 100644 --- a/lib/compiler_rt/floatsitf.zig +++ b/lib/compiler_rt/floatsitf.zig @@ -13,7 +13,7 @@ comptime { } } -fn __floatsitf(a: i32) callconv(.C) f128 { +pub fn __floatsitf(a: i32) callconv(.C) f128 { return intToFloat(f128, a); } diff --git a/lib/compiler_rt/floattidf.zig b/lib/compiler_rt/floattidf.zig index 54fff192c7..1f1ac2f2ef 100644 --- a/lib/compiler_rt/floattidf.zig +++ b/lib/compiler_rt/floattidf.zig @@ -7,6 +7,6 @@ comptime { @export(__floattidf, .{ .name = "__floattidf", .linkage = common.linkage }); } -fn __floattidf(a: i128) callconv(.C) f64 { +pub fn __floattidf(a: i128) callconv(.C) f64 { return intToFloat(f64, a); } diff --git a/lib/compiler_rt/floattisf.zig b/lib/compiler_rt/floattisf.zig index bc161d039f..5eb493d09b 100644 --- a/lib/compiler_rt/floattisf.zig +++ b/lib/compiler_rt/floattisf.zig @@ -7,6 +7,6 @@ comptime { @export(__floattisf, .{ .name = "__floattisf", .linkage = common.linkage }); } -fn __floattisf(a: i128) callconv(.C) f32 { +pub fn __floattisf(a: i128) callconv(.C) f32 { return intToFloat(f32, a); } diff --git a/lib/compiler_rt/floattitf.zig b/lib/compiler_rt/floattitf.zig index bcd75d8d83..0764c2d2c2 100644 --- a/lib/compiler_rt/floattitf.zig +++ b/lib/compiler_rt/floattitf.zig @@ -7,6 +7,6 @@ comptime { @export(__floattitf, .{ .name = "__floattitf", .linkage = common.linkage }); } -fn __floattitf(a: i128) callconv(.C) f128 { +pub fn __floattitf(a: i128) callconv(.C) f128 { return intToFloat(f128, a); } diff --git a/lib/compiler_rt/floatundidf.zig b/lib/compiler_rt/floatundidf.zig index aed9f42139..d49575639e 100644 --- a/lib/compiler_rt/floatundidf.zig +++ b/lib/compiler_rt/floatundidf.zig @@ -11,7 +11,7 @@ comptime { } } -fn __floatundidf(a: u64) callconv(.C) f64 { +pub fn __floatundidf(a: u64) callconv(.C) f64 { return intToFloat(f64, a); } diff --git a/lib/compiler_rt/floatundisf.zig b/lib/compiler_rt/floatundisf.zig index 1e6094cead..963670d85b 100644 --- a/lib/compiler_rt/floatundisf.zig +++ b/lib/compiler_rt/floatundisf.zig @@ -11,7 +11,7 @@ comptime { } } -fn __floatundisf(a: u64) callconv(.C) f32 { +pub fn __floatundisf(a: u64) callconv(.C) f32 { return intToFloat(f32, a); } diff --git a/lib/compiler_rt/floatunditf.zig b/lib/compiler_rt/floatunditf.zig index ed752e40c2..1eda21891d 100644 --- a/lib/compiler_rt/floatunditf.zig +++ b/lib/compiler_rt/floatunditf.zig @@ -13,7 +13,7 @@ comptime { } } -fn __floatunditf(a: u64) callconv(.C) f128 { +pub fn __floatunditf(a: u64) callconv(.C) f128 { return intToFloat(f128, a); } diff --git a/lib/compiler_rt/floatunsidf.zig b/lib/compiler_rt/floatunsidf.zig index 472167841b..1f5a47287a 100644 --- a/lib/compiler_rt/floatunsidf.zig +++ b/lib/compiler_rt/floatunsidf.zig @@ -11,7 +11,7 @@ comptime { } } -fn __floatunsidf(a: u32) callconv(.C) f64 { +pub fn __floatunsidf(a: u32) callconv(.C) f64 { return intToFloat(f64, a); } diff --git a/lib/compiler_rt/floatunsihf.zig b/lib/compiler_rt/floatunsihf.zig index c95de9c536..b2f679c18c 100644 --- a/lib/compiler_rt/floatunsihf.zig +++ b/lib/compiler_rt/floatunsihf.zig @@ -7,6 +7,6 @@ comptime { @export(__floatunsihf, .{ .name = "__floatunsihf", .linkage = common.linkage }); } -fn __floatunsihf(a: u32) callconv(.C) f16 { +pub fn __floatunsihf(a: u32) callconv(.C) f16 { return intToFloat(f16, a); } diff --git a/lib/compiler_rt/floatunsisf.zig b/lib/compiler_rt/floatunsisf.zig index b2956e9e28..46f336a4d8 100644 --- a/lib/compiler_rt/floatunsisf.zig +++ b/lib/compiler_rt/floatunsisf.zig @@ -11,7 +11,7 @@ comptime { } } -fn __floatunsisf(a: u32) callconv(.C) f32 { +pub fn __floatunsisf(a: u32) callconv(.C) f32 { return intToFloat(f32, a); } diff --git a/lib/compiler_rt/floatunsitf.zig b/lib/compiler_rt/floatunsitf.zig index 54d099c82a..bee656c801 100644 --- a/lib/compiler_rt/floatunsitf.zig +++ b/lib/compiler_rt/floatunsitf.zig @@ -13,7 +13,7 @@ comptime { } } -fn __floatunsitf(a: u32) callconv(.C) f128 { +pub fn __floatunsitf(a: u32) callconv(.C) f128 { return intToFloat(f128, a); } diff --git a/lib/compiler_rt/floatuntidf.zig b/lib/compiler_rt/floatuntidf.zig index 5b35379d38..a77a952fe9 100644 --- a/lib/compiler_rt/floatuntidf.zig +++ b/lib/compiler_rt/floatuntidf.zig @@ -7,6 +7,6 @@ comptime { @export(__floatuntidf, .{ .name = "__floatuntidf", .linkage = common.linkage }); } -fn __floatuntidf(a: u128) callconv(.C) f64 { +pub fn __floatuntidf(a: u128) callconv(.C) f64 { return intToFloat(f64, a); } diff --git a/lib/compiler_rt/floatuntisf.zig b/lib/compiler_rt/floatuntisf.zig index a3799e50b3..3edf636987 100644 --- a/lib/compiler_rt/floatuntisf.zig +++ b/lib/compiler_rt/floatuntisf.zig @@ -7,6 +7,6 @@ comptime { @export(__floatuntisf, .{ .name = "__floatuntisf", .linkage = common.linkage }); } -fn __floatuntisf(a: u128) callconv(.C) f32 { +pub fn __floatuntisf(a: u128) callconv(.C) f32 { return intToFloat(f32, a); } diff --git a/lib/compiler_rt/floatuntitf.zig b/lib/compiler_rt/floatuntitf.zig index c1b4b21d56..1a755cccdb 100644 --- a/lib/compiler_rt/floatuntitf.zig +++ b/lib/compiler_rt/floatuntitf.zig @@ -11,7 +11,7 @@ comptime { } } -fn __floatuntitf(a: u128) callconv(.C) f128 { +pub fn __floatuntitf(a: u128) callconv(.C) f128 { return intToFloat(f128, a); } diff --git a/lib/compiler_rt/gedf2.zig b/lib/compiler_rt/gedf2.zig index 816d690fa0..dad6586861 100644 --- a/lib/compiler_rt/gedf2.zig +++ b/lib/compiler_rt/gedf2.zig @@ -17,13 +17,13 @@ comptime { /// "These functions return a value greater than or equal to zero if neither /// argument is NaN, and a is greater than or equal to b." -fn __gedf2(a: f64, b: f64) callconv(.C) i32 { +pub fn __gedf2(a: f64, b: f64) callconv(.C) i32 { return @enumToInt(comparef.cmpf2(f64, comparef.GE, a, b)); } /// "These functions return a value greater than zero if neither argument is NaN, /// and a is strictly greater than b." -fn __gtdf2(a: f64, b: f64) callconv(.C) i32 { +pub fn __gtdf2(a: f64, b: f64) callconv(.C) i32 { return __gedf2(a, b); } diff --git a/lib/compiler_rt/gesf2.zig b/lib/compiler_rt/gesf2.zig index f29cd173a5..266e2f9c35 100644 --- a/lib/compiler_rt/gesf2.zig +++ b/lib/compiler_rt/gesf2.zig @@ -17,13 +17,13 @@ comptime { /// "These functions return a value greater than or equal to zero if neither /// argument is NaN, and a is greater than or equal to b." -fn __gesf2(a: f32, b: f32) callconv(.C) i32 { +pub fn __gesf2(a: f32, b: f32) callconv(.C) i32 { return @enumToInt(comparef.cmpf2(f32, comparef.GE, a, b)); } /// "These functions return a value greater than zero if neither argument is NaN, /// and a is strictly greater than b." -fn __gtsf2(a: f32, b: f32) callconv(.C) i32 { +pub fn __gtsf2(a: f32, b: f32) callconv(.C) i32 { return __gesf2(a, b); } diff --git a/lib/compiler_rt/int_to_float.zig b/lib/compiler_rt/int_to_float.zig index 135f9e1dbb..233dfec815 100644 --- a/lib/compiler_rt/int_to_float.zig +++ b/lib/compiler_rt/int_to_float.zig @@ -54,5 +54,5 @@ pub fn intToFloat(comptime T: type, x: anytype) T { } test { - _ = @import("floatXiYf_test.zig"); + _ = @import("int_to_float_test.zig"); } diff --git a/lib/compiler_rt/floatXiYf_test.zig b/lib/compiler_rt/int_to_float_test.zig similarity index 90% rename from lib/compiler_rt/floatXiYf_test.zig rename to lib/compiler_rt/int_to_float_test.zig index cffa2a5b42..f6eabbf4ba 100644 --- a/lib/compiler_rt/floatXiYf_test.zig +++ b/lib/compiler_rt/int_to_float_test.zig @@ -2,31 +2,32 @@ const std = @import("std"); const builtin = @import("builtin"); const testing = std.testing; const math = std.math; -const floatXiYf = @import("floatXiYf.zig").floatXiYf; + +const __floatunsihf = @import("floatunsihf.zig").__floatunsihf; // Conversion to f32 -const __floatsisf = @import("floatXiYf.zig").__floatsisf; -const __floatunsisf = @import("floatXiYf.zig").__floatunsisf; -const __floatdisf = @import("floatXiYf.zig").__floatdisf; -const __floatundisf = @import("floatXiYf.zig").__floatundisf; -const __floattisf = @import("floatXiYf.zig").__floattisf; -const __floatuntisf = @import("floatXiYf.zig").__floatuntisf; +const __floatsisf = @import("floatsisf.zig").__floatsisf; +const __floatunsisf = @import("floatunsisf.zig").__floatunsisf; +const __floatdisf = @import("floatdisf.zig").__floatdisf; +const __floatundisf = @import("floatundisf.zig").__floatundisf; +const __floattisf = @import("floattisf.zig").__floattisf; +const __floatuntisf = @import("floatuntisf.zig").__floatuntisf; // Conversion to f64 -const __floatsidf = @import("floatXiYf.zig").__floatsidf; -const __floatunsidf = @import("floatXiYf.zig").__floatunsidf; -const __floatdidf = @import("floatXiYf.zig").__floatdidf; -const __floatundidf = @import("floatXiYf.zig").__floatundidf; -const __floattidf = @import("floatXiYf.zig").__floattidf; -const __floatuntidf = @import("floatXiYf.zig").__floatuntidf; +const __floatsidf = @import("floatsidf.zig").__floatsidf; +const __floatunsidf = @import("floatunsidf.zig").__floatunsidf; +const __floatdidf = @import("floatdidf.zig").__floatdidf; +const __floatundidf = @import("floatundidf.zig").__floatundidf; +const __floattidf = @import("floattidf.zig").__floattidf; +const __floatuntidf = @import("floatuntidf.zig").__floatuntidf; // Conversion to f128 -const __floatsitf = @import("floatXiYf.zig").__floatsitf; -const __floatunsitf = @import("floatXiYf.zig").__floatunsitf; -const __floatditf = @import("floatXiYf.zig").__floatditf; -const __floatunditf = @import("floatXiYf.zig").__floatunditf; -const __floattitf = @import("floatXiYf.zig").__floattitf; -const __floatuntitf = @import("floatXiYf.zig").__floatuntitf; +const __floatsitf = @import("floatsitf.zig").__floatsitf; +const __floatunsitf = @import("floatunsitf.zig").__floatunsitf; +const __floatditf = @import("floatditf.zig").__floatditf; +const __floatunditf = @import("floatunditf.zig").__floatunditf; +const __floattitf = @import("floattitf.zig").__floattitf; +const __floatuntitf = @import("floatuntitf.zig").__floatuntitf; fn test__floatsisf(a: i32, expected: u32) !void { const r = __floatsisf(a); @@ -791,45 +792,47 @@ fn make_tf(high: u64, low: u64) f128 { } test "conversion to f16" { - try testing.expect(floatXiYf(f16, @as(u32, 0)) == 0.0); - try testing.expect(floatXiYf(f16, @as(u32, 1)) == 1.0); - try testing.expect(floatXiYf(f16, @as(u32, 65504)) == 65504); - try testing.expect(floatXiYf(f16, @as(u32, 65504 + (1 << 4))) == math.inf(f16)); + try testing.expect(__floatunsihf(@as(u32, 0)) == 0.0); + try testing.expect(__floatunsihf(@as(u32, 1)) == 1.0); + try testing.expect(__floatunsihf(@as(u32, 65504)) == 65504); + try testing.expect(__floatunsihf(@as(u32, 65504 + (1 << 4))) == math.inf(f16)); } test "conversion to f32" { - try testing.expect(floatXiYf(f32, @as(u32, 0)) == 0.0); - try testing.expect(floatXiYf(f32, @as(u32, math.maxInt(u32))) != 1.0); - try testing.expect(floatXiYf(f32, @as(i32, math.minInt(i32))) != 1.0); - try testing.expect(floatXiYf(f32, @as(u32, math.maxInt(u24))) == math.maxInt(u24)); - try testing.expect(floatXiYf(f32, @as(u32, math.maxInt(u24)) + 1) == math.maxInt(u24) + 1); // 0x100_0000 - Exact - try testing.expect(floatXiYf(f32, @as(u32, math.maxInt(u24)) + 2) == math.maxInt(u24) + 1); // 0x100_0001 - Tie: Rounds down to even - try testing.expect(floatXiYf(f32, @as(u32, math.maxInt(u24)) + 3) == math.maxInt(u24) + 3); // 0x100_0002 - Exact - try testing.expect(floatXiYf(f32, @as(u32, math.maxInt(u24)) + 4) == math.maxInt(u24) + 5); // 0x100_0003 - Tie: Rounds up to even - try testing.expect(floatXiYf(f32, @as(u32, math.maxInt(u24)) + 5) == math.maxInt(u24) + 5); // 0x100_0004 - Exact + try testing.expect(__floatunsisf(@as(u32, 0)) == 0.0); + try testing.expect(__floatunsisf(@as(u32, math.maxInt(u32))) != 1.0); + try testing.expect(__floatsisf(@as(i32, math.minInt(i32))) != 1.0); + try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24))) == math.maxInt(u24)); + try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24)) + 1) == math.maxInt(u24) + 1); // 0x100_0000 - Exact + try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24)) + 2) == math.maxInt(u24) + 1); // 0x100_0001 - Tie: Rounds down to even + try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24)) + 3) == math.maxInt(u24) + 3); // 0x100_0002 - Exact + try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24)) + 4) == math.maxInt(u24) + 5); // 0x100_0003 - Tie: Rounds up to even + try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24)) + 5) == math.maxInt(u24) + 5); // 0x100_0004 - Exact } test "conversion to f80" { if (builtin.zig_backend == .stage1 and builtin.cpu.arch != .x86_64) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/11408 - try testing.expect(floatXiYf(f80, @as(i80, -12)) == -12); - try testing.expect(@floatToInt(u80, floatXiYf(f80, @as(u64, math.maxInt(u64)) + 0)) == math.maxInt(u64) + 0); - try testing.expect(@floatToInt(u80, floatXiYf(f80, @as(u80, math.maxInt(u64)) + 1)) == math.maxInt(u64) + 1); + const intToFloat = @import("./int_to_float.zig").intToFloat; - try testing.expect(floatXiYf(f80, @as(u32, 0)) == 0.0); - try testing.expect(floatXiYf(f80, @as(u32, 1)) == 1.0); - try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u32, math.maxInt(u24)) + 0)) == math.maxInt(u24)); - try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u64)) + 0)) == math.maxInt(u64)); - try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u64)) + 1)) == math.maxInt(u64) + 1); // Exact - try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u64)) + 2)) == math.maxInt(u64) + 1); // Rounds down - try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u64)) + 3)) == math.maxInt(u64) + 3); // Tie - Exact - try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u64)) + 4)) == math.maxInt(u64) + 5); // Rounds up + try testing.expect(intToFloat(f80, @as(i80, -12)) == -12); + try testing.expect(@floatToInt(u80, intToFloat(f80, @as(u64, math.maxInt(u64)) + 0)) == math.maxInt(u64) + 0); + try testing.expect(@floatToInt(u80, intToFloat(f80, @as(u80, math.maxInt(u64)) + 1)) == math.maxInt(u64) + 1); - try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u65)) + 0)) == math.maxInt(u65) + 1); // Rounds up - try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u65)) + 1)) == math.maxInt(u65) + 1); // Exact - try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u65)) + 2)) == math.maxInt(u65) + 1); // Rounds down - try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u65)) + 3)) == math.maxInt(u65) + 1); // Tie - Rounds down - try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u65)) + 4)) == math.maxInt(u65) + 5); // Rounds up - try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u65)) + 5)) == math.maxInt(u65) + 5); // Exact + try testing.expect(intToFloat(f80, @as(u32, 0)) == 0.0); + try testing.expect(intToFloat(f80, @as(u32, 1)) == 1.0); + try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u32, math.maxInt(u24)) + 0)) == math.maxInt(u24)); + try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u64)) + 0)) == math.maxInt(u64)); + try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u64)) + 1)) == math.maxInt(u64) + 1); // Exact + try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u64)) + 2)) == math.maxInt(u64) + 1); // Rounds down + try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u64)) + 3)) == math.maxInt(u64) + 3); // Tie - Exact + try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u64)) + 4)) == math.maxInt(u64) + 5); // Rounds up + + try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u65)) + 0)) == math.maxInt(u65) + 1); // Rounds up + try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u65)) + 1)) == math.maxInt(u65) + 1); // Exact + try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u65)) + 2)) == math.maxInt(u65) + 1); // Rounds down + try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u65)) + 3)) == math.maxInt(u65) + 1); // Tie - Rounds down + try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u65)) + 4)) == math.maxInt(u65) + 5); // Rounds up + try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u65)) + 5)) == math.maxInt(u65) + 5); // Exact } diff --git a/lib/compiler_rt/muldf3.zig b/lib/compiler_rt/muldf3.zig index 5fcd6e13a4..ef7ab9fbf7 100644 --- a/lib/compiler_rt/muldf3.zig +++ b/lib/compiler_rt/muldf3.zig @@ -11,7 +11,7 @@ comptime { } } -fn __muldf3(a: f64, b: f64) callconv(.C) f64 { +pub fn __muldf3(a: f64, b: f64) callconv(.C) f64 { return mulf3(f64, a, b); } diff --git a/lib/compiler_rt/mulf3_test.zig b/lib/compiler_rt/mulf3_test.zig index 0c7d84c5e0..203745e632 100644 --- a/lib/compiler_rt/mulf3_test.zig +++ b/lib/compiler_rt/mulf3_test.zig @@ -7,10 +7,10 @@ const math = std.math; const qnan128 = @bitCast(f128, @as(u128, 0x7fff800000000000) << 64); const inf128 = @bitCast(f128, @as(u128, 0x7fff000000000000) << 64); -const __multf3 = @import("mulf3.zig").__multf3; -const __mulxf3 = @import("mulf3.zig").__mulxf3; -const __muldf3 = @import("mulf3.zig").__muldf3; -const __mulsf3 = @import("mulf3.zig").__mulsf3; +const __multf3 = @import("multf3.zig").__multf3; +const __mulxf3 = @import("mulxf3.zig").__mulxf3; +const __muldf3 = @import("muldf3.zig").__muldf3; +const __mulsf3 = @import("mulsf3.zig").__mulsf3; // return true if equal // use two 64-bit integers intead of one 128-bit integer diff --git a/lib/compiler_rt/mulsf3.zig b/lib/compiler_rt/mulsf3.zig index 50b2142694..3294f5b1c7 100644 --- a/lib/compiler_rt/mulsf3.zig +++ b/lib/compiler_rt/mulsf3.zig @@ -11,7 +11,7 @@ comptime { } } -fn __mulsf3(a: f32, b: f32) callconv(.C) f32 { +pub fn __mulsf3(a: f32, b: f32) callconv(.C) f32 { return mulf3(f32, a, b); } diff --git a/lib/compiler_rt/multf3.zig b/lib/compiler_rt/multf3.zig index b18f5912a5..d4449ab72e 100644 --- a/lib/compiler_rt/multf3.zig +++ b/lib/compiler_rt/multf3.zig @@ -13,7 +13,7 @@ comptime { } } -fn __multf3(a: f128, b: f128) callconv(.C) f128 { +pub fn __multf3(a: f128, b: f128) callconv(.C) f128 { return mulf3(f128, a, b); } diff --git a/lib/compiler_rt/subtf3.zig b/lib/compiler_rt/subtf3.zig index aa50f73da8..9477f96917 100644 --- a/lib/compiler_rt/subtf3.zig +++ b/lib/compiler_rt/subtf3.zig @@ -12,7 +12,7 @@ comptime { } } -fn __subtf3(a: f128, b: f128) callconv(.C) f128 { +pub fn __subtf3(a: f128, b: f128) callconv(.C) f128 { return sub(a, b); } diff --git a/lib/compiler_rt/truncdfhf2.zig b/lib/compiler_rt/truncdfhf2.zig index 6d4135d249..a2d3bf1402 100644 --- a/lib/compiler_rt/truncdfhf2.zig +++ b/lib/compiler_rt/truncdfhf2.zig @@ -11,7 +11,7 @@ comptime { } } -fn __truncdfhf2(a: f64) callconv(.C) common.F16T { +pub fn __truncdfhf2(a: f64) callconv(.C) common.F16T { return @bitCast(common.F16T, truncf(f16, f64, a)); } diff --git a/lib/compiler_rt/truncdfsf2.zig b/lib/compiler_rt/truncdfsf2.zig index adf7705821..126dfff0fd 100644 --- a/lib/compiler_rt/truncdfsf2.zig +++ b/lib/compiler_rt/truncdfsf2.zig @@ -11,7 +11,7 @@ comptime { } } -fn __truncdfsf2(a: f64) callconv(.C) f32 { +pub fn __truncdfsf2(a: f64) callconv(.C) f32 { return truncf(f32, f64, a); } diff --git a/lib/compiler_rt/truncf_test.zig b/lib/compiler_rt/truncf_test.zig index 58c02a0a21..d4e93cd114 100644 --- a/lib/compiler_rt/truncf_test.zig +++ b/lib/compiler_rt/truncf_test.zig @@ -1,6 +1,12 @@ const std = @import("std"); const testing = std.testing; -const __truncsfhf2 = @import("truncXfYf2.zig").__truncsfhf2; + +const __truncsfhf2 = @import("truncsfhf2.zig").__truncsfhf2; +const __truncdfhf2 = @import("truncdfhf2.zig").__truncdfhf2; +const __truncdfsf2 = @import("truncdfsf2.zig").__truncdfsf2; +const __trunctfhf2 = @import("trunctfhf2.zig").__trunctfhf2; +const __trunctfsf2 = @import("trunctfsf2.zig").__trunctfsf2; +const __trunctfdf2 = @import("trunctfdf2.zig").__trunctfdf2; const __trunctfxf2 = @import("trunctfxf2.zig").__trunctfxf2; fn test__truncsfhf2(a: u32, expected: u16) !void { @@ -66,8 +72,6 @@ test "truncsfhf2" { try test__truncsfhf2(0x33000000, 0x0000); // 0x1.0p-25 -> zero } -const __truncdfhf2 = @import("truncXfYf2.zig").__truncdfhf2; - fn test__truncdfhf2(a: f64, expected: u16) void { const rep = @bitCast(u16, __truncdfhf2(a)); @@ -134,8 +138,6 @@ test "truncdfhf2" { test__truncdfhf2(65536.0, 0x7c00); } -const __trunctfsf2 = @import("truncXfYf2.zig").__trunctfsf2; - fn test__trunctfsf2(a: f128, expected: u32) void { const x = __trunctfsf2(a); @@ -169,8 +171,6 @@ test "trunctfsf2" { test__trunctfsf2(0x1.edcba9bb8c76a5a43dd21f334634p-435, 0x0); } -const __trunctfdf2 = @import("truncXfYf2.zig").__trunctfdf2; - fn test__trunctfdf2(a: f128, expected: u64) void { const x = __trunctfdf2(a); @@ -204,8 +204,6 @@ test "trunctfdf2" { test__trunctfdf2(0x1.edcbff8ad76ab5bf46463233214fp-435, 0x24cedcbff8ad76ab); } -const __truncdfsf2 = @import("truncXfYf2.zig").__truncdfsf2; - fn test__truncdfsf2(a: f64, expected: u32) void { const x = __truncdfsf2(a); @@ -241,8 +239,6 @@ test "truncdfsf2" { test__truncdfsf2(340282366920938463463374607431768211456.0, 0x7f800000); } -const __trunctfhf2 = @import("truncXfYf2.zig").__trunctfhf2; - fn test__trunctfhf2(a: f128, expected: u16) void { const x = __trunctfhf2(a); diff --git a/lib/compiler_rt/truncsfhf2.zig b/lib/compiler_rt/truncsfhf2.zig index 5fe0f329b6..329b3332a2 100644 --- a/lib/compiler_rt/truncsfhf2.zig +++ b/lib/compiler_rt/truncsfhf2.zig @@ -13,7 +13,7 @@ comptime { } } -fn __truncsfhf2(a: f32) callconv(.C) common.F16T { +pub fn __truncsfhf2(a: f32) callconv(.C) common.F16T { return @bitCast(common.F16T, truncf(f16, f32, a)); } diff --git a/lib/compiler_rt/trunctfdf2.zig b/lib/compiler_rt/trunctfdf2.zig index 3fe16ad6a2..e084d63d88 100644 --- a/lib/compiler_rt/trunctfdf2.zig +++ b/lib/compiler_rt/trunctfdf2.zig @@ -13,7 +13,7 @@ comptime { } } -fn __trunctfdf2(a: f128) callconv(.C) f64 { +pub fn __trunctfdf2(a: f128) callconv(.C) f64 { return truncf(f64, f128, a); } diff --git a/lib/compiler_rt/trunctfhf2.zig b/lib/compiler_rt/trunctfhf2.zig index a81cc138f1..b764a78455 100644 --- a/lib/compiler_rt/trunctfhf2.zig +++ b/lib/compiler_rt/trunctfhf2.zig @@ -7,6 +7,6 @@ comptime { @export(__trunctfhf2, .{ .name = "__trunctfhf2", .linkage = common.linkage }); } -fn __trunctfhf2(a: f128) callconv(.C) common.F16T { +pub fn __trunctfhf2(a: f128) callconv(.C) common.F16T { return @bitCast(common.F16T, truncf(f16, f128, a)); } diff --git a/lib/compiler_rt/trunctfsf2.zig b/lib/compiler_rt/trunctfsf2.zig index f507f5ad2b..0fcd5e1e08 100644 --- a/lib/compiler_rt/trunctfsf2.zig +++ b/lib/compiler_rt/trunctfsf2.zig @@ -13,7 +13,7 @@ comptime { } } -fn __trunctfsf2(a: f128) callconv(.C) f32 { +pub fn __trunctfsf2(a: f128) callconv(.C) f32 { return truncf(f32, f128, a); } diff --git a/lib/compiler_rt/trunctfxf2.zig b/lib/compiler_rt/trunctfxf2.zig index 0cb7f86a1f..731f58f192 100644 --- a/lib/compiler_rt/trunctfxf2.zig +++ b/lib/compiler_rt/trunctfxf2.zig @@ -8,7 +8,7 @@ comptime { @export(__trunctfxf2, .{ .name = "__trunctfxf2", .linkage = common.linkage }); } -fn __trunctfxf2(a: f128) callconv(.C) f80 { +pub fn __trunctfxf2(a: f128) callconv(.C) f80 { const src_sig_bits = math.floatMantissaBits(f128); const dst_sig_bits = math.floatMantissaBits(f80) - 1; // -1 for the integer bit diff --git a/lib/compiler_rt/unorddf2.zig b/lib/compiler_rt/unorddf2.zig index a6538f99d5..66910a18bf 100644 --- a/lib/compiler_rt/unorddf2.zig +++ b/lib/compiler_rt/unorddf2.zig @@ -11,7 +11,7 @@ comptime { } } -fn __unorddf2(a: f64, b: f64) callconv(.C) i32 { +pub fn __unorddf2(a: f64, b: f64) callconv(.C) i32 { return comparef.unordcmp(f64, a, b); } diff --git a/lib/compiler_rt/unordsf2.zig b/lib/compiler_rt/unordsf2.zig index 1dc7eb178e..78b388a75e 100644 --- a/lib/compiler_rt/unordsf2.zig +++ b/lib/compiler_rt/unordsf2.zig @@ -11,7 +11,7 @@ comptime { } } -fn __unordsf2(a: f32, b: f32) callconv(.C) i32 { +pub fn __unordsf2(a: f32, b: f32) callconv(.C) i32 { return comparef.unordcmp(f32, a, b); }