mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
680419c407
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.
27 lines
814 B
Zig
27 lines
814 B
Zig
const builtin = @import("builtin");
|
|
const arch = builtin.cpu.arch;
|
|
const common = @import("./common.zig");
|
|
const floatToInt = @import("./float_to_int.zig").floatToInt;
|
|
|
|
pub const panic = common.panic;
|
|
|
|
comptime {
|
|
const fixsfti_fn = if (builtin.os.tag == .windows and arch == .x86_64) b: {
|
|
// The "ti" functions must use Vector(2, u64) return types to adhere to the ABI
|
|
// that LLVM expects compiler-rt to have.
|
|
break :b __fixsfti_windows_x86_64;
|
|
} else __fixsfti;
|
|
|
|
@export(fixsfti_fn, .{ .name = "__fixsfti", .linkage = common.linkage });
|
|
}
|
|
|
|
pub fn __fixsfti(a: f32) callconv(.C) i128 {
|
|
return floatToInt(i128, a);
|
|
}
|
|
|
|
const v128 = @import("std").meta.Vector(2, u64);
|
|
|
|
fn __fixsfti_windows_x86_64(a: f32) callconv(.C) v128 {
|
|
return @bitCast(v128, floatToInt(i128, a));
|
|
}
|