2022-06-16 07:09:56 +01:00
|
|
|
const common = @import("./common.zig");
|
2023-08-18 07:22:40 +01:00
|
|
|
const addf3 = @import("./addf3.zig").addf3;
|
2022-06-16 07:09:56 +01:00
|
|
|
|
|
|
|
pub const panic = common.panic;
|
|
|
|
|
|
|
|
comptime {
|
|
|
|
if (common.want_aeabi) {
|
2022-12-28 13:57:17 +00:00
|
|
|
@export(__aeabi_fsub, .{ .name = "__aeabi_fsub", .linkage = common.linkage, .visibility = common.visibility });
|
2022-06-16 07:09:56 +01:00
|
|
|
} else {
|
2022-12-28 13:57:17 +00:00
|
|
|
@export(__subsf3, .{ .name = "__subsf3", .linkage = common.linkage, .visibility = common.visibility });
|
2022-06-16 07:09:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn __subsf3(a: f32, b: f32) callconv(.C) f32 {
|
2023-08-18 07:22:40 +01:00
|
|
|
return sub(a, b);
|
2022-06-16 07:09:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
fn __aeabi_fsub(a: f32, b: f32) callconv(.AAPCS) f32 {
|
2023-08-18 07:22:40 +01:00
|
|
|
return sub(a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fn sub(a: f32, b: f32) f32 {
|
2023-06-22 18:46:56 +01:00
|
|
|
const neg_b = @as(f32, @bitCast(@as(u32, @bitCast(b)) ^ (@as(u32, 1) << 31)));
|
2023-08-18 07:22:40 +01:00
|
|
|
return addf3(f32, a, neg_b);
|
2022-06-16 07:09:56 +01:00
|
|
|
}
|