Commit a4c7e4c4eb

Andrew Kelley <andrew@ziglang.org>
2019-04-11 04:33:33
__muloti4 does not need the ABI workaround on Windows
Fixes 128-bit integer multiplication on Windows. closes #2250
1 parent 13798d2
Changed files (3)
std
special
test
stage1
behavior
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");
 }
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");
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);
+}