| author | |
| committer | |
| log | a369d69c5144c2a4186e4f8d20bfda0c3f86605a |
| tree | 22a69c778dbb066c972705ca3153b05eb78f4c7f |
| parent | 911014051487e83177689893e57491b86e72589b |
4 files changed, 25 insertions(+), 4 deletions(-)
std/special/compiler_rt/divti3.zig+10| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | const udivmod = @import("udivmod.zig").udivmod; |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const compiler_rt = @import("index.zig"); | |
| 3 | 4 | |
| 4 | 5 | pub extern fn __divti3(a: i128, b: i128) i128 { |
| 5 | 6 | @setRuntimeSafety(builtin.is_test); |
| ... | ... | @@ -14,3 +15,12 @@ pub extern fn __divti3(a: i128, b: i128) i128 { |
| 14 | 15 | const s = s_a ^ s_b; |
| 15 | 16 | return (i128(r) ^ s) -% s; |
| 16 | 17 | } |
| 18 | ||
| 19 | pub extern fn __divti3_windows_x86_64(a: *const i128, b: *const i128) void { | |
| 20 | @setRuntimeSafety(builtin.is_test); | |
| 21 | compiler_rt.setXmm0(i128, __divti3(a.*, b.*)); | |
| 22 | } | |
| 23 | ||
| 24 | test "import divti3" { | |
| 25 | _ = @import("divti3_test.zig"); | |
| 26 | } |
std/special/compiler_rt/index.zig+4-3| ... | ... | @@ -38,9 +38,6 @@ comptime { |
| 38 | 38 | @export("__umoddi3", __umoddi3, linkage); |
| 39 | 39 | @export("__udivmodsi4", __udivmodsi4, linkage); |
| 40 | 40 | |
| 41 | @export("__divti3", @import("divti3.zig").__divti3, linkage); | |
| 42 | @export("__muloti4", @import("muloti4.zig").__muloti4, linkage); | |
| 43 | ||
| 44 | 41 | if (isArmArch()) { |
| 45 | 42 | @export("__aeabi_uldivmod", __aeabi_uldivmod, linkage); |
| 46 | 43 | @export("__aeabi_uidivmod", __aeabi_uidivmod, linkage); |
| ... | ... | @@ -61,6 +58,8 @@ comptime { |
| 61 | 58 | @export("__chkstk", __chkstk, strong_linkage); |
| 62 | 59 | @export("___chkstk_ms", ___chkstk_ms, linkage); |
| 63 | 60 | } |
| 61 | @export("__divti3", @import("divti3.zig").__divti3_windows_x86_64, linkage); | |
| 62 | @export("__muloti4", @import("muloti4.zig").__muloti4_windows_x86_64, linkage); | |
| 64 | 63 | @export("__udivti3", @import("udivti3.zig").__udivti3_windows_x86_64, linkage); |
| 65 | 64 | @export("__udivmodti4", @import("udivmodti4.zig").__udivmodti4_windows_x86_64, linkage); |
| 66 | 65 | @export("__umodti3", @import("umodti3.zig").__umodti3_windows_x86_64, linkage); |
| ... | ... | @@ -68,6 +67,8 @@ comptime { |
| 68 | 67 | else => {}, |
| 69 | 68 | } |
| 70 | 69 | } else { |
| 70 | @export("__divti3", @import("divti3.zig").__divti3, linkage); | |
| 71 | @export("__muloti4", @import("muloti4.zig").__muloti4, linkage); | |
| 71 | 72 | @export("__udivti3", @import("udivti3.zig").__udivti3, linkage); |
| 72 | 73 | @export("__udivmodti4", @import("udivmodti4.zig").__udivmodti4, linkage); |
| 73 | 74 | @export("__umodti3", @import("umodti3.zig").__umodti3, linkage); |
std/special/compiler_rt/muloti4.zig+10| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | const udivmod = @import("udivmod.zig").udivmod; |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const compiler_rt = @import("index.zig"); | |
| 3 | 4 | |
| 4 | 5 | pub extern fn __muloti4(a: i128, b: i128, overflow: *c_int) i128 { |
| 5 | 6 | @setRuntimeSafety(builtin.is_test); |
| ... | ... | @@ -43,3 +44,12 @@ pub extern fn __muloti4(a: i128, b: i128, overflow: *c_int) i128 { |
| 43 | 44 | |
| 44 | 45 | return r; |
| 45 | 46 | } |
| 47 | ||
| 48 | pub extern fn __muloti4_windows_x86_64(a: *const i128, b: *const i128, overflow: *c_int) void { | |
| 49 | @setRuntimeSafety(builtin.is_test); | |
| 50 | compiler_rt.setXmm0(i128, __muloti4(a.*, b.*, overflow)); | |
| 51 | } | |
| 52 | ||
| 53 | test "import muloti4" { | |
| 54 | _ = @import("muloti4_test.zig"); | |
| 55 | } |
std/special/compiler_rt/muloti4_test.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ const assert = @import("std").debug.assert; |
| 4 | 4 | fn test__muloti4(a: i128, b: i128, expected: i128, expected_overflow: c_int) void { |
| 5 | 5 | var overflow: c_int = undefined; |
| 6 | 6 | const x = __muloti4(a, b, &overflow); |
| 7 | assert(overflow == expected_overflow and (overflow != 0 or x == expected)); | |
| 7 | assert(overflow == expected_overflow and (expected_overflow != 0 or x == expected)); | |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | test "muloti4" { |