diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-06-17 18:10:00 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-06-17 18:10:00 -0700 |
| commit | 0556a2ba53b8bbb1a60ff31d8dcdde78a8b16727 (patch) | |
| tree | c691076f8f43db00ba0c6e58afebb1300ea4093e /lib/compiler_rt/exp.zig | |
| parent | 3efc229bbf8aaec9de54a702054b091bf890d56e (diff) | |
| download | zig-0556a2ba53b8bbb1a60ff31d8dcdde78a8b16727.tar.gz zig-0556a2ba53b8bbb1a60ff31d8dcdde78a8b16727.zip | |
compiler-rt: finish cleanups
Finishes cleanups that I started in other commits in this branch.
* Use common.linkage for all exports instead of redoing the logic in
each file.
* Remove pointless `@setRuntimeSafety` calls.
* Avoid redundantly exporting multiple versions of functions. For
example, if PPC wants `ceilf128` then don't also export `ceilq`;
similarly if ARM wants `__aeabi_ddiv` then don't also export
`__divdf3`.
* Use `inline` for helper functions instead of making inline calls at
callsites.
Diffstat (limited to 'lib/compiler_rt/exp.zig')
| -rw-r--r-- | lib/compiler_rt/exp.zig | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/lib/compiler_rt/exp.zig b/lib/compiler_rt/exp.zig index c7f6c95da6..f34f226be4 100644 --- a/lib/compiler_rt/exp.zig +++ b/lib/compiler_rt/exp.zig @@ -9,22 +9,18 @@ const builtin = @import("builtin"); const arch = builtin.cpu.arch; const math = std.math; const expect = std.testing.expect; -const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .Internal else .Weak; -pub const panic = @import("common.zig").panic; +const common = @import("common.zig"); + +pub const panic = common.panic; comptime { - @export(__exph, .{ .name = "__exph", .linkage = linkage }); - @export(expf, .{ .name = "expf", .linkage = linkage }); - @export(exp, .{ .name = "exp", .linkage = linkage }); - @export(__expx, .{ .name = "__expx", .linkage = linkage }); - @export(expq, .{ .name = "expq", .linkage = linkage }); - @export(expl, .{ .name = "expl", .linkage = linkage }); - - if (!builtin.is_test) { - if (arch.isPPC() or arch.isPPC64()) { - @export(expf128, .{ .name = "expf128", .linkage = linkage }); - } - } + @export(__exph, .{ .name = "__exph", .linkage = common.linkage }); + @export(expf, .{ .name = "expf", .linkage = common.linkage }); + @export(exp, .{ .name = "exp", .linkage = common.linkage }); + @export(__expx, .{ .name = "__expx", .linkage = common.linkage }); + const expq_sym_name = if (common.want_ppc_abi) "expf128" else "expq"; + @export(expq, .{ .name = expq_sym_name, .linkage = common.linkage }); + @export(expl, .{ .name = "expl", .linkage = common.linkage }); } pub fn __exph(a: f16) callconv(.C) f16 { @@ -201,10 +197,6 @@ pub fn expq(a: f128) callconv(.C) f128 { return exp(@floatCast(f64, a)); } -pub fn expf128(a: f128) callconv(.C) f128 { - return @call(.{ .modifier = .always_inline }, expq, .{a}); -} - pub fn expl(x: c_longdouble) callconv(.C) c_longdouble { switch (@typeInfo(c_longdouble).Float.bits) { 16 => return __exph(x), |
