zig/lib/compiler_rt/subhf3.zig
Cody Tapscott 0d533433e2 compiler_rt: Add missing f16 functions
This change also exposes some of the existing functions under both the
PPC-style names symbols and the compiler-rt-style names, since Zig
currently lowers softfloat calls to the latter.
2022-10-13 12:53:20 -07:00

13 lines
307 B
Zig

const common = @import("./common.zig");
pub const panic = common.panic;
comptime {
@export(__subhf3, .{ .name = "__subhf3", .linkage = common.linkage });
}
fn __subhf3(a: f16, b: f16) callconv(.C) f16 {
const neg_b = @bitCast(f16, @bitCast(u16, b) ^ (@as(u16, 1) << 15));
return a + neg_b;
}