mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-10-28 10:45:48 +08:00
compiler_rt: support targets where c_longdouble is not a valid type
This commit is contained in:
1 parent
c8bb44618a
commit
d85c0ba080
19 files changed
+33
-21
No files matched your search
@@ -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 };
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user