aboutsummaryrefslogtreecommitdiff
path: root/lib/compiler_rt/exp2.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-05-08 13:06:21 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-05-08 13:06:21 -0700
commitcd019ee502d6792c1615b0fab10827db419beab4 (patch)
tree4141ab72f3721b7625d888b202a774ba58d2a5e0 /lib/compiler_rt/exp2.zig
parent6fde2fcd519cacdc44871fc1035b05afee072f44 (diff)
downloadzig-cd019ee502d6792c1615b0fab10827db419beab4.tar.gz
zig-cd019ee502d6792c1615b0fab10827db419beab4.zip
compiler_rt: avoid weak aliases on Windows
When exporting math functions for Windows, we provide weak exports of 'l' variants rather than weak aliases. We still use aliases on other operating systems so that the 'l' variants have one less jump instruction in this case.
Diffstat (limited to 'lib/compiler_rt/exp2.zig')
-rw-r--r--lib/compiler_rt/exp2.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/compiler_rt/exp2.zig b/lib/compiler_rt/exp2.zig
index 53432a831d..cbcb53c99f 100644
--- a/lib/compiler_rt/exp2.zig
+++ b/lib/compiler_rt/exp2.zig
@@ -149,6 +149,17 @@ pub fn exp2q(x: f128) callconv(.C) f128 {
return exp2(@floatCast(f64, x));
}
+pub fn exp2l(x: c_longdouble) callconv(.C) c_longdouble {
+ switch (@typeInfo(c_longdouble).Float.bits) {
+ 16 => return __exp2h(x),
+ 32 => return exp2f(x),
+ 64 => return exp2(x),
+ 80 => return __exp2x(x),
+ 128 => return exp2q(x),
+ else => @compileError("unreachable"),
+ }
+}
+
const exp2ft = [_]f64{
0x1.6a09e667f3bcdp-1,
0x1.7a11473eb0187p-1,