authorgravatar for topolarity@tapscott.meCody Tapscott <topolarity@tapscott.me> 2022-07-10 16:42:58-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-10 20:51:34-07:00
logbb8971150c6844bbb6eaee3687068bf2d4923710
treed0f3672766368eb52ba49a82b8f8019b1fd9c387
parent680419c407bc1216b86511d1f045d0d92066584e

compiler_rt: Slightly re-factor exports for Windows x86-64

This is just a cosmetic change. The goal is to keep the export logic relatively flat and centralized.

26 files changed, 169 insertions(+), 309 deletions(-)

lib/compiler_rt/common.zig+4
......@@ -17,6 +17,10 @@ pub const want_aeabi = switch (builtin.abi) {
1717};
1818pub const want_ppc_abi = builtin.cpu.arch.isPPC() or builtin.cpu.arch.isPPC64();
1919
20// Libcalls that involve u128 on Windows x86-64 are expected by LLVM to use the
21// calling convention of @Vector(2, u64), rather than what's standard.
22pub const want_windows_v2u64_abi = builtin.os.tag == .windows and builtin.cpu.arch == .x86_64;
23
2024/// This governs whether to use these symbol names for f16/f32 conversions
2125/// rather than the standard names:
2226/// * __gnu_f2h_ieee
lib/compiler_rt/fixdfti.zig+8-11
......@@ -1,26 +1,23 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const floatToInt = @import("./float_to_int.zig").floatToInt;
54
65pub const panic = common.panic;
76
87comptime {
9 const fixdfti_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __fixdfti_windows_x86_64;
13 } else __fixdfti;
14
15 @export(fixdfti_fn, .{ .name = "__fixdfti", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__fixdfti_windows_x86_64, .{ .name = "__fixdfti", .linkage = common.linkage });
10 } else {
11 @export(__fixdfti, .{ .name = "__fixdfti", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __fixdfti(a: f64) callconv(.C) i128 {
1916 return floatToInt(i128, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
19const v2u64 = @Vector(2, u64);
2320
24fn __fixdfti_windows_x86_64(a: f64) callconv(.C) v128 {
25 return @bitCast(v128, floatToInt(i128, a));
21fn __fixdfti_windows_x86_64(a: f64) callconv(.C) v2u64 {
22 return @bitCast(v2u64, floatToInt(i128, a));
2623}
lib/compiler_rt/fixhfti.zig+8-11
......@@ -1,26 +1,23 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const floatToInt = @import("./float_to_int.zig").floatToInt;
54
65pub const panic = common.panic;
76
87comptime {
9 const fixhfti_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __fixhfti_windows_x86_64;
13 } else __fixhfti;
14
15 @export(fixhfti_fn, .{ .name = "__fixhfti", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__fixhfti_windows_x86_64, .{ .name = "__fixhfti", .linkage = common.linkage });
10 } else {
11 @export(__fixhfti, .{ .name = "__fixhfti", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __fixhfti(a: f16) callconv(.C) i128 {
1916 return floatToInt(i128, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
19const v2u64 = @Vector(2, u64);
2320
24fn __fixhfti_windows_x86_64(a: f16) callconv(.C) v128 {
25 return @bitCast(v128, floatToInt(i128, a));
21fn __fixhfti_windows_x86_64(a: f16) callconv(.C) v2u64 {
22 return @bitCast(v2u64, floatToInt(i128, a));
2623}
lib/compiler_rt/fixsfti.zig+8-11
......@@ -1,26 +1,23 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const floatToInt = @import("./float_to_int.zig").floatToInt;
54
65pub const panic = common.panic;
76
87comptime {
9 const fixsfti_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __fixsfti_windows_x86_64;
13 } else __fixsfti;
14
15 @export(fixsfti_fn, .{ .name = "__fixsfti", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__fixsfti_windows_x86_64, .{ .name = "__fixsfti", .linkage = common.linkage });
10 } else {
11 @export(__fixsfti, .{ .name = "__fixsfti", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __fixsfti(a: f32) callconv(.C) i128 {
1916 return floatToInt(i128, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
19const v2u64 = @Vector(2, u64);
2320
24fn __fixsfti_windows_x86_64(a: f32) callconv(.C) v128 {
25 return @bitCast(v128, floatToInt(i128, a));
21fn __fixsfti_windows_x86_64(a: f32) callconv(.C) v2u64 {
22 return @bitCast(v2u64, floatToInt(i128, a));
2623}
lib/compiler_rt/fixtfti.zig+8-11
......@@ -1,26 +1,23 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const floatToInt = @import("./float_to_int.zig").floatToInt;
54
65pub const panic = common.panic;
76
87comptime {
9 const fixtfti_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __fixtfti_windows_x86_64;
13 } else __fixtfti;
14
15 @export(fixtfti_fn, .{ .name = "__fixtfti", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__fixtfti_windows_x86_64, .{ .name = "__fixtfti", .linkage = common.linkage });
10 } else {
11 @export(__fixtfti, .{ .name = "__fixtfti", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __fixtfti(a: f128) callconv(.C) i128 {
1916 return floatToInt(i128, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
19const v2u64 = @Vector(2, u64);
2320
24fn __fixtfti_windows_x86_64(a: f128) callconv(.C) v128 {
25 return @bitCast(v128, floatToInt(i128, a));
21fn __fixtfti_windows_x86_64(a: f128) callconv(.C) v2u64 {
22 return @bitCast(v2u64, floatToInt(i128, a));
2623}
lib/compiler_rt/fixunsdfti.zig+8-11
......@@ -1,26 +1,23 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const floatToInt = @import("./float_to_int.zig").floatToInt;
54
65pub const panic = common.panic;
76
87comptime {
9 const fixunsdfti_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __fixunsdfti_windows_x86_64;
13 } else __fixunsdfti;
14
15 @export(fixunsdfti_fn, .{ .name = "__fixunsdfti", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__fixunsdfti_windows_x86_64, .{ .name = "__fixunsdfti", .linkage = common.linkage });
10 } else {
11 @export(__fixunsdfti, .{ .name = "__fixunsdfti", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __fixunsdfti(a: f64) callconv(.C) u128 {
1916 return floatToInt(u128, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
19const v2u64 = @Vector(2, u64);
2320
24fn __fixunsdfti_windows_x86_64(a: f64) callconv(.C) v128 {
25 return @bitCast(v128, floatToInt(u128, a));
21fn __fixunsdfti_windows_x86_64(a: f64) callconv(.C) v2u64 {
22 return @bitCast(v2u64, floatToInt(u128, a));
2623}
lib/compiler_rt/fixunshfti.zig+8-11
......@@ -1,26 +1,23 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const floatToInt = @import("./float_to_int.zig").floatToInt;
54
65pub const panic = common.panic;
76
87comptime {
9 const fixunshfti_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __fixunshfti_windows_x86_64;
13 } else __fixunshfti;
14
15 @export(fixunshfti_fn, .{ .name = "__fixunshfti", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__fixunshfti_windows_x86_64, .{ .name = "__fixunshfti", .linkage = common.linkage });
10 } else {
11 @export(__fixunshfti, .{ .name = "__fixunshfti", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __fixunshfti(a: f16) callconv(.C) u128 {
1916 return floatToInt(u128, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
19const v2u64 = @import("std").meta.Vector(2, u64);
2320
24fn __fixunshfti_windows_x86_64(a: f16) callconv(.C) v128 {
25 return @bitCast(v128, floatToInt(u128, a));
21fn __fixunshfti_windows_x86_64(a: f16) callconv(.C) v2u64 {
22 return @bitCast(v2u64, floatToInt(u128, a));
2623}
lib/compiler_rt/fixunssfti.zig+8-11
......@@ -1,26 +1,23 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const floatToInt = @import("./float_to_int.zig").floatToInt;
54
65pub const panic = common.panic;
76
87comptime {
9 const fixunssfti_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __fixunssfti_windows_x86_64;
13 } else __fixunssfti;
14
15 @export(fixunssfti_fn, .{ .name = "__fixunssfti", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__fixunssfti_windows_x86_64, .{ .name = "__fixunssfti", .linkage = common.linkage });
10 } else {
11 @export(__fixunssfti, .{ .name = "__fixunssfti", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __fixunssfti(a: f32) callconv(.C) u128 {
1916 return floatToInt(u128, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
19const v2u64 = @Vector(2, u64);
2320
24fn __fixunssfti_windows_x86_64(a: f32) callconv(.C) v128 {
25 return @bitCast(v128, floatToInt(u128, a));
21fn __fixunssfti_windows_x86_64(a: f32) callconv(.C) v2u64 {
22 return @bitCast(v2u64, floatToInt(u128, a));
2623}
lib/compiler_rt/fixunstfti.zig+8-11
......@@ -1,26 +1,23 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const floatToInt = @import("./float_to_int.zig").floatToInt;
54
65pub const panic = common.panic;
76
87comptime {
9 const fixunstfti_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __fixunstfti_windows_x86_64;
13 } else __fixunstfti;
14
15 @export(fixunstfti_fn, .{ .name = "__fixunstfti", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__fixunstfti_windows_x86_64, .{ .name = "__fixunstfti", .linkage = common.linkage });
10 } else {
11 @export(__fixunstfti, .{ .name = "__fixunstfti", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __fixunstfti(a: f128) callconv(.C) u128 {
1916 return floatToInt(u128, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
19const v2u64 = @Vector(2, u64);
2320
24fn __fixunstfti_windows_x86_64(a: f128) callconv(.C) v128 {
25 return @bitCast(v128, floatToInt(u128, a));
21fn __fixunstfti_windows_x86_64(a: f128) callconv(.C) v2u64 {
22 return @bitCast(v2u64, floatToInt(u128, a));
2623}
lib/compiler_rt/fixunsxfti.zig+8-11
......@@ -1,26 +1,23 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const floatToInt = @import("./float_to_int.zig").floatToInt;
54
65pub const panic = common.panic;
76
87comptime {
9 const fixunsxfti_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __fixunsxfti_windows_x86_64;
13 } else __fixunsxfti;
14
15 @export(fixunsxfti_fn, .{ .name = "__fixunsxfti", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__fixunsxfti_windows_x86_64, .{ .name = "__fixunsxfti", .linkage = common.linkage });
10 } else {
11 @export(__fixunsxfti, .{ .name = "__fixunsxfti", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __fixunsxfti(a: f80) callconv(.C) u128 {
1916 return floatToInt(u128, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
19const v2u64 = @Vector(2, u64);
2320
24fn __fixunsxfti_windows_x86_64(a: f80) callconv(.C) v128 {
25 return @bitCast(v128, floatToInt(u128, a));
21fn __fixunsxfti_windows_x86_64(a: f80) callconv(.C) v2u64 {
22 return @bitCast(v2u64, floatToInt(u128, a));
2623}
lib/compiler_rt/fixxfti.zig+8-11
......@@ -1,26 +1,23 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const floatToInt = @import("./float_to_int.zig").floatToInt;
54
65pub const panic = common.panic;
76
87comptime {
9 const fixxfti_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __fixxfti_windows_x86_64;
13 } else __fixxfti;
14
15 @export(fixxfti_fn, .{ .name = "__fixxfti", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__fixxfti_windows_x86_64, .{ .name = "__fixxfti", .linkage = common.linkage });
10 } else {
11 @export(__fixxfti, .{ .name = "__fixxfti", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __fixxfti(a: f80) callconv(.C) i128 {
1916 return floatToInt(i128, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
19const v2u64 = @Vector(2, u64);
2320
24fn __fixxfti_windows_x86_64(a: f80) callconv(.C) v128 {
25 return @bitCast(v128, floatToInt(i128, a));
21fn __fixxfti_windows_x86_64(a: f80) callconv(.C) v2u64 {
22 return @bitCast(v2u64, floatToInt(i128, a));
2623}
lib/compiler_rt/floattidf.zig+6-11
......@@ -1,26 +1,21 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const intToFloat = @import("./int_to_float.zig").intToFloat;
54
65pub const panic = common.panic;
76
87comptime {
9 const floattidf_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __floattidf_windows_x86_64;
13 } else __floattidf;
14
15 @export(floattidf_fn, .{ .name = "__floattidf", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__floattidf_windows_x86_64, .{ .name = "__floattidf", .linkage = common.linkage });
10 } else {
11 @export(__floattidf, .{ .name = "__floattidf", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __floattidf(a: i128) callconv(.C) f64 {
1916 return intToFloat(f64, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
23
24fn __floattidf_windows_x86_64(a: v128) callconv(.C) f64 {
19fn __floattidf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f64 {
2520 return intToFloat(f64, @bitCast(i128, a));
2621}
lib/compiler_rt/floattihf.zig+6-11
......@@ -1,26 +1,21 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const intToFloat = @import("./int_to_float.zig").intToFloat;
54
65pub const panic = common.panic;
76
87comptime {
9 const floattihf_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __floattihf_windows_x86_64;
13 } else __floattihf;
14
15 @export(floattihf_fn, .{ .name = "__floattihf", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__floattihf_windows_x86_64, .{ .name = "__floattihf", .linkage = common.linkage });
10 } else {
11 @export(__floattihf, .{ .name = "__floattihf", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __floattihf(a: i128) callconv(.C) f16 {
1916 return intToFloat(f16, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
23
24fn __floattihf_windows_x86_64(a: v128) callconv(.C) f16 {
19fn __floattihf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f16 {
2520 return intToFloat(f16, @bitCast(i128, a));
2621}
lib/compiler_rt/floattisf.zig+6-11
......@@ -1,26 +1,21 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const intToFloat = @import("./int_to_float.zig").intToFloat;
54
65pub const panic = common.panic;
76
87comptime {
9 const floattisf_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __floattisf_windows_x86_64;
13 } else __floattisf;
14
15 @export(floattisf_fn, .{ .name = "__floattisf", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__floattisf_windows_x86_64, .{ .name = "__floattisf", .linkage = common.linkage });
10 } else {
11 @export(__floattisf, .{ .name = "__floattisf", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __floattisf(a: i128) callconv(.C) f32 {
1916 return intToFloat(f32, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
23
24fn __floattisf_windows_x86_64(a: v128) callconv(.C) f32 {
19fn __floattisf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f32 {
2520 return intToFloat(f32, @bitCast(i128, a));
2621}
lib/compiler_rt/floattitf.zig+6-11
......@@ -1,26 +1,21 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const intToFloat = @import("./int_to_float.zig").intToFloat;
54
65pub const panic = common.panic;
76
87comptime {
9 const floattitf_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __floattitf_windows_x86_64;
13 } else __floattitf;
14
15 @export(floattitf_fn, .{ .name = "__floattitf", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__floattitf_windows_x86_64, .{ .name = "__floattitf", .linkage = common.linkage });
10 } else {
11 @export(__floattitf, .{ .name = "__floattitf", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __floattitf(a: i128) callconv(.C) f128 {
1916 return intToFloat(f128, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
23
24fn __floattitf_windows_x86_64(a: v128) callconv(.C) f128 {
19fn __floattitf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f128 {
2520 return intToFloat(f128, @bitCast(i128, a));
2621}
lib/compiler_rt/floattixf.zig+6-11
......@@ -1,26 +1,21 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const intToFloat = @import("./int_to_float.zig").intToFloat;
54
65pub const panic = common.panic;
76
87comptime {
9 const floattixf_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __floattixf_windows_x86_64;
13 } else __floattixf;
14
15 @export(floattixf_fn, .{ .name = "__floattixf", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__floattixf_windows_x86_64, .{ .name = "__floattixf", .linkage = common.linkage });
10 } else {
11 @export(__floattixf, .{ .name = "__floattixf", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __floattixf(a: i128) callconv(.C) f80 {
1916 return intToFloat(f80, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
23
24fn __floattixf_windows_x86_64(a: v128) callconv(.C) f80 {
19fn __floattixf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f80 {
2520 return intToFloat(f80, @bitCast(i128, a));
2621}
lib/compiler_rt/floatuntidf.zig+6-11
......@@ -1,26 +1,21 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const intToFloat = @import("./int_to_float.zig").intToFloat;
54
65pub const panic = common.panic;
76
87comptime {
9 const floatuntidf_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __floatuntidf_windows_x86_64;
13 } else __floatuntidf;
14
15 @export(floatuntidf_fn, .{ .name = "__floatuntidf", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__floatuntidf_windows_x86_64, .{ .name = "__floatuntidf", .linkage = common.linkage });
10 } else {
11 @export(__floatuntidf, .{ .name = "__floatuntidf", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __floatuntidf(a: u128) callconv(.C) f64 {
1916 return intToFloat(f64, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
23
24fn __floatuntidf_windows_x86_64(a: v128) callconv(.C) f64 {
19fn __floatuntidf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f64 {
2520 return intToFloat(f64, @bitCast(u128, a));
2621}
lib/compiler_rt/floatuntihf.zig+6-11
......@@ -1,26 +1,21 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const intToFloat = @import("./int_to_float.zig").intToFloat;
54
65pub const panic = common.panic;
76
87comptime {
9 const floatuntihf_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __floatuntihf_windows_x86_64;
13 } else __floatuntihf;
14
15 @export(floatuntihf_fn, .{ .name = "__floatuntihf", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__floatuntihf_windows_x86_64, .{ .name = "__floatuntihf", .linkage = common.linkage });
10 } else {
11 @export(__floatuntihf, .{ .name = "__floatuntihf", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __floatuntihf(a: u128) callconv(.C) f16 {
1916 return intToFloat(f16, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
23
24fn __floatuntihf_windows_x86_64(a: v128) callconv(.C) f16 {
19fn __floatuntihf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f16 {
2520 return intToFloat(f16, @bitCast(u128, a));
2621}
lib/compiler_rt/floatuntisf.zig+6-11
......@@ -1,26 +1,21 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const intToFloat = @import("./int_to_float.zig").intToFloat;
54
65pub const panic = common.panic;
76
87comptime {
9 const floatuntisf_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __floatuntisf_windows_x86_64;
13 } else __floatuntisf;
14
15 @export(floatuntisf_fn, .{ .name = "__floatuntisf", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__floatuntisf_windows_x86_64, .{ .name = "__floatuntisf", .linkage = common.linkage });
10 } else {
11 @export(__floatuntisf, .{ .name = "__floatuntisf", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __floatuntisf(a: u128) callconv(.C) f32 {
1916 return intToFloat(f32, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
23
24fn __floatuntisf_windows_x86_64(a: v128) callconv(.C) f32 {
19fn __floatuntisf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f32 {
2520 return intToFloat(f32, @bitCast(u128, a));
2621}
lib/compiler_rt/floatuntitf.zig+6-11
......@@ -1,5 +1,4 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const intToFloat = @import("./int_to_float.zig").intToFloat;
54
......@@ -8,21 +7,17 @@ pub const panic = common.panic;
87comptime {
98 const symbol_name = if (common.want_ppc_abi) "__floatuntikf" else "__floatuntitf";
109
11 const floatuntitf_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
12 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
13 // that LLVM expects compiler-rt to have.
14 break :b __floatuntitf_windows_x86_64;
15 } else __floatuntitf;
16
17 @export(floatuntitf_fn, .{ .name = symbol_name, .linkage = common.linkage });
10 if (common.want_windows_v2u64_abi) {
11 @export(__floatuntitf_windows_x86_64, .{ .name = symbol_name, .linkage = common.linkage });
12 } else {
13 @export(__floatuntitf, .{ .name = symbol_name, .linkage = common.linkage });
14 }
1815}
1916
2017pub fn __floatuntitf(a: u128) callconv(.C) f128 {
2118 return intToFloat(f128, a);
2219}
2320
24const v128 = @import("std").meta.Vector(2, u64);
25
26fn __floatuntitf_windows_x86_64(a: v128) callconv(.C) f128 {
21fn __floatuntitf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f128 {
2722 return intToFloat(f128, @bitCast(u128, a));
2823}
lib/compiler_rt/floatuntixf.zig+6-11
......@@ -1,26 +1,21 @@
11const builtin = @import("builtin");
2const arch = builtin.cpu.arch;
32const common = @import("./common.zig");
43const intToFloat = @import("./int_to_float.zig").intToFloat;
54
65pub const panic = common.panic;
76
87comptime {
9 const floatuntixf_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
10 // The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
11 // that LLVM expects compiler-rt to have.
12 break :b __floatuntixf_windows_x86_64;
13 } else __floatuntixf;
14
15 @export(floatuntixf_fn, .{ .name = "__floatuntixf", .linkage = common.linkage });
8 if (common.want_windows_v2u64_abi) {
9 @export(__floatuntixf_windows_x86_64, .{ .name = "__floatuntixf", .linkage = common.linkage });
10 } else {
11 @export(__floatuntixf, .{ .name = "__floatuntixf", .linkage = common.linkage });
12 }
1613}
1714
1815pub fn __floatuntixf(a: u128) callconv(.C) f80 {
1916 return intToFloat(f80, a);
2017}
2118
22const v128 = @import("std").meta.Vector(2, u64);
23
24fn __floatuntixf_windows_x86_64(a: v128) callconv(.C) f80 {
19fn __floatuntixf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f80 {
2520 return intToFloat(f80, @bitCast(u128, a));
2621}
lib/compiler_rt/modti3.zig+5-19
......@@ -5,27 +5,13 @@
55const std = @import("std");
66const builtin = @import("builtin");
77const udivmod = @import("udivmod.zig").udivmod;
8const arch = builtin.cpu.arch;
98const common = @import("common.zig");
109
1110pub const panic = common.panic;
1211
1312comptime {
14 if (builtin.os.tag == .windows) {
15 switch (arch) {
16 .i386 => {
17 @export(__modti3, .{ .name = "__modti3", .linkage = common.linkage });
18 },
19 .x86_64 => {
20 // The "ti" functions must use Vector(2, u64) parameter types to adhere to the ABI
21 // that LLVM expects compiler-rt to have.
22 @export(__modti3_windows_x86_64, .{ .name = "__modti3", .linkage = common.linkage });
23 },
24 else => {},
25 }
26 if (arch.isAARCH64()) {
27 @export(__modti3, .{ .name = "__modti3", .linkage = common.linkage });
28 }
13 if (common.want_windows_v2u64_abi) {
14 @export(__modti3_windows_x86_64, .{ .name = "__modti3", .linkage = common.linkage });
2915 } else {
3016 @export(__modti3, .{ .name = "__modti3", .linkage = common.linkage });
3117 }
......@@ -35,10 +21,10 @@ pub fn __modti3(a: i128, b: i128) callconv(.C) i128 {
3521 return mod(a, b);
3622}
3723
38const v128 = @import("std").meta.Vector(2, u64);
24const v2u64 = @Vector(2, u64);
3925
40fn __modti3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
41 return @bitCast(v128, mod(@bitCast(i128, a), @bitCast(i128, b)));
26fn __modti3_windows_x86_64(a: v2u64, b: v2u64) callconv(.C) v2u64 {
27 return @bitCast(v2u64, mod(@bitCast(i128, a), @bitCast(i128, b)));
4228}
4329
4430inline fn mod(a: i128, b: i128) i128 {
lib/compiler_rt/multi3.zig+5-16
......@@ -4,25 +4,14 @@
44
55const std = @import("std");
66const builtin = @import("builtin");
7const arch = builtin.cpu.arch;
87const native_endian = builtin.cpu.arch.endian();
98const common = @import("common.zig");
109
1110pub const panic = common.panic;
1211
1312comptime {
14 if (builtin.os.tag == .windows) {
15 switch (arch) {
16 .i386 => {
17 @export(__multi3, .{ .name = "__multi3", .linkage = common.linkage });
18 },
19 .x86_64 => {
20 // The "ti" functions must use Vector(2, u64) parameter types to adhere to the ABI
21 // that LLVM expects compiler-rt to have.
22 @export(__multi3_windows_x86_64, .{ .name = "__multi3", .linkage = common.linkage });
23 },
24 else => {},
25 }
13 if (common.want_windows_v2u64_abi) {
14 @export(__multi3_windows_x86_64, .{ .name = "__multi3", .linkage = common.linkage });
2615 } else {
2716 @export(__multi3, .{ .name = "__multi3", .linkage = common.linkage });
2817 }
......@@ -32,10 +21,10 @@ pub fn __multi3(a: i128, b: i128) callconv(.C) i128 {
3221 return mul(a, b);
3322}
3423
35const v128 = @Vector(2, u64);
24const v2u64 = @Vector(2, u64);
3625
37fn __multi3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
38 return @bitCast(v128, mul(@bitCast(i128, a), @bitCast(i128, b)));
26fn __multi3_windows_x86_64(a: v2u64, b: v2u64) callconv(.C) v2u64 {
27 return @bitCast(v2u64, mul(@bitCast(i128, a), @bitCast(i128, b)));
3928}
4029
4130inline fn mul(a: i128, b: i128) i128 {
lib/compiler_rt/udivmodti4.zig+5-16
......@@ -1,24 +1,13 @@
11const std = @import("std");
22const builtin = @import("builtin");
33const udivmod = @import("udivmod.zig").udivmod;
4const arch = builtin.cpu.arch;
54const common = @import("common.zig");
65
76pub const panic = common.panic;
87
98comptime {
10 if (builtin.os.tag == .windows) {
11 switch (arch) {
12 .i386 => {
13 @export(__udivmodti4, .{ .name = "__udivmodti4", .linkage = common.linkage });
14 },
15 .x86_64 => {
16 // The "ti" functions must use Vector(2, u64) parameter types to adhere to the ABI
17 // that LLVM expects compiler-rt to have.
18 @export(__udivmodti4_windows_x86_64, .{ .name = "__udivmodti4", .linkage = common.linkage });
19 },
20 else => {},
21 }
9 if (common.want_windows_v2u64_abi) {
10 @export(__udivmodti4_windows_x86_64, .{ .name = "__udivmodti4", .linkage = common.linkage });
2211 } else {
2312 @export(__udivmodti4, .{ .name = "__udivmodti4", .linkage = common.linkage });
2413 }
......@@ -28,10 +17,10 @@ pub fn __udivmodti4(a: u128, b: u128, maybe_rem: ?*u128) callconv(.C) u128 {
2817 return udivmod(u128, a, b, maybe_rem);
2918}
3019
31const v128 = std.meta.Vector(2, u64);
20const v2u64 = @Vector(2, u64);
3221
33fn __udivmodti4_windows_x86_64(a: v128, b: v128, maybe_rem: ?*u128) callconv(.C) v128 {
34 return @bitCast(v128, udivmod(u128, @bitCast(u128, a), @bitCast(u128, b), maybe_rem));
22fn __udivmodti4_windows_x86_64(a: v2u64, b: v2u64, maybe_rem: ?*u128) callconv(.C) v2u64 {
23 return @bitCast(v2u64, udivmod(u128, @bitCast(u128, a), @bitCast(u128, b), maybe_rem));
3524}
3625
3726test {
lib/compiler_rt/udivti3.zig+5-19
......@@ -1,27 +1,13 @@
11const std = @import("std");
22const builtin = @import("builtin");
33const udivmod = @import("udivmod.zig").udivmod;
4const arch = builtin.cpu.arch;
54const common = @import("common.zig");
65
76pub const panic = common.panic;
87
98comptime {
10 if (builtin.os.tag == .windows) {
11 switch (arch) {
12 .i386 => {
13 @export(__udivti3, .{ .name = "__udivti3", .linkage = common.linkage });
14 },
15 .x86_64 => {
16 // The "ti" functions must use Vector(2, u64) parameter types to adhere to the ABI
17 // that LLVM expects compiler-rt to have.
18 @export(__udivti3_windows_x86_64, .{ .name = "__udivti3", .linkage = common.linkage });
19 },
20 else => {},
21 }
22 if (arch.isAARCH64()) {
23 @export(__udivti3, .{ .name = "__udivti3", .linkage = common.linkage });
24 }
9 if (common.want_windows_v2u64_abi) {
10 @export(__udivti3_windows_x86_64, .{ .name = "__udivti3", .linkage = common.linkage });
2511 } else {
2612 @export(__udivti3, .{ .name = "__udivti3", .linkage = common.linkage });
2713 }
......@@ -31,8 +17,8 @@ pub fn __udivti3(a: u128, b: u128) callconv(.C) u128 {
3117 return udivmod(u128, a, b, null);
3218}
3319
34const v128 = std.meta.Vector(2, u64);
20const v2u64 = @Vector(2, u64);
3521
36fn __udivti3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
37 return @bitCast(v128, udivmod(u128, @bitCast(u128, a), @bitCast(u128, b), null));
22fn __udivti3_windows_x86_64(a: v2u64, b: v2u64) callconv(.C) v2u64 {
23 return @bitCast(v2u64, udivmod(u128, @bitCast(u128, a), @bitCast(u128, b), null));
3824}
lib/compiler_rt/umodti3.zig+5-19
......@@ -1,27 +1,13 @@
11const std = @import("std");
22const builtin = @import("builtin");
33const udivmod = @import("udivmod.zig").udivmod;
4const arch = builtin.cpu.arch;
54const common = @import("common.zig");
65
76pub const panic = common.panic;
87
98comptime {
10 if (builtin.os.tag == .windows) {
11 switch (arch) {
12 .i386 => {
13 @export(__umodti3, .{ .name = "__umodti3", .linkage = common.linkage });
14 },
15 .x86_64 => {
16 // The "ti" functions must use Vector(2, u64) parameter types to adhere to the ABI
17 // that LLVM expects compiler-rt to have.
18 @export(__umodti3_windows_x86_64, .{ .name = "__umodti3", .linkage = common.linkage });
19 },
20 else => {},
21 }
22 if (arch.isAARCH64()) {
23 @export(__umodti3, .{ .name = "__umodti3", .linkage = common.linkage });
24 }
9 if (common.want_windows_v2u64_abi) {
10 @export(__umodti3_windows_x86_64, .{ .name = "__umodti3", .linkage = common.linkage });
2511 } else {
2612 @export(__umodti3, .{ .name = "__umodti3", .linkage = common.linkage });
2713 }
......@@ -33,10 +19,10 @@ pub fn __umodti3(a: u128, b: u128) callconv(.C) u128 {
3319 return r;
3420}
3521
36const v128 = std.meta.Vector(2, u64);
22const v2u64 = @Vector(2, u64);
3723
38fn __umodti3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
24fn __umodti3_windows_x86_64(a: v2u64, b: v2u64) callconv(.C) v2u64 {
3925 var r: u128 = undefined;
4026 _ = udivmod(u128, @bitCast(u128, a), @bitCast(u128, b), &r);
41 return @bitCast(v128, r);
27 return @bitCast(v2u64, r);
4228}