From a4c7e4c4eb7b1000252fab3f98f6204edb48a4bd Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 10 Apr 2019 22:33:33 -0400 Subject: [PATCH] __muloti4 does not need the ABI workaround on Windows Fixes 128-bit integer multiplication on Windows. closes #2250 --- std/special/compiler_rt.zig | 3 +-- std/special/compiler_rt/muloti4.zig | 5 ----- test/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 index 6eb87cbd93..e2ecd1b0cf 100644 --- 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 index 65953f3e1d..ccde8e3e6c 100644 --- 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 index 23dc6d1feb..acbd9209df 100644 --- 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); +}