Commit 25671f5a97
Changed files (24)
lib
lib/compiler_rt/addtf3.zig
@@ -6,6 +6,8 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__addkf3, .{ .name = "__addkf3", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_add, .{ .name = "_Qp_add", .linkage = common.linkage });
} else {
@export(__addtf3, .{ .name = "__addtf3", .linkage = common.linkage });
}
@@ -18,3 +20,7 @@ fn __addtf3(a: f128, b: f128) callconv(.C) f128 {
fn __addkf3(a: f128, b: f128) callconv(.C) f128 {
return addf3(f128, a, b);
}
+
+fn _Qp_add(c: *f128, a: *f128, b: *f128) callconv(.C) void {
+ c.* = addf3(f128, a.*, b.*);
+}
lib/compiler_rt/cmptf2.zig
@@ -11,6 +11,14 @@ comptime {
@export(__nekf2, .{ .name = "__nekf2", .linkage = common.linkage });
@export(__ltkf2, .{ .name = "__ltkf2", .linkage = common.linkage });
@export(__lekf2, .{ .name = "__lekf2", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_cmp, .{ .name = "_Qp_cmp", .linkage = common.linkage });
+ @export(_Qp_feq, .{ .name = "_Qp_feq", .linkage = common.linkage });
+ @export(_Qp_fne, .{ .name = "_Qp_fne", .linkage = common.linkage });
+ @export(_Qp_flt, .{ .name = "_Qp_flt", .linkage = common.linkage });
+ @export(_Qp_fle, .{ .name = "_Qp_fle", .linkage = common.linkage });
+ @export(_Qp_fgt, .{ .name = "_Qp_fgt", .linkage = common.linkage });
+ @export(_Qp_fge, .{ .name = "_Qp_fge", .linkage = common.linkage });
} else {
@export(__eqtf2, .{ .name = "__eqtf2", .linkage = common.linkage });
@export(__netf2, .{ .name = "__netf2", .linkage = common.linkage });
@@ -71,3 +79,44 @@ fn __ltkf2(a: f128, b: f128) callconv(.C) i32 {
fn __lekf2(a: f128, b: f128) callconv(.C) i32 {
return __cmptf2(a, b);
}
+
+const SparcFCMP = enum(i32) {
+ Equal = 0,
+ Less = 1,
+ Greater = 2,
+ Unordered = 3,
+};
+
+fn _Qp_cmp(a: *const f128, b: *const f128) callconv(.C) i32 {
+ return @enumToInt(comparef.cmpf2(f128, SparcFCMP, a.*, b.*));
+}
+
+fn _Qp_feq(a: *const f128, b: *const f128) callconv(.C) bool {
+ return @intToEnum(SparcFCMP, _Qp_cmp(a, b)) == .Equal;
+}
+
+fn _Qp_fne(a: *const f128, b: *const f128) callconv(.C) bool {
+ return @intToEnum(SparcFCMP, _Qp_cmp(a, b)) != .Equal;
+}
+
+fn _Qp_flt(a: *const f128, b: *const f128) callconv(.C) bool {
+ return @intToEnum(SparcFCMP, _Qp_cmp(a, b)) == .Less;
+}
+
+fn _Qp_fgt(a: *const f128, b: *const f128) callconv(.C) bool {
+ return @intToEnum(SparcFCMP, _Qp_cmp(a, b)) == .Greater;
+}
+
+fn _Qp_fge(a: *const f128, b: *const f128) callconv(.C) bool {
+ return switch (@intToEnum(SparcFCMP, _Qp_cmp(a, b))) {
+ .Equal, .Greater => true,
+ .Less, .Unordered => false,
+ };
+}
+
+fn _Qp_fle(a: *const f128, b: *const f128) callconv(.C) bool {
+ return switch (@intToEnum(SparcFCMP, _Qp_cmp(a, b))) {
+ .Equal, .Less => true,
+ .Greater, .Unordered => false,
+ };
+}
lib/compiler_rt/common.zig
@@ -8,6 +8,7 @@ pub const want_aeabi = builtin.cpu.arch.isARM() or builtin.cpu.arch.isThumb();
pub const want_ppc_abi = builtin.cpu.arch.isPPC() or builtin.cpu.arch.isPPC64();
pub const want_msvc_abi = builtin.abi == .msvc;
pub const want_gnu_abi = builtin.abi.isGnu();
+pub const want_sparc_abi = builtin.cpu.arch.isSPARC();
// Avoid dragging in the runtime safety mechanisms into this .o file,
// unless we're trying to test compiler-rt.
lib/compiler_rt/divtf3.zig
@@ -1,30 +1,35 @@
const std = @import("std");
const builtin = @import("builtin");
-const arch = builtin.cpu.arch;
-const is_test = builtin.is_test;
-const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .Internal else .Weak;
const common = @import("common.zig");
const normalize = common.normalize;
const wideMultiply = common.wideMultiply;
+
pub const panic = common.panic;
comptime {
- @export(__divtf3, .{ .name = "__divtf3", .linkage = linkage });
-
- if (!is_test) {
- if (arch.isPPC() or arch.isPPC64()) {
- @export(__divkf3, .{ .name = "__divkf3", .linkage = linkage });
- }
+ if (common.want_ppc_abi) {
+ @export(__divkf3, .{ .name = "__divkf3", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_div, .{ .name = "_Qp_div", .linkage = common.linkage });
+ } else {
+ @export(__divtf3, .{ .name = "__divtf3", .linkage = common.linkage });
}
}
-pub fn __divkf3(a: f128, b: f128) callconv(.C) f128 {
- return @call(.{ .modifier = .always_inline }, __divtf3, .{ a, b });
+fn __divkf3(a: f128, b: f128) callconv(.C) f128 {
+ return div(a, b);
+}
+
+fn _Qp_div(c: *f128, a: *const f128, b: *const f128) callconv(.C) void {
+ c.* = div(a.*, b.*);
+}
+
+fn __divtf3(a: f128, b: f128) callconv(.C) f128 {
+ return div(a, b);
}
-pub fn __divtf3(a: f128, b: f128) callconv(.C) f128 {
- @setRuntimeSafety(builtin.is_test);
+inline fn div(a: f128, b: f128) f128 {
const Z = std.meta.Int(.unsigned, 128);
const significandBits = std.math.floatMantissaBits(f128);
lib/compiler_rt/extenddftf2.zig
@@ -6,6 +6,8 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__extenddfkf2, .{ .name = "__extenddfkf2", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_dtoq, .{ .name = "_Qp_dtoq", .linkage = common.linkage });
} else {
@export(__extenddftf2, .{ .name = "__extenddftf2", .linkage = common.linkage });
}
@@ -18,3 +20,8 @@ fn __extenddftf2(a: f64) callconv(.C) f128 {
fn __extenddfkf2(a: f64) callconv(.C) f128 {
return extendf(f128, f64, @bitCast(u64, a));
}
+
+fn _Qp_dtoq(c: *f128, a: f64) callconv(.C) void {
+ c.* = @import("extendXfYf2.zig").__extenddftf2(a);
+ c.* = extendf(f128, f64, @bitCast(u64, a));
+}
lib/compiler_rt/extendsftf2.zig
@@ -6,6 +6,8 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__extendsfkf2, .{ .name = "__extendsfkf2", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_stoq, .{ .name = "_Qp_stoq", .linkage = common.linkage });
} else {
@export(__extendsftf2, .{ .name = "__extendsftf2", .linkage = common.linkage });
}
@@ -18,3 +20,7 @@ fn __extendsftf2(a: f32) callconv(.C) f128 {
fn __extendsfkf2(a: f32) callconv(.C) f128 {
return extendf(f128, f32, @bitCast(u32, a));
}
+
+fn _Qp_stoq(c: *f128, a: f32) callconv(.C) void {
+ c.* = extendf(f128, f32, @bitCast(u32, a));
+}
lib/compiler_rt/fixtfdi.zig
@@ -6,6 +6,8 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__fixkfdi, .{ .name = "__fixkfdi", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_qtox, .{ .name = "_Qp_qtox", .linkage = common.linkage });
} else {
@export(__fixtfdi, .{ .name = "__fixtfdi", .linkage = common.linkage });
}
@@ -18,3 +20,7 @@ fn __fixtfdi(a: f128) callconv(.C) i64 {
fn __fixkfdi(a: f128) callconv(.C) i64 {
return floatToInt(i64, a);
}
+
+fn _Qp_qtox(a: *const f128) callconv(.C) i64 {
+ return floatToInt(i64, a.*);
+}
lib/compiler_rt/fixtfsi.zig
@@ -6,6 +6,8 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__fixkfsi, .{ .name = "__fixkfsi", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_qtoi, .{ .name = "_Qp_qtoi", .linkage = common.linkage });
} else {
@export(__fixtfsi, .{ .name = "__fixtfsi", .linkage = common.linkage });
}
@@ -18,3 +20,7 @@ fn __fixtfsi(a: f128) callconv(.C) i32 {
fn __fixkfsi(a: f128) callconv(.C) i32 {
return floatToInt(i32, a);
}
+
+fn _Qp_qtoi(a: *const f128) callconv(.C) i32 {
+ return floatToInt(i32, a.*);
+}
lib/compiler_rt/fixunstfdi.zig
@@ -6,6 +6,8 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__fixunskfdi, .{ .name = "__fixunskfdi", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = common.linkage });
} else {
@export(__fixunstfdi, .{ .name = "__fixunstfdi", .linkage = common.linkage });
}
@@ -18,3 +20,7 @@ fn __fixunstfdi(a: f128) callconv(.C) u64 {
fn __fixunskfdi(a: f128) callconv(.C) u64 {
return floatToInt(u64, a);
}
+
+fn _Qp_qtoux(a: *const f128) callconv(.C) u64 {
+ return floatToInt(u64, a.*);
+}
lib/compiler_rt/fixunstfsi.zig
@@ -6,6 +6,8 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__fixunskfsi, .{ .name = "__fixunskfsi", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = common.linkage });
} else {
@export(__fixunstfsi, .{ .name = "__fixunstfsi", .linkage = common.linkage });
}
@@ -18,3 +20,7 @@ fn __fixunstfsi(a: f128) callconv(.C) u32 {
fn __fixunskfsi(a: f128) callconv(.C) u32 {
return floatToInt(u32, a);
}
+
+fn _Qp_qtoui(a: *const f128) callconv(.C) u32 {
+ return floatToInt(u32, a.*);
+}
lib/compiler_rt/floatditf.zig
@@ -6,6 +6,8 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__floatdikf, .{ .name = "__floatdikf", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_xtoq, .{ .name = "_Qp_xtoq", .linkage = common.linkage });
} else {
@export(__floatditf, .{ .name = "__floatditf", .linkage = common.linkage });
}
@@ -18,3 +20,7 @@ fn __floatditf(a: i64) callconv(.C) f128 {
fn __floatdikf(a: i64) callconv(.C) f128 {
return intToFloat(f128, a);
}
+
+fn _Qp_xtoq(c: *f128, a: i64) callconv(.C) void {
+ c.* = intToFloat(f128, a);
+}
lib/compiler_rt/floatsitf.zig
@@ -6,6 +6,8 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__floatsikf, .{ .name = "__floatsikf", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_itoq, .{ .name = "_Qp_itoq", .linkage = common.linkage });
} else {
@export(__floatsitf, .{ .name = "__floatsitf", .linkage = common.linkage });
}
@@ -18,3 +20,7 @@ fn __floatsitf(a: i32) callconv(.C) f128 {
fn __floatsikf(a: i32) callconv(.C) f128 {
return intToFloat(f128, a);
}
+
+fn _Qp_itoq(c: *f128, a: i32) callconv(.C) void {
+ c.* = intToFloat(f128, a);
+}
lib/compiler_rt/floatunditf.zig
@@ -6,6 +6,8 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__floatundikf, .{ .name = "__floatundikf", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_uxtoq, .{ .name = "_Qp_uxtoq", .linkage = common.linkage });
} else {
@export(__floatunditf, .{ .name = "__floatunditf", .linkage = common.linkage });
}
@@ -18,3 +20,7 @@ fn __floatunditf(a: u64) callconv(.C) f128 {
fn __floatundikf(a: u64) callconv(.C) f128 {
return intToFloat(f128, a);
}
+
+fn _Qp_uxtoq(c: *f128, a: u64) callconv(.C) void {
+ c.* = intToFloat(f128, a);
+}
lib/compiler_rt/floatunsitf.zig
@@ -6,6 +6,8 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__floatunsikf, .{ .name = "__floatunsikf", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_uitoq, .{ .name = "_Qp_uitoq", .linkage = common.linkage });
} else {
@export(__floatunsitf, .{ .name = "__floatunsitf", .linkage = common.linkage });
}
@@ -18,3 +20,7 @@ fn __floatunsitf(a: u32) callconv(.C) f128 {
fn __floatunsikf(a: u32) callconv(.C) f128 {
return intToFloat(f128, a);
}
+
+fn _Qp_uitoq(c: *f128, a: u32) callconv(.C) void {
+ c.* = intToFloat(f128, a);
+}
lib/compiler_rt/getf2.zig
@@ -9,6 +9,9 @@ comptime {
if (common.want_ppc_abi) {
@export(__gekf2, .{ .name = "__gekf2", .linkage = common.linkage });
@export(__gtkf2, .{ .name = "__gtkf2", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ // These exports are handled in cmptf2.zig because gt and ge on sparc
+ // are based on calling _Qp_cmp.
} else {
@export(__getf2, .{ .name = "__getf2", .linkage = common.linkage });
@export(__gttf2, .{ .name = "__gttf2", .linkage = common.linkage });
lib/compiler_rt/multf3.zig
@@ -6,6 +6,8 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__mulkf3, .{ .name = "__mulkf3", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_mul, .{ .name = "_Qp_mul", .linkage = common.linkage });
} else {
@export(__multf3, .{ .name = "__multf3", .linkage = common.linkage });
}
@@ -18,3 +20,7 @@ fn __multf3(a: f128, b: f128) callconv(.C) f128 {
fn __mulkf3(a: f128, b: f128) callconv(.C) f128 {
return mulf3(f128, a, b);
}
+
+fn _Qp_mul(c: *f128, a: *const f128, b: *const f128) callconv(.C) void {
+ c.* = mulf3(f128, a.*, b.*);
+}
lib/compiler_rt/sparc.zig
@@ -1,148 +0,0 @@
-//
-// SPARC uses a different naming scheme for its support routines so we map it here to the x86 name.
-
-const std = @import("std");
-const builtin = @import("builtin");
-const arch = builtin.cpu.arch;
-const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .Internal else .Weak;
-pub const panic = @import("common.zig").panic;
-
-comptime {
- if (arch.isSPARC()) {
- // SPARC systems use a different naming scheme
- @export(_Qp_add, .{ .name = "_Qp_add", .linkage = linkage });
- @export(_Qp_div, .{ .name = "_Qp_div", .linkage = linkage });
- @export(_Qp_mul, .{ .name = "_Qp_mul", .linkage = linkage });
- @export(_Qp_sub, .{ .name = "_Qp_sub", .linkage = linkage });
-
- @export(_Qp_cmp, .{ .name = "_Qp_cmp", .linkage = linkage });
- @export(_Qp_feq, .{ .name = "_Qp_feq", .linkage = linkage });
- @export(_Qp_fne, .{ .name = "_Qp_fne", .linkage = linkage });
- @export(_Qp_flt, .{ .name = "_Qp_flt", .linkage = linkage });
- @export(_Qp_fle, .{ .name = "_Qp_fle", .linkage = linkage });
- @export(_Qp_fgt, .{ .name = "_Qp_fgt", .linkage = linkage });
- @export(_Qp_fge, .{ .name = "_Qp_fge", .linkage = linkage });
-
- @export(_Qp_itoq, .{ .name = "_Qp_itoq", .linkage = linkage });
- @export(_Qp_uitoq, .{ .name = "_Qp_uitoq", .linkage = linkage });
- @export(_Qp_xtoq, .{ .name = "_Qp_xtoq", .linkage = linkage });
- @export(_Qp_uxtoq, .{ .name = "_Qp_uxtoq", .linkage = linkage });
- @export(_Qp_stoq, .{ .name = "_Qp_stoq", .linkage = linkage });
- @export(_Qp_dtoq, .{ .name = "_Qp_dtoq", .linkage = linkage });
- @export(_Qp_qtoi, .{ .name = "_Qp_qtoi", .linkage = linkage });
- @export(_Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = linkage });
- @export(_Qp_qtox, .{ .name = "_Qp_qtox", .linkage = linkage });
- @export(_Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = linkage });
- @export(_Qp_qtos, .{ .name = "_Qp_qtos", .linkage = linkage });
- @export(_Qp_qtod, .{ .name = "_Qp_qtod", .linkage = linkage });
- }
-}
-
-// The SPARC Architecture Manual, Version 9:
-// A.13 Floating-Point Compare
-const FCMP = enum(i32) {
- Equal = 0,
- Less = 1,
- Greater = 2,
- Unordered = 3,
-};
-
-// Basic arithmetic
-
-pub fn _Qp_add(c: *f128, a: *f128, b: *f128) callconv(.C) void {
- c.* = @import("addf3.zig").__addtf3(a.*, b.*);
-}
-
-pub fn _Qp_div(c: *f128, a: *f128, b: *f128) callconv(.C) void {
- c.* = @import("divtf3.zig").__divtf3(a.*, b.*);
-}
-
-pub fn _Qp_mul(c: *f128, a: *f128, b: *f128) callconv(.C) void {
- c.* = @import("mulf3.zig").__multf3(a.*, b.*);
-}
-
-pub fn _Qp_sub(c: *f128, a: *f128, b: *f128) callconv(.C) void {
- c.* = @import("addf3.zig").__subtf3(a.*, b.*);
-}
-
-// Comparison
-
-pub fn _Qp_cmp(a: *f128, b: *f128) callconv(.C) i32 {
- return @enumToInt(@import("compareXf2.zig").cmp(f128, FCMP, a.*, b.*));
-}
-
-pub fn _Qp_feq(a: *f128, b: *f128) callconv(.C) bool {
- return _Qp_cmp(a, b) == @enumToInt(FCMP.Equal);
-}
-
-pub fn _Qp_fne(a: *f128, b: *f128) callconv(.C) bool {
- return _Qp_cmp(a, b) != @enumToInt(FCMP.Equal);
-}
-
-pub fn _Qp_flt(a: *f128, b: *f128) callconv(.C) bool {
- return _Qp_cmp(a, b) == @enumToInt(FCMP.Less);
-}
-
-pub fn _Qp_fle(a: *f128, b: *f128) callconv(.C) bool {
- const cmp = _Qp_cmp(a, b);
- return cmp == @enumToInt(FCMP.Less) or cmp == @enumToInt(FCMP.Equal);
-}
-
-pub fn _Qp_fgt(a: *f128, b: *f128) callconv(.C) bool {
- return _Qp_cmp(a, b) == @enumToInt(FCMP.Greater);
-}
-
-pub fn _Qp_fge(a: *f128, b: *f128) callconv(.C) bool {
- const cmp = _Qp_cmp(a, b);
- return cmp == @enumToInt(FCMP.Greater) or cmp == @enumToInt(FCMP.Equal);
-}
-
-// Conversion
-
-pub fn _Qp_itoq(c: *f128, a: i32) callconv(.C) void {
- c.* = @import("floatXiYf.zig").__floatsitf(a);
-}
-
-pub fn _Qp_uitoq(c: *f128, a: u32) callconv(.C) void {
- c.* = @import("floatXiYf.zig").__floatunsitf(a);
-}
-
-pub fn _Qp_xtoq(c: *f128, a: i64) callconv(.C) void {
- c.* = @import("floatXiYf.zig").__floatditf(a);
-}
-
-pub fn _Qp_uxtoq(c: *f128, a: u64) callconv(.C) void {
- c.* = @import("floatXiYf.zig").__floatunditf(a);
-}
-
-pub fn _Qp_stoq(c: *f128, a: f32) callconv(.C) void {
- c.* = @import("extendXfYf2.zig").__extendsftf2(a);
-}
-
-pub fn _Qp_dtoq(c: *f128, a: f64) callconv(.C) void {
- c.* = @import("extendXfYf2.zig").__extenddftf2(a);
-}
-
-pub fn _Qp_qtoi(a: *f128) callconv(.C) i32 {
- return @import("fixXfYi.zig").__fixtfsi(a.*);
-}
-
-pub fn _Qp_qtoui(a: *f128) callconv(.C) u32 {
- return @import("fixXfYi.zig").__fixunstfsi(a.*);
-}
-
-pub fn _Qp_qtox(a: *f128) callconv(.C) i64 {
- return @import("fixXfYi.zig").__fixtfdi(a.*);
-}
-
-pub fn _Qp_qtoux(a: *f128) callconv(.C) u64 {
- return @import("fixXfYi.zig").__fixunstfdi(a.*);
-}
-
-pub fn _Qp_qtos(a: *f128) callconv(.C) f32 {
- return @import("truncXfYf2.zig").__trunctfsf2(a.*);
-}
-
-pub fn _Qp_qtod(a: *f128) callconv(.C) f64 {
- return @import("truncXfYf2.zig").__trunctfdf2(a.*);
-}
lib/compiler_rt/subtf3.zig
@@ -5,17 +5,26 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__subkf3, .{ .name = "__subkf3", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_sub, .{ .name = "_Qp_sub", .linkage = common.linkage });
} else {
@export(__subtf3, .{ .name = "__subtf3", .linkage = common.linkage });
}
}
fn __subtf3(a: f128, b: f128) callconv(.C) f128 {
- const neg_b = @bitCast(f128, @bitCast(u128, b) ^ (@as(u128, 1) << 127));
- return a + neg_b;
+ return sub(a, b);
}
fn __subkf3(a: f128, b: f128) callconv(.C) f128 {
+ return sub(a, b);
+}
+
+fn _Qp_sub(c: *f128, a: *const f128, b: *const f128) callconv(.C) void {
+ c.* = sub(a.*, b.*);
+}
+
+inline fn sub(a: f128, b: f128) f128 {
const neg_b = @bitCast(f128, @bitCast(u128, b) ^ (@as(u128, 1) << 127));
return a + neg_b;
}
lib/compiler_rt/trunctfdf2.zig
@@ -6,6 +6,8 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__trunckfdf2, .{ .name = "__trunckfdf2", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_qtod, .{ .name = "_Qp_qtod", .linkage = common.linkage });
} else {
@export(__trunctfdf2, .{ .name = "__trunctfdf2", .linkage = common.linkage });
}
@@ -18,3 +20,7 @@ fn __trunctfdf2(a: f128) callconv(.C) f64 {
fn __trunckfdf2(a: f128) callconv(.C) f64 {
return truncf(f64, f128, a);
}
+
+fn _Qp_qtod(a: *const f128) callconv(.C) f64 {
+ return truncf(f64, f128, a.*);
+}
lib/compiler_rt/trunctfsf2.zig
@@ -6,6 +6,8 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__trunckfsf2, .{ .name = "__trunckfsf2", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ @export(_Qp_qtos, .{ .name = "_Qp_qtos", .linkage = common.linkage });
} else {
@export(__trunctfsf2, .{ .name = "__trunctfsf2", .linkage = common.linkage });
}
@@ -18,3 +20,7 @@ fn __trunctfsf2(a: f128) callconv(.C) f32 {
fn __trunckfsf2(a: f128) callconv(.C) f32 {
return truncf(f32, f128, a);
}
+
+fn _Qp_qtos(a: *const f128) callconv(.C) f32 {
+ return truncf(f32, f128, a.*);
+}
lib/compiler_rt/unordtf2.zig
@@ -6,6 +6,9 @@ pub const panic = common.panic;
comptime {
if (common.want_ppc_abi) {
@export(__unordkf2, .{ .name = "__unordkf2", .linkage = common.linkage });
+ } else if (common.want_sparc_abi) {
+ // These exports are handled in cmptf2.zig because unordered comparisons
+ // are based on calling _Qp_cmp.
} else {
@export(__unordtf2, .{ .name = "__unordtf2", .linkage = common.linkage });
}
lib/compiler_rt.zig
@@ -179,6 +179,4 @@ comptime {
_ = @import("compiler_rt/aulldiv.zig");
_ = @import("compiler_rt/aullrem.zig");
_ = @import("compiler_rt/clear_cache.zig");
-
- _ = @import("compiler_rt/sparc.zig");
}
src/compiler_rt.zig
@@ -228,6 +228,5 @@ const sources = &[_][]const u8{
"compiler_rt/arm.zig",
"compiler_rt/aulldiv.zig",
"compiler_rt/aullrem.zig",
- "compiler_rt/sparc.zig",
"compiler_rt/clear_cache.zig",
};
CMakeLists.txt
@@ -619,7 +619,6 @@ set(ZIG_STAGE2_SOURCES
"${CMAKE_SOURCE_DIR}/lib/compiler_rt/shift.zig"
"${CMAKE_SOURCE_DIR}/lib/compiler_rt/sin.zig"
"${CMAKE_SOURCE_DIR}/lib/compiler_rt/sincos.zig"
- "${CMAKE_SOURCE_DIR}/lib/compiler_rt/sparc.zig"
"${CMAKE_SOURCE_DIR}/lib/compiler_rt/sqrt.zig"
"${CMAKE_SOURCE_DIR}/lib/compiler_rt/stack_probe.zig"
"${CMAKE_SOURCE_DIR}/lib/compiler_rt/subo.zig"