Skip to content

Commit

Permalink
__muloti4 does not need the ABI workaround on Windows
Browse files Browse the repository at this point in the history
Fixes 128-bit integer multiplication on Windows.

closes #2250
  • Loading branch information
andrewrk committed Apr 11, 2019
1 parent 13798d2 commit a4c7e4c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 1 addition & 2 deletions std/special/compiler_rt.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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");
Expand Down
5 changes: 0 additions & 5 deletions std/special/compiler_rt/muloti4.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
7 changes: 7 additions & 0 deletions test/stage1/behavior/math.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit a4c7e4c

Please sign in to comment.