2022-06-16 07:09:56 +01:00
|
|
|
const common = @import("./common.zig");
|
|
|
|
const truncf = @import("./truncf.zig").truncf;
|
|
|
|
|
|
|
|
pub const panic = common.panic;
|
|
|
|
|
|
|
|
comptime {
|
2022-06-18 03:25:06 +01:00
|
|
|
if (common.gnu_f16_abi) {
|
2022-12-28 13:57:17 +00:00
|
|
|
@export(__gnu_f2h_ieee, .{ .name = "__gnu_f2h_ieee", .linkage = common.linkage, .visibility = common.visibility });
|
2022-06-16 07:09:56 +01:00
|
|
|
} else if (common.want_aeabi) {
|
2022-12-28 13:57:17 +00:00
|
|
|
@export(__aeabi_f2h, .{ .name = "__aeabi_f2h", .linkage = common.linkage, .visibility = common.visibility });
|
2022-06-16 07:09:56 +01:00
|
|
|
}
|
2022-12-28 13:57:17 +00:00
|
|
|
@export(__truncsfhf2, .{ .name = "__truncsfhf2", .linkage = common.linkage, .visibility = common.visibility });
|
2022-06-16 07:09:56 +01:00
|
|
|
}
|
|
|
|
|
2023-03-28 02:32:37 +01:00
|
|
|
pub fn __truncsfhf2(a: f32) callconv(.C) common.F16T(f32) {
|
2023-08-19 08:32:47 +01:00
|
|
|
return @bitCast(truncf(f16, f32, a));
|
2022-06-16 07:09:56 +01:00
|
|
|
}
|
|
|
|
|
2023-03-28 02:32:37 +01:00
|
|
|
fn __gnu_f2h_ieee(a: f32) callconv(.C) common.F16T(f32) {
|
2023-08-19 08:32:47 +01:00
|
|
|
return @bitCast(truncf(f16, f32, a));
|
2022-12-05 21:52:21 +00:00
|
|
|
}
|
|
|
|
|
2022-06-16 07:09:56 +01:00
|
|
|
fn __aeabi_f2h(a: f32) callconv(.AAPCS) u16 {
|
2023-08-19 08:32:47 +01:00
|
|
|
return @bitCast(truncf(f16, f32, a));
|
2022-06-16 07:09:56 +01:00
|
|
|
}
|