compiler_rt: support targets where c_longdouble is not a valid type

This commit is contained in:
Jacob Young committed 2026-10-20 15:45:44 -04:00
1 parent c8bb44618a
commit d85c0ba080
19 files changed
+33 -21

No files matched your search

+8
View File
@@ -399,6 +399,14 @@ fn complexAbi(comptime Float: type, comptime float: type) type {
};
}
pub const have_c_longdouble = if (builtin.target.cTypeBitSize(.longdouble)) |bits| switch (bits) {
else => true,
80 => switch (std.zig.target.compilerRtFloatAbi(&builtin.target, bits)) {
.soft => false,
.hard => true,
},
} else false;
pub fn Complex(comptime Float: type) type {
return struct { real: Float, imag: Float };
}
+4 -2
View File
@@ -25,8 +25,10 @@ comptime {
symbol(&cos, "cos");
symbol(&__cosx, "__cosx");
symbol(&cosq, "cosf128");
symbol(&cosl, "cosl");
symbol(&cosl, "__cosl"); // required by musl
if (compiler_rt.have_c_longdouble) {
symbol(&cosl, "cosl");
symbol(&cosl, "__cosl"); // required by musl
}
}
fn __cosh(x: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {
+1 -1
View File
@@ -22,7 +22,7 @@ comptime {
symbol(&exp, "exp");
symbol(&__expx, "__expx");
symbol(&expq, "expf128");
symbol(&expl, "expl");
if (compiler_rt.have_c_longdouble) symbol(&expl, "expl");
}
fn __exph(x: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {
+1 -1
View File
@@ -20,7 +20,7 @@ comptime {
symbol(&exp2, "exp2");
symbol(&__exp2x, "__exp2x");
symbol(&exp2q, "exp2f128");
symbol(&exp2l, "exp2l");
if (compiler_rt.have_c_longdouble) symbol(&exp2l, "exp2l");
}
fn __exp2h(x: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {
+1 -1
View File
@@ -10,7 +10,7 @@ comptime {
symbol(&fabs, "fabs");
symbol(&__fabsx, "__fabsx");
symbol(&fabsq, "fabsf128");
symbol(&fabsl, "fabsl");
if (compiler_rt.have_c_longdouble) symbol(&fabsl, "fabsl");
}
fn __fabsh(a: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {
+2 -2
View File
@@ -24,7 +24,7 @@ comptime {
symbol(&floor, "floor");
symbol(&__floorx, "__floorx");
symbol(&floorq, "floorf128");
symbol(&floorl, "floorl");
if (compiler_rt.have_c_longdouble) symbol(&floorl, "floorl");
// ceil
symbol(&__ceilh, "__ceilh");
@@ -32,7 +32,7 @@ comptime {
symbol(&ceil, "ceil");
symbol(&__ceilx, "__ceilx");
symbol(&ceilq, "ceilf128");
symbol(&ceill, "ceill");
if (compiler_rt.have_c_longdouble) symbol(&ceill, "ceill");
}
fn __floorh(x: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {
+1 -1
View File
@@ -18,7 +18,7 @@ comptime {
symbol(&fma, "fma");
symbol(&__fmax, "__fmax");
symbol(&fmaq, "fmaf128");
symbol(&fmal, "fmal");
if (compiler_rt.have_c_longdouble) symbol(&fmal, "fmal");
}
fn __fmah(x: compiler_rt.f16.Abi, y: compiler_rt.f16.Abi, z: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {
+1 -1
View File
@@ -11,7 +11,7 @@ comptime {
symbol(&fmax, "fmax");
symbol(&__fmaxx, "__fmaxx");
symbol(&fmaxq, "fmaxf128");
symbol(&fmaxl, "fmaxl");
if (compiler_rt.have_c_longdouble) symbol(&fmaxl, "fmaxl");
}
fn __fmaxh(x: compiler_rt.f16.Abi, y: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {
+1 -1
View File
@@ -11,7 +11,7 @@ comptime {
symbol(&fmin, "fmin");
symbol(&__fminx, "__fminx");
symbol(&fminq, "fminf128");
symbol(&fminl, "fminl");
if (compiler_rt.have_c_longdouble) symbol(&fminl, "fminl");
}
fn __fminh(x: compiler_rt.f16.Abi, y: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {
+1 -1
View File
@@ -13,7 +13,7 @@ comptime {
symbol(&fmod, "fmod");
symbol(&__fmodx, "__fmodx");
symbol(&fmodq, "fmodf128");
symbol(&fmodl, "fmodl");
if (compiler_rt.have_c_longdouble) symbol(&fmodl, "fmodl");
}
fn __fmodh(a: compiler_rt.f16.Abi, b: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {
+1 -1
View File
@@ -19,7 +19,7 @@ comptime {
symbol(&log, "log");
symbol(&__logx, "__logx");
symbol(&logq, "logf128");
symbol(&logl, "logl");
if (compiler_rt.have_c_longdouble) symbol(&logl, "logl");
}
fn __logh(a: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {
+1 -1
View File
@@ -19,7 +19,7 @@ comptime {
symbol(&log10, "log10");
symbol(&__log10x, "__log10x");
symbol(&log10q, "log10f128");
symbol(&log10l, "log10l");
if (compiler_rt.have_c_longdouble) symbol(&log10l, "log10l");
}
fn __log10h(a: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {
+1 -1
View File
@@ -20,7 +20,7 @@ comptime {
symbol(&log2, "log2");
symbol(&__log2x, "__log2x");
symbol(&log2q, "log2f128");
symbol(&log2l, "log2l");
if (compiler_rt.have_c_longdouble) symbol(&log2l, "log2l");
}
fn __log2h(a: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {
+1 -1
View File
@@ -19,7 +19,7 @@ comptime {
symbol(&round, "round");
symbol(&__roundx, "__roundx");
symbol(&roundq, "roundf128");
symbol(&roundl, "roundl");
if (compiler_rt.have_c_longdouble) symbol(&roundl, "roundl");
}
fn __roundh(x: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {
+4 -2
View File
@@ -25,8 +25,10 @@ comptime {
symbol(&sin, "sin");
symbol(&__sinx, "__sinx");
symbol(&sinq, "sinf128");
symbol(&sinl, "sinl");
symbol(&sinl, "__sinl"); // required by musl
if (compiler_rt.have_c_longdouble) {
symbol(&sinl, "sinl");
symbol(&sinl, "__sinl"); // required by musl
}
}
fn __sinh(x: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {
+1 -1
View File
@@ -19,7 +19,7 @@ comptime {
symbol(&sincos, "sincos");
symbol(&sincosx, "__sincosx");
symbol(&sincosq, "sincosf128");
symbol(&sincosl, "sincosl");
if (compiler_rt.have_c_longdouble) symbol(&sincosl, "sincosl");
}
fn sincosh(x: compiler_rt.f16.Abi, r_sin: *compiler_rt.f16.Abi, r_cos: *compiler_rt.f16.Abi) callconv(.c) void {
+1 -1
View File
@@ -23,7 +23,7 @@ comptime {
} else if (compiler_rt.want_sparc32_abi) {
symbol(&sqrtq, "_Q_sqrt");
}
symbol(&sqrtl, "sqrtl");
if (compiler_rt.have_c_longdouble) symbol(&sqrtl, "sqrtl");
}
fn __sqrth(x: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {
+1 -1
View File
@@ -29,7 +29,7 @@ comptime {
symbol(&tan, "tan");
symbol(&__tanx, "__tanx");
symbol(&tanq, "tanf128");
symbol(&tanl, "tanl");
if (compiler_rt.have_c_longdouble) symbol(&tanl, "tanl");
}
fn __tanh(x: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {
+1 -1
View File
@@ -18,7 +18,7 @@ comptime {
symbol(&trunc, "trunc");
symbol(&__truncx, "__truncx");
symbol(&truncq, "truncf128");
symbol(&truncl, "truncl");
if (compiler_rt.have_c_longdouble) symbol(&truncl, "truncl");
}
fn __trunch(x: compiler_rt.f16.Abi) callconv(.c) compiler_rt.f16.Abi {