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/exp2.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/exp2.zig')
| -rw-r--r-- | lib/compiler_rt/exp2.zig | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/lib/compiler_rt/exp2.zig b/lib/compiler_rt/exp2.zig index 614df2cec0..e89a918501 100644 --- a/lib/compiler_rt/exp2.zig +++ b/lib/compiler_rt/exp2.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"); -comptime { - @export(__exp2h, .{ .name = "__exp2h", .linkage = linkage }); - @export(exp2f, .{ .name = "exp2f", .linkage = linkage }); - @export(exp2, .{ .name = "exp2", .linkage = linkage }); - @export(__exp2x, .{ .name = "__exp2x", .linkage = linkage }); - @export(exp2q, .{ .name = "exp2q", .linkage = linkage }); - @export(exp2l, .{ .name = "exp2l", .linkage = linkage }); +pub const panic = common.panic; - if (!builtin.is_test) { - if (arch.isPPC() or arch.isPPC64()) { - @export(exp2f128, .{ .name = "exp2f128", .linkage = linkage }); - } - } +comptime { + @export(__exp2h, .{ .name = "__exp2h", .linkage = common.linkage }); + @export(exp2f, .{ .name = "exp2f", .linkage = common.linkage }); + @export(exp2, .{ .name = "exp2", .linkage = common.linkage }); + @export(__exp2x, .{ .name = "__exp2x", .linkage = common.linkage }); + const exp2q_sym_name = if (common.want_ppc_abi) "exp2f128" else "exp2q"; + @export(exp2q, .{ .name = exp2q_sym_name, .linkage = common.linkage }); + @export(exp2l, .{ .name = "exp2l", .linkage = common.linkage }); } pub fn __exp2h(x: f16) callconv(.C) f16 { @@ -168,10 +164,6 @@ pub fn exp2q(x: f128) callconv(.C) f128 { return exp2(@floatCast(f64, x)); } -pub fn exp2f128(x: f128) callconv(.C) f128 { - return @call(.{ .modifier = .always_inline }, exp2q, .{x}); -} - pub fn exp2l(x: c_longdouble) callconv(.C) c_longdouble { switch (@typeInfo(c_longdouble).Float.bits) { 16 => return __exp2h(x), |
