zig/lib/compiler_rt/extendhfsf2.zig
Andrew Kelley 74608293af compiler_rt: common -> compiler_rt
use the "symbol" helper function in all exports

move all declarations from common.zig to compiler_rt.zig

flatten the tree structure somewhat (move contents of tiny files into
parent files)

No functional changes.
2026-02-09 20:03:15 -08:00

24 lines
749 B
Zig

const compiler_rt = @import("../compiler_rt.zig");
const extendf = @import("./extendf.zig").extendf;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (compiler_rt.gnu_f16_abi) {
symbol(&__gnu_h2f_ieee, "__gnu_h2f_ieee");
} else if (compiler_rt.want_aeabi) {
symbol(&__aeabi_h2f, "__aeabi_h2f");
}
symbol(&__extendhfsf2, "__extendhfsf2");
}
pub fn __extendhfsf2(a: compiler_rt.F16T(f32)) callconv(.c) f32 {
return extendf(f32, f16, @as(u16, @bitCast(a)));
}
fn __gnu_h2f_ieee(a: compiler_rt.F16T(f32)) callconv(.c) f32 {
return extendf(f32, f16, @as(u16, @bitCast(a)));
}
fn __aeabi_h2f(a: u16) callconv(.{ .arm_aapcs = .{} }) f32 {
return extendf(f32, f16, @as(u16, @bitCast(a)));
}