authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-12-15 16:02:44-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-01-15 15:11:35-08:00
log098e0b1906479e6aa3c4afb3aeff5c85504521c2
tree7efa3a5a0b5a1e023dee5aecf5acecbeb3072d9b
parent55773aee3fd047e8294b1994e7a2da0e3907c2c1

wasm codegen: fix lowering of 32/64 float rt calls


2 files changed, 35 insertions(+), 8 deletions(-)

src/arch/wasm/CodeGen.zig+16-8
......@@ -2747,25 +2747,33 @@ const FloatOp = enum {
27472747 },
27482748
27492749 inline .ceil,
2750 .cos,
2751 .exp,
2752 .exp2,
27532750 .fabs,
27542751 .floor,
2755 .fma,
27562752 .fmax,
27572753 .fmin,
2754 .round,
2755 .sqrt,
2756 .trunc,
2757 => |ct_op| switch (bits) {
2758 inline 16, 80, 128 => |ct_bits| @field(
2759 Mir.Intrinsic,
2760 libcFloatPrefix(ct_bits) ++ @tagName(ct_op) ++ libcFloatSuffix(ct_bits),
2761 ),
2762 else => unreachable,
2763 },
2764
2765 inline .cos,
2766 .exp,
2767 .exp2,
2768 .fma,
27582769 .fmod,
27592770 .log,
27602771 .log10,
27612772 .log2,
2762 .round,
27632773 .sin,
2764 .sqrt,
27652774 .tan,
2766 .trunc,
27672775 => |ct_op| switch (bits) {
2768 inline 16, 80, 128 => |ct_bits| @field(
2776 inline 16, 32, 64, 80, 128 => |ct_bits| @field(
27692777 Mir.Intrinsic,
27702778 libcFloatPrefix(ct_bits) ++ @tagName(ct_op) ++ libcFloatSuffix(ct_bits),
27712779 ),
src/arch/wasm/Mir.zig+19
......@@ -853,11 +853,18 @@ pub const Intrinsic = enum(u32) {
853853 __udivti3,
854854 __umodti3,
855855 ceilq,
856 cos,
857 cosf,
856858 cosq,
859 exp,
860 exp2,
861 exp2f,
857862 exp2q,
863 expf,
858864 expq,
859865 fabsq,
860866 floorq,
867 fma,
861868 fmaf,
862869 fmaq,
863870 fmax,
......@@ -866,13 +873,25 @@ pub const Intrinsic = enum(u32) {
866873 fmin,
867874 fminf,
868875 fminq,
876 fmod,
877 fmodf,
869878 fmodq,
879 log,
880 log10,
881 log10f,
870882 log10q,
883 log2,
884 log2f,
871885 log2q,
886 logf,
872887 logq,
873888 roundq,
889 sin,
890 sinf,
874891 sinq,
875892 sqrtq,
893 tan,
894 tanf,
876895 tanq,
877896 truncq,
878897};