| author | |
| committer | |
| log | 680419c407bc1216b86511d1f045d0d92066584e |
| tree | cf652496a669e3b275c6872d4d77689e42934016 |
| parent | f3333a56e8452c16ad30da99f8e4a62a16e58a03 |
Starting with LLVM 14, the Libcalls to these functions are now lowered
using a Vec(2, u64) instead of the standard ABI for i128 integers, so
our compiler-rt implementation needs to be updated to expose the same
ABI on Windows.21 files changed, 305 insertions(+), 39 deletions(-)
lib/compiler_rt/fixdfti.zig+15-1| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const floatToInt = @import("./float_to_int.zig").floatToInt; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__fixdfti, .{ .name = "__fixdfti", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | 18 | pub fn __fixdfti(a: f64) callconv(.C) i128 { |
| 11 | 19 | return floatToInt(i128, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __fixdfti_windows_x86_64(a: f64) callconv(.C) v128 { | |
| 25 | return @bitCast(v128, floatToInt(i128, a)); | |
| 26 | } |
lib/compiler_rt/fixhfti.zig+16-2| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const floatToInt = @import("./float_to_int.zig").floatToInt; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__fixhfti, .{ .name = "__fixhfti", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | fn __fixhfti(a: f16) callconv(.C) i128 { | |
| 18 | pub fn __fixhfti(a: f16) callconv(.C) i128 { | |
| 11 | 19 | return floatToInt(i128, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __fixhfti_windows_x86_64(a: f16) callconv(.C) v128 { | |
| 25 | return @bitCast(v128, floatToInt(i128, a)); | |
| 26 | } |
lib/compiler_rt/fixsfti.zig+15-1| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const floatToInt = @import("./float_to_int.zig").floatToInt; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__fixsfti, .{ .name = "__fixsfti", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | 18 | pub fn __fixsfti(a: f32) callconv(.C) i128 { |
| 11 | 19 | return floatToInt(i128, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __fixsfti_windows_x86_64(a: f32) callconv(.C) v128 { | |
| 25 | return @bitCast(v128, floatToInt(i128, a)); | |
| 26 | } |
lib/compiler_rt/fixtfti.zig+15-1| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const floatToInt = @import("./float_to_int.zig").floatToInt; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__fixtfti, .{ .name = "__fixtfti", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | 18 | pub fn __fixtfti(a: f128) callconv(.C) i128 { |
| 11 | 19 | return floatToInt(i128, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __fixtfti_windows_x86_64(a: f128) callconv(.C) v128 { | |
| 25 | return @bitCast(v128, floatToInt(i128, a)); | |
| 26 | } |
lib/compiler_rt/fixunsdfti.zig+15-1| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const floatToInt = @import("./float_to_int.zig").floatToInt; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__fixunsdfti, .{ .name = "__fixunsdfti", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | 18 | pub fn __fixunsdfti(a: f64) callconv(.C) u128 { |
| 11 | 19 | return floatToInt(u128, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __fixunsdfti_windows_x86_64(a: f64) callconv(.C) v128 { | |
| 25 | return @bitCast(v128, floatToInt(u128, a)); | |
| 26 | } |
lib/compiler_rt/fixunshfti.zig+15-1| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const floatToInt = @import("./float_to_int.zig").floatToInt; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__fixunshfti, .{ .name = "__fixunshfti", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | 18 | pub fn __fixunshfti(a: f16) callconv(.C) u128 { |
| 11 | 19 | return floatToInt(u128, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __fixunshfti_windows_x86_64(a: f16) callconv(.C) v128 { | |
| 25 | return @bitCast(v128, floatToInt(u128, a)); | |
| 26 | } |
lib/compiler_rt/fixunssfti.zig+15-1| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const floatToInt = @import("./float_to_int.zig").floatToInt; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__fixunssfti, .{ .name = "__fixunssfti", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | 18 | pub fn __fixunssfti(a: f32) callconv(.C) u128 { |
| 11 | 19 | return floatToInt(u128, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __fixunssfti_windows_x86_64(a: f32) callconv(.C) v128 { | |
| 25 | return @bitCast(v128, floatToInt(u128, a)); | |
| 26 | } |
lib/compiler_rt/fixunstfti.zig+15-1| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const floatToInt = @import("./float_to_int.zig").floatToInt; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__fixunstfti, .{ .name = "__fixunstfti", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | 18 | pub fn __fixunstfti(a: f128) callconv(.C) u128 { |
| 11 | 19 | return floatToInt(u128, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __fixunstfti_windows_x86_64(a: f128) callconv(.C) v128 { | |
| 25 | return @bitCast(v128, floatToInt(u128, a)); | |
| 26 | } |
lib/compiler_rt/fixunsxfti.zig+15-1| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const floatToInt = @import("./float_to_int.zig").floatToInt; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__fixunsxfti, .{ .name = "__fixunsxfti", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | 18 | pub fn __fixunsxfti(a: f80) callconv(.C) u128 { |
| 11 | 19 | return floatToInt(u128, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __fixunsxfti_windows_x86_64(a: f80) callconv(.C) v128 { | |
| 25 | return @bitCast(v128, floatToInt(u128, a)); | |
| 26 | } |
lib/compiler_rt/fixxfti.zig+16-2| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const floatToInt = @import("./float_to_int.zig").floatToInt; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__fixxfti, .{ .name = "__fixxfti", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | fn __fixxfti(a: f80) callconv(.C) i128 { | |
| 18 | pub fn __fixxfti(a: f80) callconv(.C) i128 { | |
| 11 | 19 | return floatToInt(i128, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __fixxfti_windows_x86_64(a: f80) callconv(.C) v128 { | |
| 25 | return @bitCast(v128, floatToInt(i128, a)); | |
| 26 | } |
lib/compiler_rt/floattidf.zig+15-1| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const intToFloat = @import("./int_to_float.zig").intToFloat; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__floattidf, .{ .name = "__floattidf", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | 18 | pub fn __floattidf(a: i128) callconv(.C) f64 { |
| 11 | 19 | return intToFloat(f64, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __floattidf_windows_x86_64(a: v128) callconv(.C) f64 { | |
| 25 | return intToFloat(f64, @bitCast(i128, a)); | |
| 26 | } |
lib/compiler_rt/floattihf.zig+16-2| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const intToFloat = @import("./int_to_float.zig").intToFloat; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__floattihf, .{ .name = "__floattihf", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | fn __floattihf(a: i128) callconv(.C) f16 { | |
| 18 | pub fn __floattihf(a: i128) callconv(.C) f16 { | |
| 11 | 19 | return intToFloat(f16, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __floattihf_windows_x86_64(a: v128) callconv(.C) f16 { | |
| 25 | return intToFloat(f16, @bitCast(i128, a)); | |
| 26 | } |
lib/compiler_rt/floattisf.zig+15-1| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const intToFloat = @import("./int_to_float.zig").intToFloat; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__floattisf, .{ .name = "__floattisf", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | 18 | pub fn __floattisf(a: i128) callconv(.C) f32 { |
| 11 | 19 | return intToFloat(f32, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __floattisf_windows_x86_64(a: v128) callconv(.C) f32 { | |
| 25 | return intToFloat(f32, @bitCast(i128, a)); | |
| 26 | } |
lib/compiler_rt/floattitf.zig+15-1| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const intToFloat = @import("./int_to_float.zig").intToFloat; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__floattitf, .{ .name = "__floattitf", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | 18 | pub fn __floattitf(a: i128) callconv(.C) f128 { |
| 11 | 19 | return intToFloat(f128, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __floattitf_windows_x86_64(a: v128) callconv(.C) f128 { | |
| 25 | return intToFloat(f128, @bitCast(i128, a)); | |
| 26 | } |
lib/compiler_rt/floattixf.zig+16-2| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const intToFloat = @import("./int_to_float.zig").intToFloat; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__floattixf, .{ .name = "__floattixf", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | fn __floattixf(a: i128) callconv(.C) f80 { | |
| 18 | pub fn __floattixf(a: i128) callconv(.C) f80 { | |
| 11 | 19 | return intToFloat(f80, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __floattixf_windows_x86_64(a: v128) callconv(.C) f80 { | |
| 25 | return intToFloat(f80, @bitCast(i128, a)); | |
| 26 | } |
lib/compiler_rt/floatuntidf.zig+15-1| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const intToFloat = @import("./int_to_float.zig").intToFloat; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__floatuntidf, .{ .name = "__floatuntidf", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | 18 | pub fn __floatuntidf(a: u128) callconv(.C) f64 { |
| 11 | 19 | return intToFloat(f64, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __floatuntidf_windows_x86_64(a: v128) callconv(.C) f64 { | |
| 25 | return intToFloat(f64, @bitCast(u128, a)); | |
| 26 | } |
lib/compiler_rt/floatuntihf.zig+16-2| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const intToFloat = @import("./int_to_float.zig").intToFloat; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__floatuntihf, .{ .name = "__floatuntihf", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | fn __floatuntihf(a: u128) callconv(.C) f16 { | |
| 18 | pub fn __floatuntihf(a: u128) callconv(.C) f16 { | |
| 11 | 19 | return intToFloat(f16, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __floatuntihf_windows_x86_64(a: v128) callconv(.C) f16 { | |
| 25 | return intToFloat(f16, @bitCast(u128, a)); | |
| 26 | } |
lib/compiler_rt/floatuntisf.zig+15-1| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const intToFloat = @import("./int_to_float.zig").intToFloat; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__floatuntisf, .{ .name = "__floatuntisf", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | 18 | pub fn __floatuntisf(a: u128) callconv(.C) f32 { |
| 11 | 19 | return intToFloat(f32, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __floatuntisf_windows_x86_64(a: v128) callconv(.C) f32 { | |
| 25 | return intToFloat(f32, @bitCast(u128, a)); | |
| 26 | } |
lib/compiler_rt/floatuntitf.zig+15-7| ... | ... | @@ -1,20 +1,28 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const intToFloat = @import("./int_to_float.zig").intToFloat; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | if (common.want_ppc_abi) { | |
| 8 | @export(__floatuntikf, .{ .name = "__floatuntikf", .linkage = common.linkage }); | |
| 9 | } else { | |
| 10 | @export(__floatuntitf, .{ .name = "__floatuntitf", .linkage = common.linkage }); | |
| 11 | } | |
| 9 | const symbol_name = if (common.want_ppc_abi) "__floatuntikf" else "__floatuntitf"; | |
| 10 | ||
| 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 }); | |
| 12 | 18 | } |
| 13 | 19 | |
| 14 | 20 | pub fn __floatuntitf(a: u128) callconv(.C) f128 { |
| 15 | 21 | return intToFloat(f128, a); |
| 16 | 22 | } |
| 17 | 23 | |
| 18 | fn __floatuntikf(a: u128) callconv(.C) f128 { | |
| 19 | return intToFloat(f128, a); | |
| 24 | const v128 = @import("std").meta.Vector(2, u64); | |
| 25 | ||
| 26 | fn __floatuntitf_windows_x86_64(a: v128) callconv(.C) f128 { | |
| 27 | return intToFloat(f128, @bitCast(u128, a)); | |
| 20 | 28 | } |
lib/compiler_rt/floatuntixf.zig+15-1| ... | ... | @@ -1,12 +1,26 @@ |
| 1 | const builtin = @import("builtin"); | |
| 2 | const arch = builtin.cpu.arch; | |
| 1 | 3 | const common = @import("./common.zig"); |
| 2 | 4 | const intToFloat = @import("./int_to_float.zig").intToFloat; |
| 3 | 5 | |
| 4 | 6 | pub const panic = common.panic; |
| 5 | 7 | |
| 6 | 8 | comptime { |
| 7 | @export(__floatuntixf, .{ .name = "__floatuntixf", .linkage = common.linkage }); | |
| 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 | 16 | } |
| 9 | 17 | |
| 10 | 18 | pub fn __floatuntixf(a: u128) callconv(.C) f80 { |
| 11 | 19 | return intToFloat(f80, a); |
| 12 | 20 | } |
| 21 | ||
| 22 | const v128 = @import("std").meta.Vector(2, u64); | |
| 23 | ||
| 24 | fn __floatuntixf_windows_x86_64(a: v128) callconv(.C) f80 { | |
| 25 | return intToFloat(f80, @bitCast(u128, a)); | |
| 26 | } |
lib/std/fmt.zig-8| ... | ... | @@ -2284,10 +2284,6 @@ test "float.hexadecimal.precision" { |
| 2284 | 2284 | } |
| 2285 | 2285 | |
| 2286 | 2286 | test "float.decimal" { |
| 2287 | if (builtin.zig_backend == .stage1 and builtin.os.tag == .windows) { | |
| 2288 | // https://github.com/ziglang/zig/issues/12063 | |
| 2289 | return error.SkipZigTest; | |
| 2290 | } | |
| 2291 | 2287 | try expectFmt("f64: 152314000000000000000000000000", "f64: {d}", .{@as(f64, 1.52314e+29)}); |
| 2292 | 2288 | try expectFmt("f32: 0", "f32: {d}", .{@as(f32, 0.0)}); |
| 2293 | 2289 | try expectFmt("f32: 0", "f32: {d:.0}", .{@as(f32, 0.0)}); |
| ... | ... | @@ -2311,10 +2307,6 @@ test "float.decimal" { |
| 2311 | 2307 | } |
| 2312 | 2308 | |
| 2313 | 2309 | test "float.libc.sanity" { |
| 2314 | if (builtin.zig_backend == .stage1 and builtin.os.tag == .windows) { | |
| 2315 | // https://github.com/ziglang/zig/issues/12063 | |
| 2316 | return error.SkipZigTest; | |
| 2317 | } | |
| 2318 | 2310 | try expectFmt("f64: 0.00001", "f64: {d:.5}", .{@as(f64, @bitCast(f32, @as(u32, 916964781)))}); |
| 2319 | 2311 | try expectFmt("f64: 0.00001", "f64: {d:.5}", .{@as(f64, @bitCast(f32, @as(u32, 925353389)))}); |
| 2320 | 2312 | try expectFmt("f64: 0.10000", "f64: {d:.5}", .{@as(f64, @bitCast(f32, @as(u32, 1036831278)))}); |