compiler-rt: fix tests

This commit is contained in:
Andrew Kelley 2022-06-16 15:14:12 -07:00
parent 453243d9e0
commit bbc6103398
79 changed files with 225 additions and 207 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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 {

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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));
}

View File

@ -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");
}

View File

@ -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))
{

View File

@ -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));
}

View File

@ -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));
}

View File

@ -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));
}

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __fixdfdi(a: f64) callconv(.C) i64 {
pub fn __fixdfdi(a: f64) callconv(.C) i64 {
return floatToInt(i64, a);
}

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __fixdfsi(a: f64) callconv(.C) i32 {
pub fn __fixdfsi(a: f64) callconv(.C) i32 {
return floatToInt(i32, a);
}

View File

@ -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);
}

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __fixsfdi(a: f32) callconv(.C) i64 {
pub fn __fixsfdi(a: f32) callconv(.C) i64 {
return floatToInt(i64, a);
}

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __fixsfsi(a: f32) callconv(.C) i32 {
pub fn __fixsfsi(a: f32) callconv(.C) i32 {
return floatToInt(i32, a);
}

View File

@ -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);
}

View File

@ -13,7 +13,7 @@ comptime {
}
}
fn __fixtfdi(a: f128) callconv(.C) i64 {
pub fn __fixtfdi(a: f128) callconv(.C) i64 {
return floatToInt(i64, a);
}

View File

@ -13,7 +13,7 @@ comptime {
}
}
fn __fixtfsi(a: f128) callconv(.C) i32 {
pub fn __fixtfsi(a: f128) callconv(.C) i32 {
return floatToInt(i32, a);
}

View File

@ -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);
}

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __fixunsdfdi(a: f64) callconv(.C) u64 {
pub fn __fixunsdfdi(a: f64) callconv(.C) u64 {
return floatToInt(u64, a);
}

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __fixunsdfsi(a: f64) callconv(.C) u32 {
pub fn __fixunsdfsi(a: f64) callconv(.C) u32 {
return floatToInt(u32, a);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __fixunssfdi(a: f32) callconv(.C) u64 {
pub fn __fixunssfdi(a: f32) callconv(.C) u64 {
return floatToInt(u64, a);
}

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __fixunssfsi(a: f32) callconv(.C) u32 {
pub fn __fixunssfsi(a: f32) callconv(.C) u32 {
return floatToInt(u32, a);
}

View File

@ -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);
}

View File

@ -13,7 +13,7 @@ comptime {
}
}
fn __fixunstfdi(a: f128) callconv(.C) u64 {
pub fn __fixunstfdi(a: f128) callconv(.C) u64 {
return floatToInt(u64, a);
}

View File

@ -13,7 +13,7 @@ comptime {
}
}
fn __fixunstfsi(a: f128) callconv(.C) u32 {
pub fn __fixunstfsi(a: f128) callconv(.C) u32 {
return floatToInt(u32, a);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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));

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __floatdidf(a: i64) callconv(.C) f64 {
pub fn __floatdidf(a: i64) callconv(.C) f64 {
return intToFloat(f64, a);
}

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __floatdisf(a: i64) callconv(.C) f32 {
pub fn __floatdisf(a: i64) callconv(.C) f32 {
return intToFloat(f32, a);
}

View File

@ -13,7 +13,7 @@ comptime {
}
}
fn __floatditf(a: i64) callconv(.C) f128 {
pub fn __floatditf(a: i64) callconv(.C) f128 {
return intToFloat(f128, a);
}

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __floatsidf(a: i32) callconv(.C) f64 {
pub fn __floatsidf(a: i32) callconv(.C) f64 {
return intToFloat(f64, a);
}

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __floatsisf(a: i32) callconv(.C) f32 {
pub fn __floatsisf(a: i32) callconv(.C) f32 {
return intToFloat(f32, a);
}

View File

@ -13,7 +13,7 @@ comptime {
}
}
fn __floatsitf(a: i32) callconv(.C) f128 {
pub fn __floatsitf(a: i32) callconv(.C) f128 {
return intToFloat(f128, a);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __floatundidf(a: u64) callconv(.C) f64 {
pub fn __floatundidf(a: u64) callconv(.C) f64 {
return intToFloat(f64, a);
}

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __floatundisf(a: u64) callconv(.C) f32 {
pub fn __floatundisf(a: u64) callconv(.C) f32 {
return intToFloat(f32, a);
}

View File

@ -13,7 +13,7 @@ comptime {
}
}
fn __floatunditf(a: u64) callconv(.C) f128 {
pub fn __floatunditf(a: u64) callconv(.C) f128 {
return intToFloat(f128, a);
}

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __floatunsidf(a: u32) callconv(.C) f64 {
pub fn __floatunsidf(a: u32) callconv(.C) f64 {
return intToFloat(f64, a);
}

View File

@ -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);
}

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __floatunsisf(a: u32) callconv(.C) f32 {
pub fn __floatunsisf(a: u32) callconv(.C) f32 {
return intToFloat(f32, a);
}

View File

@ -13,7 +13,7 @@ comptime {
}
}
fn __floatunsitf(a: u32) callconv(.C) f128 {
pub fn __floatunsitf(a: u32) callconv(.C) f128 {
return intToFloat(f128, a);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -11,7 +11,7 @@ comptime {
}
}
fn __floatuntitf(a: u128) callconv(.C) f128 {
pub fn __floatuntitf(a: u128) callconv(.C) f128 {
return intToFloat(f128, a);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -54,5 +54,5 @@ pub fn intToFloat(comptime T: type, x: anytype) T {
}
test {
_ = @import("floatXiYf_test.zig");
_ = @import("int_to_float_test.zig");
}

View File

@ -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
}

View File

@ -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);
}

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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));
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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));
}

View File

@ -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);
}

View File

@ -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));
}

View File

@ -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);
}

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}