aboutsummaryrefslogtreecommitdiff
path: root/src/BuiltinFn.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-04-27 16:45:23 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-04-27 16:45:23 -0700
commit09f1d62bdfb5794534b21d1cd9dafc4822697d60 (patch)
tree437f6c19a6f0f16ef29fb91513176bb8aa0c91f0 /src/BuiltinFn.zig
parentc4eaff6665132287d05272bef8890e4607ff017c (diff)
downloadzig-09f1d62bdfb5794534b21d1cd9dafc4822697d60.tar.gz
zig-09f1d62bdfb5794534b21d1cd9dafc4822697d60.zip
add new builtin function `@tan`
The reason for having `@tan` is that we already have `@sin` and `@cos` because some targets have machine code instructions for them, but in the case that the implementation needs to go into compiler-rt, sin, cos, and tan all share a common dependency which includes a table of data. To avoid duplicating this table of data, we promote tan to become a builtin alongside sin and cos. ZIR: The tag enum is at capacity so this commit moves `field_call_bind_named` to be `extended`. I measured this as one of the least used tags in the zig codebase. Fix libc math suffix for `f32` being wrong in both stage1 and stage2. stage1: add missing libc prefix for float functions.
Diffstat (limited to 'src/BuiltinFn.zig')
-rw-r--r--src/BuiltinFn.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/BuiltinFn.zig b/src/BuiltinFn.zig
index 3bf7224fab..04cad19354 100644
--- a/src/BuiltinFn.zig
+++ b/src/BuiltinFn.zig
@@ -89,6 +89,7 @@ pub const Tag = enum {
sqrt,
sin,
cos,
+ tan,
exp,
exp2,
log,
@@ -772,6 +773,13 @@ pub const list = list: {
},
},
.{
+ "@tan",
+ .{
+ .tag = .tan,
+ .param_count = 1,
+ },
+ },
+ .{
"@exp",
.{
.tag = .exp,