diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-12-15 16:02:44 -0800 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-01-15 15:11:35 -0800 |
| commit | 098e0b1906479e6aa3c4afb3aeff5c85504521c2 (patch) | |
| tree | 7efa3a5a0b5a1e023dee5aecf5acecbeb3072d9b /src | |
| parent | 55773aee3fd047e8294b1994e7a2da0e3907c2c1 (diff) | |
| download | zig-098e0b1906479e6aa3c4afb3aeff5c85504521c2.tar.gz zig-098e0b1906479e6aa3c4afb3aeff5c85504521c2.zip | |
wasm codegen: fix lowering of 32/64 float rt calls
Diffstat (limited to 'src')
| -rw-r--r-- | src/arch/wasm/CodeGen.zig | 24 | ||||
| -rw-r--r-- | src/arch/wasm/Mir.zig | 19 |
2 files changed, 35 insertions, 8 deletions
diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig index 2d31b6113f..900cb96ded 100644 --- a/src/arch/wasm/CodeGen.zig +++ b/src/arch/wasm/CodeGen.zig @@ -2747,25 +2747,33 @@ const FloatOp = enum { }, inline .ceil, - .cos, - .exp, - .exp2, .fabs, .floor, - .fma, .fmax, .fmin, + .round, + .sqrt, + .trunc, + => |ct_op| switch (bits) { + inline 16, 80, 128 => |ct_bits| @field( + Mir.Intrinsic, + libcFloatPrefix(ct_bits) ++ @tagName(ct_op) ++ libcFloatSuffix(ct_bits), + ), + else => unreachable, + }, + + inline .cos, + .exp, + .exp2, + .fma, .fmod, .log, .log10, .log2, - .round, .sin, - .sqrt, .tan, - .trunc, => |ct_op| switch (bits) { - inline 16, 80, 128 => |ct_bits| @field( + inline 16, 32, 64, 80, 128 => |ct_bits| @field( Mir.Intrinsic, libcFloatPrefix(ct_bits) ++ @tagName(ct_op) ++ libcFloatSuffix(ct_bits), ), diff --git a/src/arch/wasm/Mir.zig b/src/arch/wasm/Mir.zig index 9f5ddf189a..65cd62c77d 100644 --- a/src/arch/wasm/Mir.zig +++ b/src/arch/wasm/Mir.zig @@ -853,11 +853,18 @@ pub const Intrinsic = enum(u32) { __udivti3, __umodti3, ceilq, + cos, + cosf, cosq, + exp, + exp2, + exp2f, exp2q, + expf, expq, fabsq, floorq, + fma, fmaf, fmaq, fmax, @@ -866,13 +873,25 @@ pub const Intrinsic = enum(u32) { fmin, fminf, fminq, + fmod, + fmodf, fmodq, + log, + log10, + log10f, log10q, + log2, + log2f, log2q, + logf, logq, roundq, + sin, + sinf, sinq, sqrtq, + tan, + tanf, tanq, truncq, }; |
