Skip to content

Commit a4c7e4c

Browse files
committed
__muloti4 does not need the ABI workaround on Windows
Fixes 128-bit integer multiplication on Windows. closes #2250
1 parent 13798d2 commit a4c7e4c

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

std/special/compiler_rt.zig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ comptime {
165165
@export("__divti3", @import("compiler_rt/divti3.zig").__divti3_windows_x86_64, linkage);
166166
@export("__modti3", @import("compiler_rt/modti3.zig").__modti3_windows_x86_64, linkage);
167167
@export("__multi3", @import("compiler_rt/multi3.zig").__multi3_windows_x86_64, linkage);
168-
@export("__muloti4", @import("compiler_rt/muloti4.zig").__muloti4_windows_x86_64, linkage);
169168
@export("__udivti3", @import("compiler_rt/udivti3.zig").__udivti3_windows_x86_64, linkage);
170169
@export("__udivmodti4", @import("compiler_rt/udivmodti4.zig").__udivmodti4_windows_x86_64, linkage);
171170
@export("__umodti3", @import("compiler_rt/umodti3.zig").__umodti3_windows_x86_64, linkage);
@@ -176,11 +175,11 @@ comptime {
176175
@export("__divti3", @import("compiler_rt/divti3.zig").__divti3, linkage);
177176
@export("__modti3", @import("compiler_rt/modti3.zig").__modti3, linkage);
178177
@export("__multi3", @import("compiler_rt/multi3.zig").__multi3, linkage);
179-
@export("__muloti4", @import("compiler_rt/muloti4.zig").__muloti4, linkage);
180178
@export("__udivti3", @import("compiler_rt/udivti3.zig").__udivti3, linkage);
181179
@export("__udivmodti4", @import("compiler_rt/udivmodti4.zig").__udivmodti4, linkage);
182180
@export("__umodti3", @import("compiler_rt/umodti3.zig").__umodti3, linkage);
183181
}
182+
@export("__muloti4", @import("compiler_rt/muloti4.zig").__muloti4, linkage);
184183
}
185184

186185
const std = @import("std");

std/special/compiler_rt/muloti4.zig

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ pub extern fn __muloti4(a: i128, b: i128, overflow: *c_int) i128 {
4444
return r;
4545
}
4646

47-
const v128 = @Vector(2, u64);
48-
pub extern fn __muloti4_windows_x86_64(a: v128, b: v128, overflow: *c_int) v128 {
49-
return @bitCast(v128, @inlineCall(__muloti4, @bitCast(i128, a), @bitCast(i128, b), overflow));
50-
}
51-
5247
test "import muloti4" {
5348
_ = @import("muloti4_test.zig");
5449
}

test/stage1/behavior/math.zig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,3 +632,10 @@ fn testNanEqNan(comptime F: type) void {
632632
expect(!(nan1 < nan2));
633633
expect(!(nan1 <= nan2));
634634
}
635+
636+
test "128-bit multiplication" {
637+
var a: i128 = 3;
638+
var b: i128 = 2;
639+
var c = a * b;
640+
expect(c == 6);
641+
}

0 commit comments

Comments
 (0)