lib/compiler_rt/subdf3.zig (623B) - Raw
1 const compiler_rt = @import("../compiler_rt.zig"); 2 const addf3 = @import("./addf3.zig").addf3; 3 const symbol = @import("../compiler_rt.zig").symbol; 4 5 comptime { 6 if (compiler_rt.want_aeabi) { 7 symbol(&__aeabi_dsub, "__aeabi_dsub"); 8 } else { 9 symbol(&__subdf3, "__subdf3"); 10 } 11 } 12 13 fn __subdf3(a: f64, b: f64) callconv(.c) f64 { 14 return sub(a, b); 15 } 16 17 fn __aeabi_dsub(a: f64, b: f64) callconv(.{ .arm_aapcs = .{} }) f64 { 18 return sub(a, b); 19 } 20 21 inline fn sub(a: f64, b: f64) f64 { 22 const neg_b = @as(f64, @bitCast(@as(u64, @bitCast(b)) ^ (@as(u64, 1) << 63))); 23 return addf3(f64, a, neg_b); 24 }