zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit a4c7e4c4eb7b1000252fab3f98f6204edb48a4bd (tree)
parent 13798d26c769323ab2a7798c27a8c62af32fd60c
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Wed, 10 Apr 2019 22:33:33 -0400

__muloti4 does not need the ABI workaround on Windows

Fixes 128-bit integer multiplication on Windows.

closes #2250

Diffstat:
Mstd/special/compiler_rt.zig | 3+--
Mstd/special/compiler_rt/muloti4.zig | 5-----
Mtest/stage1/behavior/math.zig | 7+++++++
3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/std/special/compiler_rt.zig b/std/special/compiler_rt.zig @@ -165,7 +165,6 @@ comptime { @export("__divti3", @import("compiler_rt/divti3.zig").__divti3_windows_x86_64, linkage); @export("__modti3", @import("compiler_rt/modti3.zig").__modti3_windows_x86_64, linkage); @export("__multi3", @import("compiler_rt/multi3.zig").__multi3_windows_x86_64, linkage); - @export("__muloti4", @import("compiler_rt/muloti4.zig").__muloti4_windows_x86_64, linkage); @export("__udivti3", @import("compiler_rt/udivti3.zig").__udivti3_windows_x86_64, linkage); @export("__udivmodti4", @import("compiler_rt/udivmodti4.zig").__udivmodti4_windows_x86_64, linkage); @export("__umodti3", @import("compiler_rt/umodti3.zig").__umodti3_windows_x86_64, linkage); @@ -176,11 +175,11 @@ comptime { @export("__divti3", @import("compiler_rt/divti3.zig").__divti3, linkage); @export("__modti3", @import("compiler_rt/modti3.zig").__modti3, linkage); @export("__multi3", @import("compiler_rt/multi3.zig").__multi3, linkage); - @export("__muloti4", @import("compiler_rt/muloti4.zig").__muloti4, linkage); @export("__udivti3", @import("compiler_rt/udivti3.zig").__udivti3, linkage); @export("__udivmodti4", @import("compiler_rt/udivmodti4.zig").__udivmodti4, linkage); @export("__umodti3", @import("compiler_rt/umodti3.zig").__umodti3, linkage); } + @export("__muloti4", @import("compiler_rt/muloti4.zig").__muloti4, linkage); } const std = @import("std"); diff --git a/std/special/compiler_rt/muloti4.zig b/std/special/compiler_rt/muloti4.zig @@ -44,11 +44,6 @@ pub extern fn __muloti4(a: i128, b: i128, overflow: *c_int) i128 { return r; } -const v128 = @Vector(2, u64); -pub extern fn __muloti4_windows_x86_64(a: v128, b: v128, overflow: *c_int) v128 { - return @bitCast(v128, @inlineCall(__muloti4, @bitCast(i128, a), @bitCast(i128, b), overflow)); -} - test "import muloti4" { _ = @import("muloti4_test.zig"); } diff --git a/test/stage1/behavior/math.zig b/test/stage1/behavior/math.zig @@ -632,3 +632,10 @@ fn testNanEqNan(comptime F: type) void { expect(!(nan1 < nan2)); expect(!(nan1 <= nan2)); } + +test "128-bit multiplication" { + var a: i128 = 3; + var b: i128 = 2; + var c = a * b; + expect(c == 6); +}