Merge pull request 'compiler_rt: common -> compiler_rt' (#31169) from compiler-rt-cleanup-2 into master

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31169
This commit is contained in:
Andrew Kelley 2026-02-10 20:28:28 +01:00
commit bf1b9318a9
192 changed files with 1604 additions and 1862 deletions

View file

@ -205,181 +205,6 @@ set(ZIG_CPP_SOURCES
set(ZIG_STAGE2_SOURCES
"${ZIG_CONFIG_ZIG_OUT}"
lib/compiler_rt.zig
lib/compiler_rt/absv.zig
lib/compiler_rt/absvdi2.zig
lib/compiler_rt/absvsi2.zig
lib/compiler_rt/absvti2.zig
lib/compiler_rt/adddf3.zig
lib/compiler_rt/addf3.zig
lib/compiler_rt/addsf3.zig
lib/compiler_rt/addtf3.zig
lib/compiler_rt/addvsi3.zig
lib/compiler_rt/addvdi3.zig
lib/compiler_rt/addxf3.zig
lib/compiler_rt/arm.zig
lib/compiler_rt/atomics.zig
lib/compiler_rt/aulldiv.zig
lib/compiler_rt/aullrem.zig
lib/compiler_rt/bswap.zig
lib/compiler_rt/clear_cache.zig
lib/compiler_rt/cmp.zig
lib/compiler_rt/cmpdf2.zig
lib/compiler_rt/cmpsf2.zig
lib/compiler_rt/cmptf2.zig
lib/compiler_rt/cmpxf2.zig
lib/compiler_rt/common.zig
lib/compiler_rt/comparef.zig
lib/compiler_rt/cos.zig
lib/compiler_rt/count0bits.zig
lib/compiler_rt/divdf3.zig
lib/compiler_rt/divsf3.zig
lib/compiler_rt/divtf3.zig
lib/compiler_rt/divti3.zig
lib/compiler_rt/divxf3.zig
lib/compiler_rt/emutls.zig
lib/compiler_rt/exp.zig
lib/compiler_rt/exp2.zig
lib/compiler_rt/extenddftf2.zig
lib/compiler_rt/extenddfxf2.zig
lib/compiler_rt/extendf.zig
lib/compiler_rt/extendhfsf2.zig
lib/compiler_rt/extendhftf2.zig
lib/compiler_rt/extendhfxf2.zig
lib/compiler_rt/extendsfdf2.zig
lib/compiler_rt/extendsftf2.zig
lib/compiler_rt/extendsfxf2.zig
lib/compiler_rt/extendxftf2.zig
lib/compiler_rt/fabs.zig
lib/compiler_rt/fixdfdi.zig
lib/compiler_rt/fixdfsi.zig
lib/compiler_rt/fixdfti.zig
lib/compiler_rt/fixhfdi.zig
lib/compiler_rt/fixhfsi.zig
lib/compiler_rt/fixhfti.zig
lib/compiler_rt/fixsfdi.zig
lib/compiler_rt/fixsfsi.zig
lib/compiler_rt/fixsfti.zig
lib/compiler_rt/fixtfdi.zig
lib/compiler_rt/fixtfsi.zig
lib/compiler_rt/fixtfti.zig
lib/compiler_rt/fixunsdfdi.zig
lib/compiler_rt/fixunsdfsi.zig
lib/compiler_rt/fixunsdfti.zig
lib/compiler_rt/fixunshfdi.zig
lib/compiler_rt/fixunshfsi.zig
lib/compiler_rt/fixunshfti.zig
lib/compiler_rt/fixunssfdi.zig
lib/compiler_rt/fixunssfsi.zig
lib/compiler_rt/fixunssfti.zig
lib/compiler_rt/fixunstfdi.zig
lib/compiler_rt/fixunstfsi.zig
lib/compiler_rt/fixunstfti.zig
lib/compiler_rt/fixunsxfdi.zig
lib/compiler_rt/fixunsxfsi.zig
lib/compiler_rt/fixunsxfti.zig
lib/compiler_rt/fixxfdi.zig
lib/compiler_rt/fixxfsi.zig
lib/compiler_rt/fixxfti.zig
lib/compiler_rt/float_from_int.zig
lib/compiler_rt/floatdidf.zig
lib/compiler_rt/floatdihf.zig
lib/compiler_rt/floatdisf.zig
lib/compiler_rt/floatditf.zig
lib/compiler_rt/floatdixf.zig
lib/compiler_rt/floatsidf.zig
lib/compiler_rt/floatsihf.zig
lib/compiler_rt/floatsisf.zig
lib/compiler_rt/floatsitf.zig
lib/compiler_rt/floatsixf.zig
lib/compiler_rt/floattidf.zig
lib/compiler_rt/floattihf.zig
lib/compiler_rt/floattisf.zig
lib/compiler_rt/floattitf.zig
lib/compiler_rt/floattixf.zig
lib/compiler_rt/floatundidf.zig
lib/compiler_rt/floatundihf.zig
lib/compiler_rt/floatundisf.zig
lib/compiler_rt/floatunditf.zig
lib/compiler_rt/floatundixf.zig
lib/compiler_rt/floatunsidf.zig
lib/compiler_rt/floatunsihf.zig
lib/compiler_rt/floatunsisf.zig
lib/compiler_rt/floatunsitf.zig
lib/compiler_rt/floatunsixf.zig
lib/compiler_rt/floatuntidf.zig
lib/compiler_rt/floatuntihf.zig
lib/compiler_rt/floatuntisf.zig
lib/compiler_rt/floatuntitf.zig
lib/compiler_rt/floatuntixf.zig
lib/compiler_rt/floor_ceil.zig
lib/compiler_rt/fma.zig
lib/compiler_rt/fmax.zig
lib/compiler_rt/fmin.zig
lib/compiler_rt/fmod.zig
lib/compiler_rt/gedf2.zig
lib/compiler_rt/gesf2.zig
lib/compiler_rt/getf2.zig
lib/compiler_rt/gexf2.zig
lib/compiler_rt/int.zig
lib/compiler_rt/int_from_float.zig
lib/compiler_rt/log.zig
lib/compiler_rt/log10.zig
lib/compiler_rt/log2.zig
lib/compiler_rt/modti3.zig
lib/compiler_rt/mulXi3.zig
lib/compiler_rt/muldf3.zig
lib/compiler_rt/mulf3.zig
lib/compiler_rt/mulo.zig
lib/compiler_rt/mulsf3.zig
lib/compiler_rt/multf3.zig
lib/compiler_rt/mulvsi3.zig
lib/compiler_rt/mulxf3.zig
lib/compiler_rt/negXi2.zig
lib/compiler_rt/negdf2.zig
lib/compiler_rt/negsf2.zig
lib/compiler_rt/negtf2.zig
lib/compiler_rt/negv.zig
lib/compiler_rt/negxf2.zig
lib/compiler_rt/os_version_check.zig
lib/compiler_rt/parity.zig
lib/compiler_rt/popcount.zig
lib/compiler_rt/rem_pio2.zig
lib/compiler_rt/rem_pio2_large.zig
lib/compiler_rt/rem_pio2f.zig
lib/compiler_rt/round.zig
lib/compiler_rt/shift.zig
lib/compiler_rt/sin.zig
lib/compiler_rt/sincos.zig
lib/compiler_rt/sqrt.zig
lib/compiler_rt/stack_probe.zig
lib/compiler_rt/subdf3.zig
lib/compiler_rt/subsf3.zig
lib/compiler_rt/subtf3.zig
lib/compiler_rt/subvdi3.zig
lib/compiler_rt/subvsi3.zig
lib/compiler_rt/subxf3.zig
lib/compiler_rt/tan.zig
lib/compiler_rt/trig.zig
lib/compiler_rt/trunc.zig
lib/compiler_rt/truncdfhf2.zig
lib/compiler_rt/truncdfsf2.zig
lib/compiler_rt/truncf.zig
lib/compiler_rt/truncsfhf2.zig
lib/compiler_rt/trunctfdf2.zig
lib/compiler_rt/trunctfhf2.zig
lib/compiler_rt/trunctfsf2.zig
lib/compiler_rt/trunctfxf2.zig
lib/compiler_rt/truncxfdf2.zig
lib/compiler_rt/truncxfhf2.zig
lib/compiler_rt/truncxfsf2.zig
lib/compiler_rt/udivmod.zig
lib/compiler_rt/udivmodei4.zig
lib/compiler_rt/udivmodti4.zig
lib/compiler_rt/udivti3.zig
lib/compiler_rt/umodti3.zig
lib/compiler_rt/unorddf2.zig
lib/compiler_rt/unordsf2.zig
lib/compiler_rt/unordtf2.zig
lib/std/BitStack.zig
lib/std/Build.zig
lib/std/Build/Cache.zig

View file

@ -1,5 +1,6 @@
const builtin = @import("builtin");
const ofmt_c = builtin.object_format == .c;
const native_endian = builtin.cpu.arch.endian();
const std = @import("std");
@ -57,13 +58,12 @@ comptime {
_ = @import("compiler_rt/cmp.zig");
_ = @import("compiler_rt/shift.zig");
_ = @import("compiler_rt/negXi2.zig");
symbol(&__negsi2, "__negsi2");
symbol(&__negdi2, "__negdi2");
symbol(&__negti2, "__negti2");
_ = @import("compiler_rt/int.zig");
_ = @import("compiler_rt/mulXi3.zig");
_ = @import("compiler_rt/divti3.zig");
_ = @import("compiler_rt/udivti3.zig");
_ = @import("compiler_rt/modti3.zig");
_ = @import("compiler_rt/umodti3.zig");
_ = @import("compiler_rt/udivmod.zig");
_ = @import("compiler_rt/absv.zig");
_ = @import("compiler_rt/absvsi2.zig");
@ -108,9 +108,6 @@ comptime {
_ = @import("compiler_rt/trunctfxf2.zig");
_ = @import("compiler_rt/int_from_float.zig");
_ = @import("compiler_rt/fixhfsi.zig");
_ = @import("compiler_rt/fixhfdi.zig");
_ = @import("compiler_rt/fixhfti.zig");
_ = @import("compiler_rt/fixhfei.zig");
_ = @import("compiler_rt/fixsfsi.zig");
_ = @import("compiler_rt/fixsfdi.zig");
@ -126,8 +123,8 @@ comptime {
_ = @import("compiler_rt/fixtfei.zig");
_ = @import("compiler_rt/fixxfsi.zig");
_ = @import("compiler_rt/fixxfdi.zig");
_ = @import("compiler_rt/fixxfti.zig");
_ = @import("compiler_rt/fixxfei.zig");
_ = @import("compiler_rt/fixunshfsi.zig");
_ = @import("compiler_rt/fixunshfdi.zig");
_ = @import("compiler_rt/fixunshfti.zig");
@ -193,16 +190,10 @@ comptime {
// comparison
_ = @import("compiler_rt/comparef.zig");
_ = @import("compiler_rt/cmphf2.zig");
_ = @import("compiler_rt/cmpsf2.zig");
_ = @import("compiler_rt/cmpdf2.zig");
_ = @import("compiler_rt/cmptf2.zig");
_ = @import("compiler_rt/cmpxf2.zig");
_ = @import("compiler_rt/unordhf2.zig");
_ = @import("compiler_rt/unordsf2.zig");
_ = @import("compiler_rt/unorddf2.zig");
_ = @import("compiler_rt/unordxf2.zig");
_ = @import("compiler_rt/unordtf2.zig");
_ = @import("compiler_rt/gehf2.zig");
_ = @import("compiler_rt/gesf2.zig");
_ = @import("compiler_rt/gedf2.zig");
@ -236,11 +227,17 @@ comptime {
_ = @import("compiler_rt/divxf3.zig");
_ = @import("compiler_rt/divtf3.zig");
_ = @import("compiler_rt/neghf2.zig");
_ = @import("compiler_rt/negsf2.zig");
_ = @import("compiler_rt/negdf2.zig");
_ = @import("compiler_rt/negtf2.zig");
_ = @import("compiler_rt/negxf2.zig");
symbol(&__neghf2, "__neghf2");
if (want_aeabi) {
symbol(&__aeabi_fneg, "__aeabi_fneg");
symbol(&__aeabi_dneg, "__aeabi_dneg");
} else {
symbol(&__negsf2, "__negsf2");
symbol(&__negdf2, "__negdf2");
}
if (want_ppc_abi) symbol(&__negtf2, "__negkf2");
symbol(&__negtf2, "__negtf2");
symbol(&__negxf2, "__negxf2");
// other
_ = @import("compiler_rt/powiXf2.zig");
@ -281,7 +278,6 @@ comptime {
// BigInt. Alphabetically sorted.
_ = @import("compiler_rt/divmodei4.zig");
_ = @import("compiler_rt/udivmodei4.zig");
_ = @import("compiler_rt/udivmodti4.zig");
// extra
_ = @import("compiler_rt/os_version_check.zig");
@ -302,10 +298,13 @@ comptime {
}
_ = @import("compiler_rt/memcpy.zig");
_ = @import("compiler_rt/memset.zig");
if (!ofmt_c) {
symbol(&memset, "memset");
symbol(&__memset, "__memset");
}
_ = @import("compiler_rt/memmove.zig");
symbol(&memcmp, "memcmp");
_ = @import("compiler_rt/bcmp.zig");
symbol(&bcmp, "bcmp");
_ = @import("compiler_rt/ssp.zig");
symbol(&strlen, "strlen");
}
@ -345,3 +344,383 @@ test "memcmp" {
try std.testing.expect(memcmp(arr0, arr4, 3) < 0);
try std.testing.expect(memcmp(arr4, arr0, 3) > 0);
}
pub const PreferredLoadStoreElement = element: {
if (std.simd.suggestVectorLength(u8)) |vec_size| {
const Vec = @Vector(vec_size, u8);
if (@sizeOf(Vec) == vec_size and std.math.isPowerOfTwo(vec_size)) {
break :element Vec;
}
}
break :element usize;
};
pub const want_aeabi = switch (builtin.abi) {
.eabi,
.eabihf,
.musleabi,
.musleabihf,
.gnueabi,
.gnueabihf,
.android,
.androideabi,
=> switch (builtin.cpu.arch) {
.arm, .armeb, .thumb, .thumbeb => true,
else => false,
},
else => false,
};
/// These functions are required on Windows on ARM. They are provided by MSVC libc, but in libc-less
/// builds or when linking MinGW libc they are our responsibility.
/// Temporarily used for thumb-uefi until https://github.com/ziglang/zig/issues/21630 is addressed.
pub const want_windows_arm_abi = e: {
if (!builtin.cpu.arch.isArm()) break :e false;
switch (builtin.os.tag) {
.windows, .uefi => {},
else => break :e false,
}
// The ABI is needed, but it's only our reponsibility if libc won't provide it.
break :e builtin.abi.isGnu() or !builtin.link_libc;
};
/// These functions are required by on Windows on x86 on some ABIs. They are provided by MSVC libc,
/// but in libc-less builds they are our responsibility.
pub const want_windows_x86_msvc_abi = e: {
if (builtin.cpu.arch != .x86) break :e false;
if (builtin.os.tag != .windows) break :e false;
switch (builtin.abi) {
.none, .msvc, .itanium => {},
else => break :e false,
}
// The ABI is needed, but it's only our responsibility if libc won't provide it.
break :e !builtin.link_libc;
};
pub const want_ppc_abi = builtin.cpu.arch.isPowerPC();
pub const want_float_exceptions = !builtin.cpu.arch.isWasm();
// Libcalls that involve u128 on Windows x86-64 are expected by LLVM to use the
// calling convention of @Vector(2, u64), rather than what's standard.
pub const want_windows_v2u64_abi = builtin.os.tag == .windows and builtin.cpu.arch == .x86_64 and !ofmt_c;
/// This governs whether to use these symbol names for f16/f32 conversions
/// rather than the standard names:
/// * __gnu_f2h_ieee
/// * __gnu_h2f_ieee
/// Known correct configurations:
/// x86_64-freestanding-none => true
/// x86_64-linux-none => true
/// x86_64-linux-gnu => true
/// x86_64-linux-musl => true
/// x86_64-linux-eabi => true
/// arm-linux-musleabihf => true
/// arm-linux-gnueabihf => true
/// arm-linux-eabihf => false
/// wasm32-wasi-musl => false
/// wasm32-freestanding-none => false
/// x86_64-windows-gnu => true
/// x86_64-windows-msvc => true
/// any-macos-any => false
pub const gnu_f16_abi = switch (builtin.cpu.arch) {
.wasm32,
.wasm64,
.riscv64,
.riscv64be,
.riscv32,
.riscv32be,
=> false,
.x86, .x86_64 => true,
.arm, .armeb, .thumb, .thumbeb => switch (builtin.abi) {
.eabi, .eabihf => false,
else => true,
},
else => !builtin.os.tag.isDarwin(),
};
pub const want_sparc_abi = builtin.cpu.arch.isSPARC();
/// This seems to mostly correspond to `clang::TargetInfo::HasFloat16`.
pub fn F16T(comptime OtherType: type) type {
return switch (builtin.cpu.arch) {
.amdgcn,
.arm,
.armeb,
.thumb,
.thumbeb,
.aarch64,
.aarch64_be,
.hexagon,
.loongarch32,
.loongarch64,
.nvptx,
.nvptx64,
.riscv32,
.riscv32be,
.riscv64,
.riscv64be,
.s390x,
.spirv32,
.spirv64,
=> f16,
.x86, .x86_64 => if (builtin.target.os.tag.isDarwin()) switch (OtherType) {
// Starting with LLVM 16, Darwin uses different abi for f16
// depending on the type of the other return/argument..???
f32, f64 => u16,
f80, f128 => f16,
else => unreachable,
} else f16,
else => u16,
};
}
pub fn wideMultiply(comptime Z: type, a: Z, b: Z, hi: *Z, lo: *Z) void {
switch (Z) {
u16 => {
// 16x16 --> 32 bit multiply
const product = @as(u32, a) * @as(u32, b);
hi.* = @intCast(product >> 16);
lo.* = @truncate(product);
},
u32 => {
// 32x32 --> 64 bit multiply
const product = @as(u64, a) * @as(u64, b);
hi.* = @truncate(product >> 32);
lo.* = @truncate(product);
},
u64 => {
const S = struct {
fn loWord(x: u64) u64 {
return @as(u32, @truncate(x));
}
fn hiWord(x: u64) u64 {
return @as(u32, @truncate(x >> 32));
}
};
// 64x64 -> 128 wide multiply for platforms that don't have such an operation;
// many 64-bit platforms have this operation, but they tend to have hardware
// floating-point, so we don't bother with a special case for them here.
// Each of the component 32x32 -> 64 products
const plolo: u64 = S.loWord(a) * S.loWord(b);
const plohi: u64 = S.loWord(a) * S.hiWord(b);
const philo: u64 = S.hiWord(a) * S.loWord(b);
const phihi: u64 = S.hiWord(a) * S.hiWord(b);
// Sum terms that contribute to lo in a way that allows us to get the carry
const r0: u64 = S.loWord(plolo);
const r1: u64 = S.hiWord(plolo) +% S.loWord(plohi) +% S.loWord(philo);
lo.* = r0 +% (r1 << 32);
// Sum terms contributing to hi with the carry from lo
hi.* = S.hiWord(plohi) +% S.hiWord(philo) +% S.hiWord(r1) +% phihi;
},
u128 => {
const Word_LoMask: u64 = 0x00000000ffffffff;
const Word_HiMask: u64 = 0xffffffff00000000;
const Word_FullMask: u64 = 0xffffffffffffffff;
const S = struct {
fn Word_1(x: u128) u64 {
return @as(u32, @truncate(x >> 96));
}
fn Word_2(x: u128) u64 {
return @as(u32, @truncate(x >> 64));
}
fn Word_3(x: u128) u64 {
return @as(u32, @truncate(x >> 32));
}
fn Word_4(x: u128) u64 {
return @as(u32, @truncate(x));
}
};
// 128x128 -> 256 wide multiply for platforms that don't have such an operation;
// many 64-bit platforms have this operation, but they tend to have hardware
// floating-point, so we don't bother with a special case for them here.
const product11: u64 = S.Word_1(a) * S.Word_1(b);
const product12: u64 = S.Word_1(a) * S.Word_2(b);
const product13: u64 = S.Word_1(a) * S.Word_3(b);
const product14: u64 = S.Word_1(a) * S.Word_4(b);
const product21: u64 = S.Word_2(a) * S.Word_1(b);
const product22: u64 = S.Word_2(a) * S.Word_2(b);
const product23: u64 = S.Word_2(a) * S.Word_3(b);
const product24: u64 = S.Word_2(a) * S.Word_4(b);
const product31: u64 = S.Word_3(a) * S.Word_1(b);
const product32: u64 = S.Word_3(a) * S.Word_2(b);
const product33: u64 = S.Word_3(a) * S.Word_3(b);
const product34: u64 = S.Word_3(a) * S.Word_4(b);
const product41: u64 = S.Word_4(a) * S.Word_1(b);
const product42: u64 = S.Word_4(a) * S.Word_2(b);
const product43: u64 = S.Word_4(a) * S.Word_3(b);
const product44: u64 = S.Word_4(a) * S.Word_4(b);
const sum0: u128 = @as(u128, product44);
const sum1: u128 = @as(u128, product34) +%
@as(u128, product43);
const sum2: u128 = @as(u128, product24) +%
@as(u128, product33) +%
@as(u128, product42);
const sum3: u128 = @as(u128, product14) +%
@as(u128, product23) +%
@as(u128, product32) +%
@as(u128, product41);
const sum4: u128 = @as(u128, product13) +%
@as(u128, product22) +%
@as(u128, product31);
const sum5: u128 = @as(u128, product12) +%
@as(u128, product21);
const sum6: u128 = @as(u128, product11);
const r0: u128 = (sum0 & Word_FullMask) +%
((sum1 & Word_LoMask) << 32);
const r1: u128 = (sum0 >> 64) +%
((sum1 >> 32) & Word_FullMask) +%
(sum2 & Word_FullMask) +%
((sum3 << 32) & Word_HiMask);
lo.* = r0 +% (r1 << 64);
hi.* = (r1 >> 64) +%
(sum1 >> 96) +%
(sum2 >> 64) +%
(sum3 >> 32) +%
sum4 +%
(sum5 << 32) +%
(sum6 << 64);
},
else => @compileError("unsupported"),
}
}
pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeInfo(T).float.bits)) i32 {
const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
const integerBit = @as(Z, 1) << std.math.floatFractionalBits(T);
const shift = @clz(significand.*) - @clz(integerBit);
significand.* <<= @as(std.math.Log2Int(Z), @intCast(shift));
return @as(i32, 1) - shift;
}
pub inline fn fneg(a: anytype) @TypeOf(a) {
const F = @TypeOf(a);
const bits = @typeInfo(F).float.bits;
const U = @Int(.unsigned, bits);
const sign_bit_mask = @as(U, 1) << (bits - 1);
const negated = @as(U, @bitCast(a)) ^ sign_bit_mask;
return @bitCast(negated);
}
fn __negxf2(a: f80) callconv(.c) f80 {
return fneg(a);
}
fn __neghf2(a: f16) callconv(.c) f16 {
return fneg(a);
}
fn __negdf2(a: f64) callconv(.c) f64 {
return fneg(a);
}
fn __aeabi_dneg(a: f64) callconv(.{ .arm_aapcs = .{} }) f64 {
return fneg(a);
}
fn __negtf2(a: f128) callconv(.c) f128 {
return fneg(a);
}
fn __negsf2(a: f32) callconv(.c) f32 {
return fneg(a);
}
fn __aeabi_fneg(a: f32) callconv(.{ .arm_aapcs = .{} }) f32 {
return fneg(a);
}
/// Allows to access underlying bits as two equally sized lower and higher
/// signed or unsigned integers.
pub fn HalveInt(comptime T: type, comptime signed_half: bool) type {
return extern union {
pub const bits = @divExact(@typeInfo(T).int.bits, 2);
pub const HalfTU = std.meta.Int(.unsigned, bits);
pub const HalfTS = std.meta.Int(.signed, bits);
pub const HalfT = if (signed_half) HalfTS else HalfTU;
all: T,
s: if (native_endian == .little)
extern struct { low: HalfT, high: HalfT }
else
extern struct { high: HalfT, low: HalfT },
};
}
pub fn __negsi2(a: i32) callconv(.c) i32 {
return negXi2(i32, a);
}
pub fn __negdi2(a: i64) callconv(.c) i64 {
return negXi2(i64, a);
}
pub fn __negti2(a: i128) callconv(.c) i128 {
return negXi2(i128, a);
}
inline fn negXi2(comptime T: type, a: T) T {
return -a;
}
pub fn memset(dest: ?[*]u8, c: u8, len: usize) callconv(.c) ?[*]u8 {
@setRuntimeSafety(false);
if (len != 0) {
var d = dest.?;
var n = len;
while (true) {
d[0] = c;
n -= 1;
if (n == 0) break;
d += 1;
}
}
return dest;
}
pub fn __memset(dest: ?[*]u8, c: u8, n: usize, dest_n: usize) callconv(.c) ?[*]u8 {
if (dest_n < n)
@panic("buffer overflow");
return memset(dest, c, n);
}
pub fn bcmp(vl: [*]allowzero const u8, vr: [*]allowzero const u8, n: usize) callconv(.c) c_int {
@setRuntimeSafety(false);
var index: usize = 0;
while (index != n) : (index += 1) {
if (vl[index] != vr[index]) {
return 1;
}
}
return 0;
}
test "bcmp" {
const base_arr = &[_]u8{ 1, 1, 1 };
const arr1 = &[_]u8{ 1, 1, 1 };
const arr2 = &[_]u8{ 1, 0, 1 };
const arr3 = &[_]u8{ 1, 2, 1 };
try std.testing.expect(bcmp(base_arr[0..], arr1[0..], base_arr.len) == 0);
try std.testing.expect(bcmp(base_arr[0..], arr2[0..], base_arr.len) != 0);
try std.testing.expect(bcmp(base_arr[0..], arr3[0..], base_arr.len) != 0);
}
test {
_ = @import("compiler_rt/negsi2_test.zig");
_ = @import("compiler_rt/negdi2_test.zig");
_ = @import("compiler_rt/negti2_test.zig");
}

View file

@ -1,7 +1,8 @@
//! This file is generated by tools/gen_outline_atomics.zig.
const builtin = @import("builtin");
const std = @import("std");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const always_has_lse = builtin.cpu.has(.aarch64, .lse);
/// This default is overridden at runtime after inspecting CPU properties.
@ -2024,104 +2025,104 @@ fn __aarch64_cas16_acq_rel() align(16) callconv(.naked) void {
}
comptime {
@export(&__aarch64_cas1_relax, .{ .name = "__aarch64_cas1_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_swp1_relax, .{ .name = "__aarch64_swp1_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldadd1_relax, .{ .name = "__aarch64_ldadd1_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldclr1_relax, .{ .name = "__aarch64_ldclr1_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldeor1_relax, .{ .name = "__aarch64_ldeor1_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldset1_relax, .{ .name = "__aarch64_ldset1_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas1_acq, .{ .name = "__aarch64_cas1_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_swp1_acq, .{ .name = "__aarch64_swp1_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldadd1_acq, .{ .name = "__aarch64_ldadd1_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldclr1_acq, .{ .name = "__aarch64_ldclr1_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldeor1_acq, .{ .name = "__aarch64_ldeor1_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldset1_acq, .{ .name = "__aarch64_ldset1_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas1_rel, .{ .name = "__aarch64_cas1_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_swp1_rel, .{ .name = "__aarch64_swp1_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldadd1_rel, .{ .name = "__aarch64_ldadd1_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldclr1_rel, .{ .name = "__aarch64_ldclr1_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldeor1_rel, .{ .name = "__aarch64_ldeor1_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldset1_rel, .{ .name = "__aarch64_ldset1_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas1_acq_rel, .{ .name = "__aarch64_cas1_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_swp1_acq_rel, .{ .name = "__aarch64_swp1_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldadd1_acq_rel, .{ .name = "__aarch64_ldadd1_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldclr1_acq_rel, .{ .name = "__aarch64_ldclr1_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldeor1_acq_rel, .{ .name = "__aarch64_ldeor1_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldset1_acq_rel, .{ .name = "__aarch64_ldset1_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas2_relax, .{ .name = "__aarch64_cas2_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_swp2_relax, .{ .name = "__aarch64_swp2_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldadd2_relax, .{ .name = "__aarch64_ldadd2_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldclr2_relax, .{ .name = "__aarch64_ldclr2_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldeor2_relax, .{ .name = "__aarch64_ldeor2_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldset2_relax, .{ .name = "__aarch64_ldset2_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas2_acq, .{ .name = "__aarch64_cas2_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_swp2_acq, .{ .name = "__aarch64_swp2_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldadd2_acq, .{ .name = "__aarch64_ldadd2_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldclr2_acq, .{ .name = "__aarch64_ldclr2_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldeor2_acq, .{ .name = "__aarch64_ldeor2_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldset2_acq, .{ .name = "__aarch64_ldset2_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas2_rel, .{ .name = "__aarch64_cas2_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_swp2_rel, .{ .name = "__aarch64_swp2_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldadd2_rel, .{ .name = "__aarch64_ldadd2_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldclr2_rel, .{ .name = "__aarch64_ldclr2_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldeor2_rel, .{ .name = "__aarch64_ldeor2_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldset2_rel, .{ .name = "__aarch64_ldset2_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas2_acq_rel, .{ .name = "__aarch64_cas2_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_swp2_acq_rel, .{ .name = "__aarch64_swp2_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldadd2_acq_rel, .{ .name = "__aarch64_ldadd2_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldclr2_acq_rel, .{ .name = "__aarch64_ldclr2_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldeor2_acq_rel, .{ .name = "__aarch64_ldeor2_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldset2_acq_rel, .{ .name = "__aarch64_ldset2_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas4_relax, .{ .name = "__aarch64_cas4_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_swp4_relax, .{ .name = "__aarch64_swp4_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldadd4_relax, .{ .name = "__aarch64_ldadd4_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldclr4_relax, .{ .name = "__aarch64_ldclr4_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldeor4_relax, .{ .name = "__aarch64_ldeor4_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldset4_relax, .{ .name = "__aarch64_ldset4_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas4_acq, .{ .name = "__aarch64_cas4_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_swp4_acq, .{ .name = "__aarch64_swp4_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldadd4_acq, .{ .name = "__aarch64_ldadd4_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldclr4_acq, .{ .name = "__aarch64_ldclr4_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldeor4_acq, .{ .name = "__aarch64_ldeor4_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldset4_acq, .{ .name = "__aarch64_ldset4_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas4_rel, .{ .name = "__aarch64_cas4_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_swp4_rel, .{ .name = "__aarch64_swp4_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldadd4_rel, .{ .name = "__aarch64_ldadd4_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldclr4_rel, .{ .name = "__aarch64_ldclr4_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldeor4_rel, .{ .name = "__aarch64_ldeor4_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldset4_rel, .{ .name = "__aarch64_ldset4_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas4_acq_rel, .{ .name = "__aarch64_cas4_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_swp4_acq_rel, .{ .name = "__aarch64_swp4_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldadd4_acq_rel, .{ .name = "__aarch64_ldadd4_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldclr4_acq_rel, .{ .name = "__aarch64_ldclr4_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldeor4_acq_rel, .{ .name = "__aarch64_ldeor4_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldset4_acq_rel, .{ .name = "__aarch64_ldset4_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas8_relax, .{ .name = "__aarch64_cas8_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_swp8_relax, .{ .name = "__aarch64_swp8_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldadd8_relax, .{ .name = "__aarch64_ldadd8_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldclr8_relax, .{ .name = "__aarch64_ldclr8_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldeor8_relax, .{ .name = "__aarch64_ldeor8_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldset8_relax, .{ .name = "__aarch64_ldset8_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas8_acq, .{ .name = "__aarch64_cas8_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_swp8_acq, .{ .name = "__aarch64_swp8_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldadd8_acq, .{ .name = "__aarch64_ldadd8_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldclr8_acq, .{ .name = "__aarch64_ldclr8_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldeor8_acq, .{ .name = "__aarch64_ldeor8_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldset8_acq, .{ .name = "__aarch64_ldset8_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas8_rel, .{ .name = "__aarch64_cas8_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_swp8_rel, .{ .name = "__aarch64_swp8_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldadd8_rel, .{ .name = "__aarch64_ldadd8_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldclr8_rel, .{ .name = "__aarch64_ldclr8_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldeor8_rel, .{ .name = "__aarch64_ldeor8_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldset8_rel, .{ .name = "__aarch64_ldset8_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas8_acq_rel, .{ .name = "__aarch64_cas8_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_swp8_acq_rel, .{ .name = "__aarch64_swp8_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldadd8_acq_rel, .{ .name = "__aarch64_ldadd8_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldclr8_acq_rel, .{ .name = "__aarch64_ldclr8_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldeor8_acq_rel, .{ .name = "__aarch64_ldeor8_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_ldset8_acq_rel, .{ .name = "__aarch64_ldset8_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas16_relax, .{ .name = "__aarch64_cas16_relax", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas16_acq, .{ .name = "__aarch64_cas16_acq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas16_rel, .{ .name = "__aarch64_cas16_rel", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aarch64_cas16_acq_rel, .{ .name = "__aarch64_cas16_acq_rel", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__aarch64_cas1_relax, "__aarch64_cas1_relax");
symbol(&__aarch64_swp1_relax, "__aarch64_swp1_relax");
symbol(&__aarch64_ldadd1_relax, "__aarch64_ldadd1_relax");
symbol(&__aarch64_ldclr1_relax, "__aarch64_ldclr1_relax");
symbol(&__aarch64_ldeor1_relax, "__aarch64_ldeor1_relax");
symbol(&__aarch64_ldset1_relax, "__aarch64_ldset1_relax");
symbol(&__aarch64_cas1_acq, "__aarch64_cas1_acq");
symbol(&__aarch64_swp1_acq, "__aarch64_swp1_acq");
symbol(&__aarch64_ldadd1_acq, "__aarch64_ldadd1_acq");
symbol(&__aarch64_ldclr1_acq, "__aarch64_ldclr1_acq");
symbol(&__aarch64_ldeor1_acq, "__aarch64_ldeor1_acq");
symbol(&__aarch64_ldset1_acq, "__aarch64_ldset1_acq");
symbol(&__aarch64_cas1_rel, "__aarch64_cas1_rel");
symbol(&__aarch64_swp1_rel, "__aarch64_swp1_rel");
symbol(&__aarch64_ldadd1_rel, "__aarch64_ldadd1_rel");
symbol(&__aarch64_ldclr1_rel, "__aarch64_ldclr1_rel");
symbol(&__aarch64_ldeor1_rel, "__aarch64_ldeor1_rel");
symbol(&__aarch64_ldset1_rel, "__aarch64_ldset1_rel");
symbol(&__aarch64_cas1_acq_rel, "__aarch64_cas1_acq_rel");
symbol(&__aarch64_swp1_acq_rel, "__aarch64_swp1_acq_rel");
symbol(&__aarch64_ldadd1_acq_rel, "__aarch64_ldadd1_acq_rel");
symbol(&__aarch64_ldclr1_acq_rel, "__aarch64_ldclr1_acq_rel");
symbol(&__aarch64_ldeor1_acq_rel, "__aarch64_ldeor1_acq_rel");
symbol(&__aarch64_ldset1_acq_rel, "__aarch64_ldset1_acq_rel");
symbol(&__aarch64_cas2_relax, "__aarch64_cas2_relax");
symbol(&__aarch64_swp2_relax, "__aarch64_swp2_relax");
symbol(&__aarch64_ldadd2_relax, "__aarch64_ldadd2_relax");
symbol(&__aarch64_ldclr2_relax, "__aarch64_ldclr2_relax");
symbol(&__aarch64_ldeor2_relax, "__aarch64_ldeor2_relax");
symbol(&__aarch64_ldset2_relax, "__aarch64_ldset2_relax");
symbol(&__aarch64_cas2_acq, "__aarch64_cas2_acq");
symbol(&__aarch64_swp2_acq, "__aarch64_swp2_acq");
symbol(&__aarch64_ldadd2_acq, "__aarch64_ldadd2_acq");
symbol(&__aarch64_ldclr2_acq, "__aarch64_ldclr2_acq");
symbol(&__aarch64_ldeor2_acq, "__aarch64_ldeor2_acq");
symbol(&__aarch64_ldset2_acq, "__aarch64_ldset2_acq");
symbol(&__aarch64_cas2_rel, "__aarch64_cas2_rel");
symbol(&__aarch64_swp2_rel, "__aarch64_swp2_rel");
symbol(&__aarch64_ldadd2_rel, "__aarch64_ldadd2_rel");
symbol(&__aarch64_ldclr2_rel, "__aarch64_ldclr2_rel");
symbol(&__aarch64_ldeor2_rel, "__aarch64_ldeor2_rel");
symbol(&__aarch64_ldset2_rel, "__aarch64_ldset2_rel");
symbol(&__aarch64_cas2_acq_rel, "__aarch64_cas2_acq_rel");
symbol(&__aarch64_swp2_acq_rel, "__aarch64_swp2_acq_rel");
symbol(&__aarch64_ldadd2_acq_rel, "__aarch64_ldadd2_acq_rel");
symbol(&__aarch64_ldclr2_acq_rel, "__aarch64_ldclr2_acq_rel");
symbol(&__aarch64_ldeor2_acq_rel, "__aarch64_ldeor2_acq_rel");
symbol(&__aarch64_ldset2_acq_rel, "__aarch64_ldset2_acq_rel");
symbol(&__aarch64_cas4_relax, "__aarch64_cas4_relax");
symbol(&__aarch64_swp4_relax, "__aarch64_swp4_relax");
symbol(&__aarch64_ldadd4_relax, "__aarch64_ldadd4_relax");
symbol(&__aarch64_ldclr4_relax, "__aarch64_ldclr4_relax");
symbol(&__aarch64_ldeor4_relax, "__aarch64_ldeor4_relax");
symbol(&__aarch64_ldset4_relax, "__aarch64_ldset4_relax");
symbol(&__aarch64_cas4_acq, "__aarch64_cas4_acq");
symbol(&__aarch64_swp4_acq, "__aarch64_swp4_acq");
symbol(&__aarch64_ldadd4_acq, "__aarch64_ldadd4_acq");
symbol(&__aarch64_ldclr4_acq, "__aarch64_ldclr4_acq");
symbol(&__aarch64_ldeor4_acq, "__aarch64_ldeor4_acq");
symbol(&__aarch64_ldset4_acq, "__aarch64_ldset4_acq");
symbol(&__aarch64_cas4_rel, "__aarch64_cas4_rel");
symbol(&__aarch64_swp4_rel, "__aarch64_swp4_rel");
symbol(&__aarch64_ldadd4_rel, "__aarch64_ldadd4_rel");
symbol(&__aarch64_ldclr4_rel, "__aarch64_ldclr4_rel");
symbol(&__aarch64_ldeor4_rel, "__aarch64_ldeor4_rel");
symbol(&__aarch64_ldset4_rel, "__aarch64_ldset4_rel");
symbol(&__aarch64_cas4_acq_rel, "__aarch64_cas4_acq_rel");
symbol(&__aarch64_swp4_acq_rel, "__aarch64_swp4_acq_rel");
symbol(&__aarch64_ldadd4_acq_rel, "__aarch64_ldadd4_acq_rel");
symbol(&__aarch64_ldclr4_acq_rel, "__aarch64_ldclr4_acq_rel");
symbol(&__aarch64_ldeor4_acq_rel, "__aarch64_ldeor4_acq_rel");
symbol(&__aarch64_ldset4_acq_rel, "__aarch64_ldset4_acq_rel");
symbol(&__aarch64_cas8_relax, "__aarch64_cas8_relax");
symbol(&__aarch64_swp8_relax, "__aarch64_swp8_relax");
symbol(&__aarch64_ldadd8_relax, "__aarch64_ldadd8_relax");
symbol(&__aarch64_ldclr8_relax, "__aarch64_ldclr8_relax");
symbol(&__aarch64_ldeor8_relax, "__aarch64_ldeor8_relax");
symbol(&__aarch64_ldset8_relax, "__aarch64_ldset8_relax");
symbol(&__aarch64_cas8_acq, "__aarch64_cas8_acq");
symbol(&__aarch64_swp8_acq, "__aarch64_swp8_acq");
symbol(&__aarch64_ldadd8_acq, "__aarch64_ldadd8_acq");
symbol(&__aarch64_ldclr8_acq, "__aarch64_ldclr8_acq");
symbol(&__aarch64_ldeor8_acq, "__aarch64_ldeor8_acq");
symbol(&__aarch64_ldset8_acq, "__aarch64_ldset8_acq");
symbol(&__aarch64_cas8_rel, "__aarch64_cas8_rel");
symbol(&__aarch64_swp8_rel, "__aarch64_swp8_rel");
symbol(&__aarch64_ldadd8_rel, "__aarch64_ldadd8_rel");
symbol(&__aarch64_ldclr8_rel, "__aarch64_ldclr8_rel");
symbol(&__aarch64_ldeor8_rel, "__aarch64_ldeor8_rel");
symbol(&__aarch64_ldset8_rel, "__aarch64_ldset8_rel");
symbol(&__aarch64_cas8_acq_rel, "__aarch64_cas8_acq_rel");
symbol(&__aarch64_swp8_acq_rel, "__aarch64_swp8_acq_rel");
symbol(&__aarch64_ldadd8_acq_rel, "__aarch64_ldadd8_acq_rel");
symbol(&__aarch64_ldclr8_acq_rel, "__aarch64_ldclr8_acq_rel");
symbol(&__aarch64_ldeor8_acq_rel, "__aarch64_ldeor8_acq_rel");
symbol(&__aarch64_ldset8_acq_rel, "__aarch64_ldset8_acq_rel");
symbol(&__aarch64_cas16_relax, "__aarch64_cas16_relax");
symbol(&__aarch64_cas16_acq, "__aarch64_cas16_acq");
symbol(&__aarch64_cas16_rel, "__aarch64_cas16_rel");
symbol(&__aarch64_cas16_acq_rel, "__aarch64_cas16_acq_rel");
}

View file

@ -1,8 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const absv = @import("./absv.zig").absv;
comptime {
@export(&__absvsi2, .{ .name = "__absvsi2", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__absvsi2, "__absvsi2");
}
pub fn __absvsi2(a: i32) callconv(.c) i32 {

View file

@ -1,9 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const addf3 = @import("./addf3.zig").addf3;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_aeabi) {
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_dadd, "__aeabi_dadd");
} else {
symbol(&__adddf3, "__adddf3");

View file

@ -1,7 +1,7 @@
const std = @import("std");
const math = std.math;
const common = @import("./common.zig");
const normalize = common.normalize;
const compiler_rt = @import("../compiler_rt.zig");
const normalize = compiler_rt.normalize;
/// Ported from:
///

View file

@ -1,8 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const addf3 = @import("./addf3.zig").addf3;
comptime {
@export(&__addhf3, .{ .name = "__addhf3", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__addhf3, "__addhf3");
}
fn __addhf3(a: f16, b: f16) callconv(.c) f16 {

View file

@ -1,9 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const addf3 = @import("./addf3.zig").addf3;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_aeabi) {
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_fadd, "__aeabi_fadd");
} else {
symbol(&__addsf3, "__addsf3");

View file

@ -1,13 +1,14 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const addf3 = @import("./addf3.zig").addf3;
comptime {
if (common.want_ppc_abi) {
@export(&__addtf3, .{ .name = "__addkf3", .linkage = common.linkage, .visibility = common.visibility });
} else if (common.want_sparc_abi) {
@export(&_Qp_add, .{ .name = "_Qp_add", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_ppc_abi) {
symbol(&__addtf3, "__addkf3");
} else if (compiler_rt.want_sparc_abi) {
symbol(&_Qp_add, "_Qp_add");
}
@export(&__addtf3, .{ .name = "__addtf3", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__addtf3, "__addtf3");
}
pub fn __addtf3(a: f128, b: f128) callconv(.c) f128 {

View file

@ -1,8 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const testing = @import("std").testing;
comptime {
@export(&__addvsi3, .{ .name = "__addvsi3", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__addvsi3, "__addvsi3");
}
pub fn __addvsi3(a: i32, b: i32) callconv(.c) i32 {

View file

@ -1,8 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const addf3 = @import("./addf3.zig").addf3;
comptime {
@export(&__addxf3, .{ .name = "__addxf3", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__addxf3, "__addxf3");
}
pub fn __addxf3(a: f80, b: f80) callconv(.c) f80 {

View file

@ -4,49 +4,50 @@ const std = @import("std");
const builtin = @import("builtin");
const target = builtin.target;
const arch = builtin.cpu.arch;
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
comptime {
if (!builtin.is_test) {
if (arch.isArm()) {
@export(&__aeabi_unwind_cpp_pr0, .{ .name = "__aeabi_unwind_cpp_pr0", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_unwind_cpp_pr1, .{ .name = "__aeabi_unwind_cpp_pr1", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_unwind_cpp_pr2, .{ .name = "__aeabi_unwind_cpp_pr2", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__aeabi_unwind_cpp_pr0, "__aeabi_unwind_cpp_pr0");
symbol(&__aeabi_unwind_cpp_pr1, "__aeabi_unwind_cpp_pr1");
symbol(&__aeabi_unwind_cpp_pr2, "__aeabi_unwind_cpp_pr2");
if (common.want_windows_arm_abi) {
@export(&__aeabi_ldivmod, .{ .name = "__rt_sdiv64", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_uldivmod, .{ .name = "__rt_udiv64", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_idivmod, .{ .name = "__rt_sdiv", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_uidivmod, .{ .name = "__rt_udiv", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_windows_arm_abi) {
symbol(&__aeabi_ldivmod, "__rt_sdiv64");
symbol(&__aeabi_uldivmod, "__rt_udiv64");
symbol(&__aeabi_idivmod, "__rt_sdiv");
symbol(&__aeabi_uidivmod, "__rt_udiv");
}
@export(&__aeabi_ldivmod, .{ .name = "__aeabi_ldivmod", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_uldivmod, .{ .name = "__aeabi_uldivmod", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_idivmod, .{ .name = "__aeabi_idivmod", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_uidivmod, .{ .name = "__aeabi_uidivmod", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__aeabi_ldivmod, "__aeabi_ldivmod");
symbol(&__aeabi_uldivmod, "__aeabi_uldivmod");
symbol(&__aeabi_idivmod, "__aeabi_idivmod");
symbol(&__aeabi_uidivmod, "__aeabi_uidivmod");
@export(&__aeabi_memcpy, .{ .name = "__aeabi_memcpy", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_memcpy4, .{ .name = "__aeabi_memcpy4", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_memcpy8, .{ .name = "__aeabi_memcpy8", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__aeabi_memcpy, "__aeabi_memcpy");
symbol(&__aeabi_memcpy4, "__aeabi_memcpy4");
symbol(&__aeabi_memcpy8, "__aeabi_memcpy8");
@export(&__aeabi_memmove, .{ .name = "__aeabi_memmove", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_memmove4, .{ .name = "__aeabi_memmove4", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_memmove8, .{ .name = "__aeabi_memmove8", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__aeabi_memmove, "__aeabi_memmove");
symbol(&__aeabi_memmove4, "__aeabi_memmove4");
symbol(&__aeabi_memmove8, "__aeabi_memmove8");
@export(&__aeabi_memset, .{ .name = "__aeabi_memset", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_memset4, .{ .name = "__aeabi_memset4", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_memset8, .{ .name = "__aeabi_memset8", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__aeabi_memset, "__aeabi_memset");
symbol(&__aeabi_memset4, "__aeabi_memset4");
symbol(&__aeabi_memset8, "__aeabi_memset8");
@export(&__aeabi_memclr, .{ .name = "__aeabi_memclr", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_memclr4, .{ .name = "__aeabi_memclr4", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_memclr8, .{ .name = "__aeabi_memclr8", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__aeabi_memclr, "__aeabi_memclr");
symbol(&__aeabi_memclr4, "__aeabi_memclr4");
symbol(&__aeabi_memclr8, "__aeabi_memclr8");
if (builtin.os.tag == .linux or builtin.os.tag == .freebsd) {
@export(&__aeabi_read_tp, .{ .name = "__aeabi_read_tp", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__aeabi_read_tp, "__aeabi_read_tp");
}
// floating-point helper functions (single+double-precision reverse subtraction, y x), see subdf3.zig
@export(&__aeabi_frsub, .{ .name = "__aeabi_frsub", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_drsub, .{ .name = "__aeabi_drsub", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__aeabi_frsub, "__aeabi_frsub");
symbol(&__aeabi_drsub, "__aeabi_drsub");
}
}
}

View file

@ -4,7 +4,7 @@ const arch = cpu.arch;
const std = @import("std");
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = @import("../compiler_rt.zig").symbol;
// This parameter is true iff the target architecture supports the bare minimum

View file

@ -1,10 +1,10 @@
const builtin = @import("builtin");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_windows_x86_msvc_abi) {
if (compiler_rt.want_windows_x86_msvc_abi) {
// Don't let LLVM apply the stdcall name mangling on those MSVC builtins
symbol(&_alldiv, "\x01__alldiv");
symbol(&_aulldiv, "\x01__aulldiv");

View file

@ -3,13 +3,14 @@ const builtin = @import("builtin");
const arch = builtin.cpu.arch;
const os = builtin.os.tag;
const abi = builtin.abi;
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
comptime {
if (common.want_windows_x86_msvc_abi) {
if (compiler_rt.want_windows_x86_msvc_abi) {
// Don't let LLVM apply the stdcall name mangling on those MSVC builtins
@export(&_allrem, .{ .name = "\x01__allrem", .linkage = common.linkage, .visibility = common.visibility });
@export(&_aullrem, .{ .name = "\x01__aullrem", .linkage = common.linkage, .visibility = common.visibility });
symbol(&_allrem, "\x01__allrem");
symbol(&_aullrem, "\x01__aullrem");
}
}

View file

@ -1,30 +0,0 @@
const std = @import("std");
const common = @import("./common.zig");
comptime {
@export(&bcmp, .{ .name = "bcmp", .linkage = common.linkage, .visibility = common.visibility });
}
pub fn bcmp(vl: [*]allowzero const u8, vr: [*]allowzero const u8, n: usize) callconv(.c) c_int {
@setRuntimeSafety(false);
var index: usize = 0;
while (index != n) : (index += 1) {
if (vl[index] != vr[index]) {
return 1;
}
}
return 0;
}
test "bcmp" {
const base_arr = &[_]u8{ 1, 1, 1 };
const arr1 = &[_]u8{ 1, 1, 1 };
const arr2 = &[_]u8{ 1, 0, 1 };
const arr3 = &[_]u8{ 1, 2, 1 };
try std.testing.expect(bcmp(base_arr[0..], arr1[0..], base_arr.len) == 0);
try std.testing.expect(bcmp(base_arr[0..], arr2[0..], base_arr.len) != 0);
try std.testing.expect(bcmp(base_arr[0..], arr3[0..], base_arr.len) != 0);
}

View file

@ -1,11 +1,12 @@
const std = @import("std");
const builtin = @import("builtin");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
comptime {
@export(&__bitreversesi2, .{ .name = "__bitreversesi2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__bitreversedi2, .{ .name = "__bitreversedi2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__bitreverseti2, .{ .name = "__bitreverseti2", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__bitreversesi2, "__bitreversesi2");
symbol(&__bitreversedi2, "__bitreversedi2");
symbol(&__bitreverseti2, "__bitreverseti2");
}
inline fn bitreverseXi2(comptime T: type, a: T) T {

View file

@ -1,11 +1,12 @@
const std = @import("std");
const builtin = @import("builtin");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
comptime {
@export(&__bswapsi2, .{ .name = "__bswapsi2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__bswapdi2, .{ .name = "__bswapdi2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__bswapti2, .{ .name = "__bswapti2", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__bswapsi2, "__bswapsi2");
symbol(&__bswapdi2, "__bswapdi2");
symbol(&__bswapti2, "__bswapti2");
}
// bswap - byteswap

View file

@ -2,7 +2,8 @@ const std = @import("std");
const builtin = @import("builtin");
const arch = builtin.cpu.arch;
const os = builtin.os.tag;
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
// Ported from llvm-project d32170dbd5b0d54436537b6b75beaf44324e0c28
@ -188,7 +189,7 @@ fn clear_cache(start: usize, end: usize) callconv(.c) void {
}
fn exportIt() void {
@export(&clear_cache, .{ .name = "__clear_cache", .linkage = common.linkage, .visibility = common.visibility });
symbol(&clear_cache, "__clear_cache");
}
// MIPS-only

View file

@ -1,14 +1,15 @@
const std = @import("std");
const builtin = @import("builtin");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
comptime {
@export(&__cmpsi2, .{ .name = "__cmpsi2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__cmpdi2, .{ .name = "__cmpdi2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__cmpti2, .{ .name = "__cmpti2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__ucmpsi2, .{ .name = "__ucmpsi2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__ucmpdi2, .{ .name = "__ucmpdi2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__ucmpti2, .{ .name = "__ucmpti2", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__cmpsi2, "__cmpsi2");
symbol(&__cmpdi2, "__cmpdi2");
symbol(&__cmpti2, "__cmpti2");
symbol(&__ucmpsi2, "__ucmpsi2");
symbol(&__ucmpdi2, "__ucmpdi2");
symbol(&__ucmpti2, "__ucmpti2");
}
// cmp - signed compare

View file

@ -1,11 +1,11 @@
///! The quoted behavior definitions are from
///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const comparef = @import("./comparef.zig");
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_aeabi) {
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_dcmpeq, "__aeabi_dcmpeq");
symbol(&__aeabi_dcmplt, "__aeabi_dcmplt");
symbol(&__aeabi_dcmple, "__aeabi_dcmple");

View file

@ -1,48 +0,0 @@
///! The quoted behavior definitions are from
///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines
const common = @import("./common.zig");
const comparef = @import("./comparef.zig");
comptime {
@export(&__eqhf2, .{ .name = "__eqhf2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__nehf2, .{ .name = "__nehf2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__lehf2, .{ .name = "__lehf2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__cmphf2, .{ .name = "__cmphf2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__lthf2, .{ .name = "__lthf2", .linkage = common.linkage, .visibility = common.visibility });
}
/// "These functions calculate a <=> b. That is, if a is less than b, they return -1;
/// if a is greater than b, they return 1; and if a and b are equal they return 0.
/// If either argument is NaN they return 1..."
///
/// Note that this matches the definition of `__lehf2`, `__eqhf2`, `__nehf2`, `__cmphf2`,
/// and `__lthf2`.
fn __cmphf2(a: f16, b: f16) callconv(.c) i32 {
return @intFromEnum(comparef.cmpf2(f16, comparef.LE, a, b));
}
/// "These functions return a value less than or equal to zero if neither argument is NaN,
/// and a is less than or equal to b."
pub fn __lehf2(a: f16, b: f16) callconv(.c) i32 {
return __cmphf2(a, b);
}
/// "These functions return zero if neither argument is NaN, and a and b are equal."
/// Note that due to some kind of historical accident, __eqhf2 and __nehf2 are defined
/// to have the same return value.
pub fn __eqhf2(a: f16, b: f16) callconv(.c) i32 {
return __cmphf2(a, b);
}
/// "These functions return a nonzero value if either argument is NaN, or if a and b are unequal."
/// Note that due to some kind of historical accident, __eqhf2 and __nehf2 are defined
/// to have the same return value.
pub fn __nehf2(a: f16, b: f16) callconv(.c) i32 {
return __cmphf2(a, b);
}
/// "These functions return a value less than zero if neither argument is NaN, and a
/// is strictly less than b."
pub fn __lthf2(a: f16, b: f16) callconv(.c) i32 {
return __cmphf2(a, b);
}

View file

@ -1,66 +0,0 @@
///! The quoted behavior definitions are from
///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines
const common = @import("./common.zig");
const comparef = @import("./comparef.zig");
comptime {
if (common.want_aeabi) {
@export(&__aeabi_fcmpeq, .{ .name = "__aeabi_fcmpeq", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_fcmplt, .{ .name = "__aeabi_fcmplt", .linkage = common.linkage, .visibility = common.visibility });
@export(&__aeabi_fcmple, .{ .name = "__aeabi_fcmple", .linkage = common.linkage, .visibility = common.visibility });
} else {
@export(&__eqsf2, .{ .name = "__eqsf2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__nesf2, .{ .name = "__nesf2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__lesf2, .{ .name = "__lesf2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__cmpsf2, .{ .name = "__cmpsf2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__ltsf2, .{ .name = "__ltsf2", .linkage = common.linkage, .visibility = common.visibility });
}
}
/// "These functions calculate a <=> b. That is, if a is less than b, they return -1;
/// if a is greater than b, they return 1; and if a and b are equal they return 0.
/// If either argument is NaN they return 1..."
///
/// Note that this matches the definition of `__lesf2`, `__eqsf2`, `__nesf2`, `__cmpsf2`,
/// and `__ltsf2`.
fn __cmpsf2(a: f32, b: f32) callconv(.c) i32 {
return @intFromEnum(comparef.cmpf2(f32, comparef.LE, a, b));
}
/// "These functions return a value less than or equal to zero if neither argument is NaN,
/// and a is less than or equal to b."
pub fn __lesf2(a: f32, b: f32) callconv(.c) i32 {
return __cmpsf2(a, b);
}
/// "These functions return zero if neither argument is NaN, and a and b are equal."
/// Note that due to some kind of historical accident, __eqsf2 and __nesf2 are defined
/// to have the same return value.
pub fn __eqsf2(a: f32, b: f32) callconv(.c) i32 {
return __cmpsf2(a, b);
}
/// "These functions return a nonzero value if either argument is NaN, or if a and b are unequal."
/// Note that due to some kind of historical accident, __eqsf2 and __nesf2 are defined
/// to have the same return value.
pub fn __nesf2(a: f32, b: f32) callconv(.c) i32 {
return __cmpsf2(a, b);
}
/// "These functions return a value less than zero if neither argument is NaN, and a
/// is strictly less than b."
pub fn __ltsf2(a: f32, b: f32) callconv(.c) i32 {
return __cmpsf2(a, b);
}
fn __aeabi_fcmpeq(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 {
return @intFromBool(comparef.cmpf2(f32, comparef.LE, a, b) == .Equal);
}
fn __aeabi_fcmplt(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 {
return @intFromBool(comparef.cmpf2(f32, comparef.LE, a, b) == .Less);
}
fn __aeabi_fcmple(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 {
return @intFromBool(comparef.cmpf2(f32, comparef.LE, a, b) != .Greater);
}

View file

@ -1,16 +1,16 @@
///! The quoted behavior definitions are from
///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const comparef = @import("./comparef.zig");
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_ppc_abi) {
if (compiler_rt.want_ppc_abi) {
symbol(&__eqtf2, "__eqkf2");
symbol(&__netf2, "__nekf2");
symbol(&__lttf2, "__ltkf2");
symbol(&__letf2, "__lekf2");
} else if (common.want_sparc_abi) {
} else if (compiler_rt.want_sparc_abi) {
symbol(&_Qp_cmp, "_Qp_cmp");
symbol(&_Qp_feq, "_Qp_feq");
symbol(&_Qp_fne, "_Qp_fne");

View file

@ -1,14 +1,15 @@
///! The quoted behavior definitions are from
///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const comparef = @import("./comparef.zig");
comptime {
@export(&__eqxf2, .{ .name = "__eqxf2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__nexf2, .{ .name = "__nexf2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__lexf2, .{ .name = "__lexf2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__cmpxf2, .{ .name = "__cmpxf2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__ltxf2, .{ .name = "__ltxf2", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__eqxf2, "__eqxf2");
symbol(&__nexf2, "__nexf2");
symbol(&__lexf2, "__lexf2");
symbol(&__cmpxf2, "__cmpxf2");
symbol(&__ltxf2, "__ltxf2");
}
/// "These functions calculate a <=> b. That is, if a is less than b, they return -1;

View file

@ -1,296 +0,0 @@
const std = @import("std");
const builtin = @import("builtin");
const native_endian = builtin.cpu.arch.endian();
const ofmt_c = builtin.object_format == .c;
/// Deprecated, everything in common should move to compiler_rt.zig
pub const linkage = @import("../compiler_rt.zig").linkage;
/// Deprecated, everything in common should move to compiler_rt.zig
pub const visibility = @import("../compiler_rt.zig").visibility;
pub const PreferredLoadStoreElement = element: {
if (std.simd.suggestVectorLength(u8)) |vec_size| {
const Vec = @Vector(vec_size, u8);
if (@sizeOf(Vec) == vec_size and std.math.isPowerOfTwo(vec_size)) {
break :element Vec;
}
}
break :element usize;
};
pub const want_aeabi = switch (builtin.abi) {
.eabi,
.eabihf,
.musleabi,
.musleabihf,
.gnueabi,
.gnueabihf,
.android,
.androideabi,
=> switch (builtin.cpu.arch) {
.arm, .armeb, .thumb, .thumbeb => true,
else => false,
},
else => false,
};
/// These functions are required on Windows on ARM. They are provided by MSVC libc, but in libc-less
/// builds or when linking MinGW libc they are our responsibility.
/// Temporarily used for thumb-uefi until https://github.com/ziglang/zig/issues/21630 is addressed.
pub const want_windows_arm_abi = e: {
if (!builtin.cpu.arch.isArm()) break :e false;
switch (builtin.os.tag) {
.windows, .uefi => {},
else => break :e false,
}
// The ABI is needed, but it's only our reponsibility if libc won't provide it.
break :e builtin.abi.isGnu() or !builtin.link_libc;
};
/// These functions are required by on Windows on x86 on some ABIs. They are provided by MSVC libc,
/// but in libc-less builds they are our responsibility.
pub const want_windows_x86_msvc_abi = e: {
if (builtin.cpu.arch != .x86) break :e false;
if (builtin.os.tag != .windows) break :e false;
switch (builtin.abi) {
.none, .msvc, .itanium => {},
else => break :e false,
}
// The ABI is needed, but it's only our responsibility if libc won't provide it.
break :e !builtin.link_libc;
};
pub const want_ppc_abi = builtin.cpu.arch.isPowerPC();
pub const want_float_exceptions = !builtin.cpu.arch.isWasm();
// Libcalls that involve u128 on Windows x86-64 are expected by LLVM to use the
// calling convention of @Vector(2, u64), rather than what's standard.
pub const want_windows_v2u64_abi = builtin.os.tag == .windows and builtin.cpu.arch == .x86_64 and !ofmt_c;
/// This governs whether to use these symbol names for f16/f32 conversions
/// rather than the standard names:
/// * __gnu_f2h_ieee
/// * __gnu_h2f_ieee
/// Known correct configurations:
/// x86_64-freestanding-none => true
/// x86_64-linux-none => true
/// x86_64-linux-gnu => true
/// x86_64-linux-musl => true
/// x86_64-linux-eabi => true
/// arm-linux-musleabihf => true
/// arm-linux-gnueabihf => true
/// arm-linux-eabihf => false
/// wasm32-wasi-musl => false
/// wasm32-freestanding-none => false
/// x86_64-windows-gnu => true
/// x86_64-windows-msvc => true
/// any-macos-any => false
pub const gnu_f16_abi = switch (builtin.cpu.arch) {
.wasm32,
.wasm64,
.riscv64,
.riscv64be,
.riscv32,
.riscv32be,
=> false,
.x86, .x86_64 => true,
.arm, .armeb, .thumb, .thumbeb => switch (builtin.abi) {
.eabi, .eabihf => false,
else => true,
},
else => !builtin.os.tag.isDarwin(),
};
pub const want_sparc_abi = builtin.cpu.arch.isSPARC();
/// Deprecated, everything in common should move to compiler_rt.zig
pub const test_safety = @import("../compiler_rt.zig").test_safety;
/// This seems to mostly correspond to `clang::TargetInfo::HasFloat16`.
pub fn F16T(comptime OtherType: type) type {
return switch (builtin.cpu.arch) {
.amdgcn,
.arm,
.armeb,
.thumb,
.thumbeb,
.aarch64,
.aarch64_be,
.hexagon,
.loongarch32,
.loongarch64,
.nvptx,
.nvptx64,
.riscv32,
.riscv32be,
.riscv64,
.riscv64be,
.s390x,
.spirv32,
.spirv64,
=> f16,
.x86, .x86_64 => if (builtin.target.os.tag.isDarwin()) switch (OtherType) {
// Starting with LLVM 16, Darwin uses different abi for f16
// depending on the type of the other return/argument..???
f32, f64 => u16,
f80, f128 => f16,
else => unreachable,
} else f16,
else => u16,
};
}
pub fn wideMultiply(comptime Z: type, a: Z, b: Z, hi: *Z, lo: *Z) void {
switch (Z) {
u16 => {
// 16x16 --> 32 bit multiply
const product = @as(u32, a) * @as(u32, b);
hi.* = @intCast(product >> 16);
lo.* = @truncate(product);
},
u32 => {
// 32x32 --> 64 bit multiply
const product = @as(u64, a) * @as(u64, b);
hi.* = @truncate(product >> 32);
lo.* = @truncate(product);
},
u64 => {
const S = struct {
fn loWord(x: u64) u64 {
return @as(u32, @truncate(x));
}
fn hiWord(x: u64) u64 {
return @as(u32, @truncate(x >> 32));
}
};
// 64x64 -> 128 wide multiply for platforms that don't have such an operation;
// many 64-bit platforms have this operation, but they tend to have hardware
// floating-point, so we don't bother with a special case for them here.
// Each of the component 32x32 -> 64 products
const plolo: u64 = S.loWord(a) * S.loWord(b);
const plohi: u64 = S.loWord(a) * S.hiWord(b);
const philo: u64 = S.hiWord(a) * S.loWord(b);
const phihi: u64 = S.hiWord(a) * S.hiWord(b);
// Sum terms that contribute to lo in a way that allows us to get the carry
const r0: u64 = S.loWord(plolo);
const r1: u64 = S.hiWord(plolo) +% S.loWord(plohi) +% S.loWord(philo);
lo.* = r0 +% (r1 << 32);
// Sum terms contributing to hi with the carry from lo
hi.* = S.hiWord(plohi) +% S.hiWord(philo) +% S.hiWord(r1) +% phihi;
},
u128 => {
const Word_LoMask: u64 = 0x00000000ffffffff;
const Word_HiMask: u64 = 0xffffffff00000000;
const Word_FullMask: u64 = 0xffffffffffffffff;
const S = struct {
fn Word_1(x: u128) u64 {
return @as(u32, @truncate(x >> 96));
}
fn Word_2(x: u128) u64 {
return @as(u32, @truncate(x >> 64));
}
fn Word_3(x: u128) u64 {
return @as(u32, @truncate(x >> 32));
}
fn Word_4(x: u128) u64 {
return @as(u32, @truncate(x));
}
};
// 128x128 -> 256 wide multiply for platforms that don't have such an operation;
// many 64-bit platforms have this operation, but they tend to have hardware
// floating-point, so we don't bother with a special case for them here.
const product11: u64 = S.Word_1(a) * S.Word_1(b);
const product12: u64 = S.Word_1(a) * S.Word_2(b);
const product13: u64 = S.Word_1(a) * S.Word_3(b);
const product14: u64 = S.Word_1(a) * S.Word_4(b);
const product21: u64 = S.Word_2(a) * S.Word_1(b);
const product22: u64 = S.Word_2(a) * S.Word_2(b);
const product23: u64 = S.Word_2(a) * S.Word_3(b);
const product24: u64 = S.Word_2(a) * S.Word_4(b);
const product31: u64 = S.Word_3(a) * S.Word_1(b);
const product32: u64 = S.Word_3(a) * S.Word_2(b);
const product33: u64 = S.Word_3(a) * S.Word_3(b);
const product34: u64 = S.Word_3(a) * S.Word_4(b);
const product41: u64 = S.Word_4(a) * S.Word_1(b);
const product42: u64 = S.Word_4(a) * S.Word_2(b);
const product43: u64 = S.Word_4(a) * S.Word_3(b);
const product44: u64 = S.Word_4(a) * S.Word_4(b);
const sum0: u128 = @as(u128, product44);
const sum1: u128 = @as(u128, product34) +%
@as(u128, product43);
const sum2: u128 = @as(u128, product24) +%
@as(u128, product33) +%
@as(u128, product42);
const sum3: u128 = @as(u128, product14) +%
@as(u128, product23) +%
@as(u128, product32) +%
@as(u128, product41);
const sum4: u128 = @as(u128, product13) +%
@as(u128, product22) +%
@as(u128, product31);
const sum5: u128 = @as(u128, product12) +%
@as(u128, product21);
const sum6: u128 = @as(u128, product11);
const r0: u128 = (sum0 & Word_FullMask) +%
((sum1 & Word_LoMask) << 32);
const r1: u128 = (sum0 >> 64) +%
((sum1 >> 32) & Word_FullMask) +%
(sum2 & Word_FullMask) +%
((sum3 << 32) & Word_HiMask);
lo.* = r0 +% (r1 << 64);
hi.* = (r1 >> 64) +%
(sum1 >> 96) +%
(sum2 >> 64) +%
(sum3 >> 32) +%
sum4 +%
(sum5 << 32) +%
(sum6 << 64);
},
else => @compileError("unsupported"),
}
}
pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeInfo(T).float.bits)) i32 {
const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
const integerBit = @as(Z, 1) << std.math.floatFractionalBits(T);
const shift = @clz(significand.*) - @clz(integerBit);
significand.* <<= @as(std.math.Log2Int(Z), @intCast(shift));
return @as(i32, 1) - shift;
}
pub inline fn fneg(a: anytype) @TypeOf(a) {
const F = @TypeOf(a);
const bits = @typeInfo(F).float.bits;
const U = @Int(.unsigned, bits);
const sign_bit_mask = @as(U, 1) << (bits - 1);
const negated = @as(U, @bitCast(a)) ^ sign_bit_mask;
return @bitCast(negated);
}
/// Allows to access underlying bits as two equally sized lower and higher
/// signed or unsigned integers.
pub fn HalveInt(comptime T: type, comptime signed_half: bool) type {
return extern union {
pub const bits = @divExact(@typeInfo(T).int.bits, 2);
pub const HalfTU = std.meta.Int(.unsigned, bits);
pub const HalfTS = std.meta.Int(.signed, bits);
pub const HalfT = if (signed_half) HalfTS else HalfTU;
all: T,
s: if (native_endian == .little)
extern struct { low: HalfT, high: HalfT }
else
extern struct { high: HalfT, low: HalfT },
};
}

View file

@ -1,5 +1,149 @@
const std = @import("std");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
comptime {
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_fcmpun, "__aeabi_fcmpun");
} else {
symbol(&__unordsf2, "__unordsf2");
}
symbol(&__unordxf2, "__unordxf2");
symbol(&__eqhf2, "__eqhf2");
symbol(&__nehf2, "__nehf2");
symbol(&__lehf2, "__lehf2");
symbol(&__cmphf2, "__cmphf2");
symbol(&__lthf2, "__lthf2");
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_fcmpeq, "__aeabi_fcmpeq");
symbol(&__aeabi_fcmplt, "__aeabi_fcmplt");
symbol(&__aeabi_fcmple, "__aeabi_fcmple");
} else {
symbol(&__eqsf2, "__eqsf2");
symbol(&__nesf2, "__nesf2");
symbol(&__lesf2, "__lesf2");
symbol(&__cmpsf2, "__cmpsf2");
symbol(&__ltsf2, "__ltsf2");
}
if (compiler_rt.want_ppc_abi) {
symbol(&__unordtf2, "__unordkf2");
} else if (compiler_rt.want_sparc_abi) {
// These exports are handled in cmptf2.zig because unordered comparisons
// are based on calling _Qp_cmp.
}
symbol(&__unordtf2, "__unordtf2");
symbol(&__unordhf2, "__unordhf2");
}
pub fn __unordhf2(a: f16, b: f16) callconv(.c) i32 {
return unordcmp(f16, a, b);
}
pub fn __unordtf2(a: f128, b: f128) callconv(.c) i32 {
return unordcmp(f128, a, b);
}
/// "These functions calculate a <=> b. That is, if a is less than b, they return -1;
/// if a is greater than b, they return 1; and if a and b are equal they return 0.
/// If either argument is NaN they return 1..."
///
/// Note that this matches the definition of `__lesf2`, `__eqsf2`, `__nesf2`, `__cmpsf2`,
/// and `__ltsf2`.
fn __cmpsf2(a: f32, b: f32) callconv(.c) i32 {
return @intFromEnum(cmpf2(f32, LE, a, b));
}
/// "These functions return a value less than or equal to zero if neither argument is NaN,
/// and a is less than or equal to b."
pub fn __lesf2(a: f32, b: f32) callconv(.c) i32 {
return __cmpsf2(a, b);
}
/// "These functions return zero if neither argument is NaN, and a and b are equal."
/// Note that due to some kind of historical accident, __eqsf2 and __nesf2 are defined
/// to have the same return value.
pub fn __eqsf2(a: f32, b: f32) callconv(.c) i32 {
return __cmpsf2(a, b);
}
/// "These functions return a nonzero value if either argument is NaN, or if a and b are unequal."
/// Note that due to some kind of historical accident, __eqsf2 and __nesf2 are defined
/// to have the same return value.
pub fn __nesf2(a: f32, b: f32) callconv(.c) i32 {
return __cmpsf2(a, b);
}
/// "These functions return a value less than zero if neither argument is NaN, and a
/// is strictly less than b."
pub fn __ltsf2(a: f32, b: f32) callconv(.c) i32 {
return __cmpsf2(a, b);
}
fn __aeabi_fcmpeq(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 {
return @intFromBool(cmpf2(f32, LE, a, b) == .Equal);
}
fn __aeabi_fcmplt(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 {
return @intFromBool(cmpf2(f32, LE, a, b) == .Less);
}
fn __aeabi_fcmple(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 {
return @intFromBool(cmpf2(f32, LE, a, b) != .Greater);
}
/// "These functions calculate a <=> b. That is, if a is less than b, they return -1;
/// if a is greater than b, they return 1; and if a and b are equal they return 0.
/// If either argument is NaN they return 1..."
///
/// Note that this matches the definition of `__lehf2`, `__eqhf2`, `__nehf2`, `__cmphf2`,
/// and `__lthf2`.
fn __cmphf2(a: f16, b: f16) callconv(.c) i32 {
return @intFromEnum(cmpf2(f16, LE, a, b));
}
/// "These functions return a value less than or equal to zero if neither argument is NaN,
/// and a is less than or equal to b."
fn __lehf2(a: f16, b: f16) callconv(.c) i32 {
return __cmphf2(a, b);
}
/// "These functions return zero if neither argument is NaN, and a and b are equal."
/// Note that due to some kind of historical accident, __eqhf2 and __nehf2 are defined
/// to have the same return value.
fn __eqhf2(a: f16, b: f16) callconv(.c) i32 {
return __cmphf2(a, b);
}
/// "These functions return a nonzero value if either argument is NaN, or if a and b are unequal."
/// Note that due to some kind of historical accident, __eqhf2 and __nehf2 are defined
/// to have the same return value.
fn __nehf2(a: f16, b: f16) callconv(.c) i32 {
return __cmphf2(a, b);
}
/// "These functions return a value less than zero if neither argument is NaN, and a
/// is strictly less than b."
fn __lthf2(a: f16, b: f16) callconv(.c) i32 {
return __cmphf2(a, b);
}
fn __unordxf2(a: f80, b: f80) callconv(.c) i32 {
return unordcmp(f80, a, b);
}
pub fn __unordsf2(a: f32, b: f32) callconv(.c) i32 {
return unordcmp(f32, a, b);
}
fn __aeabi_fcmpun(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 {
return unordcmp(f32, a, b);
}
pub const LE = enum(i32) {
Less = -1,
Equal = 0,

View file

@ -5,15 +5,15 @@
const std = @import("std");
const builtin = @import("builtin");
const __eqsf2 = @import("./cmpsf2.zig").__eqsf2;
const __lesf2 = @import("./cmpsf2.zig").__lesf2;
const __ltsf2 = @import("./cmpsf2.zig").__ltsf2;
const __nesf2 = @import("./cmpsf2.zig").__nesf2;
const __eqsf2 = @import("./comparef.zig").__eqsf2;
const __lesf2 = @import("./comparef.zig").__lesf2;
const __ltsf2 = @import("./comparef.zig").__ltsf2;
const __nesf2 = @import("./comparef.zig").__nesf2;
const __gesf2 = @import("./gesf2.zig").__gesf2;
const __gtsf2 = @import("./gesf2.zig").__gtsf2;
const __unordsf2 = @import("./unordsf2.zig").__unordsf2;
const __unordsf2 = @import("./comparef.zig").__unordsf2;
const TestVector = struct {
a: f32,

View file

@ -3,7 +3,7 @@ const math = std.math;
const mem = std.mem;
const expect = std.testing.expect;
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = @import("../compiler_rt.zig").symbol;
const trig = @import("trig.zig");
const rem_pio2 = @import("rem_pio2.zig").rem_pio2;
@ -14,7 +14,7 @@ comptime {
symbol(&cosf, "cosf");
symbol(&cos, "cos");
symbol(&__cosx, "__cosx");
if (common.want_ppc_abi) {
if (compiler_rt.want_ppc_abi) {
symbol(&cosq, "cosf128");
}
symbol(&cosq, "cosq");
@ -40,7 +40,7 @@ pub fn cosf(x: f32) callconv(.c) f32 {
if (ix <= 0x3f490fda) { // |x| ~<= pi/4
if (ix < 0x39800000) { // |x| < 2**-12
// raise inexact if x != 0
if (common.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120);
if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120);
return 1.0;
}
return trig.__cosdf(x);
@ -91,7 +91,7 @@ pub fn cos(x: f64) callconv(.c) f64 {
if (ix <= 0x3fe921fb) {
if (ix < 0x3e46a09e) { // |x| < 2**-27 * sqrt(2)
// raise inexact if x!=0
if (common.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120);
if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120);
return 1.0;
}
return trig.__cos(x, 0);

View file

@ -3,14 +3,14 @@
//! https://github.com/llvm/llvm-project/commit/d674d96bc56c0f377879d01c9d8dfdaaa7859cdb/compiler-rt/lib/builtins/divdf3.c
const std = @import("std");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = @import("../compiler_rt.zig").symbol;
const normalize = common.normalize;
const wideMultiply = common.wideMultiply;
const normalize = compiler_rt.normalize;
const wideMultiply = compiler_rt.wideMultiply;
comptime {
if (common.want_aeabi) {
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_ddiv, "__aeabi_ddiv");
} else {
symbol(&__divdf3, "__divdf3");

View file

@ -1,10 +1,11 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const divc3 = @import("./divc3.zig");
const Complex = @import("./mulc3.zig").Complex;
comptime {
if (@import("builtin").zig_backend != .stage2_c) {
@export(&__divhc3, .{ .name = "__divhc3", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__divhc3, "__divhc3");
}
}

View file

@ -3,7 +3,7 @@ const endian = builtin.cpu.arch.endian();
const std = @import("std");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const udivmod = @import("udivmodei4.zig").divmod;
const symbol = @import("../compiler_rt.zig").symbol;
@ -36,7 +36,7 @@ fn divmod(q: ?[]u32, r: ?[]u32, u: []u32, v: []u32) !void {
}
pub fn __divei4(q_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) void {
@setRuntimeSafety(common.test_safety);
@setRuntimeSafety(compiler_rt.test_safety);
const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits));
const q: []u32 = @ptrCast(@alignCast(q_p[0..byte_size]));
const u: []u32 = @ptrCast(@alignCast(u_p[0..byte_size]));
@ -45,7 +45,7 @@ pub fn __divei4(q_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) vo
}
pub fn __modei4(r_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) void {
@setRuntimeSafety(common.test_safety);
@setRuntimeSafety(compiler_rt.test_safety);
const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits));
const r: []u32 = @ptrCast(@alignCast(r_p[0..byte_size]));
const u: []u32 = @ptrCast(@alignCast(u_p[0..byte_size]));

View file

@ -4,12 +4,12 @@
const std = @import("std");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = @import("../compiler_rt.zig").symbol;
const normalize = common.normalize;
const normalize = compiler_rt.normalize;
comptime {
if (common.want_aeabi) {
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_fdiv, "__aeabi_fdiv");
} else {
symbol(&__divsf3, "__divsf3");

View file

@ -1,11 +1,11 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const divc3 = @import("./divc3.zig");
const Complex = @import("./mulc3.zig").Complex;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (@import("builtin").zig_backend != .stage2_c) {
if (common.want_ppc_abi)
if (compiler_rt.want_ppc_abi)
symbol(&__divtc3, "__divkc3");
symbol(&__divtc3, "__divtc3");
}

View file

@ -1,17 +1,18 @@
const std = @import("std");
const builtin = @import("builtin");
const common = @import("common.zig");
const normalize = common.normalize;
const wideMultiply = common.wideMultiply;
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const normalize = compiler_rt.normalize;
const wideMultiply = compiler_rt.wideMultiply;
comptime {
if (common.want_ppc_abi) {
@export(&__divtf3, .{ .name = "__divkf3", .linkage = common.linkage, .visibility = common.visibility });
} else if (common.want_sparc_abi) {
@export(&_Qp_div, .{ .name = "_Qp_div", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_ppc_abi) {
symbol(&__divtf3, "__divkf3");
} else if (compiler_rt.want_sparc_abi) {
symbol(&_Qp_div, "_Qp_div");
}
@export(&__divtf3, .{ .name = "__divtf3", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__divtf3, "__divtf3");
}
pub fn __divtf3(a: f128, b: f128) callconv(.c) f128 {

View file

@ -1,39 +0,0 @@
const std = @import("std");
const builtin = @import("builtin");
const udivmod = @import("udivmod.zig").udivmod;
const arch = builtin.cpu.arch;
const common = @import("common.zig");
comptime {
if (common.want_windows_v2u64_abi) {
@export(&__divti3_windows_x86_64, .{ .name = "__divti3", .linkage = common.linkage, .visibility = common.visibility });
} else {
@export(&__divti3, .{ .name = "__divti3", .linkage = common.linkage, .visibility = common.visibility });
}
}
pub fn __divti3(a: i128, b: i128) callconv(.c) i128 {
return div(a, b);
}
const v128 = @Vector(2, u64);
fn __divti3_windows_x86_64(a: v128, b: v128) callconv(.c) v128 {
return @bitCast(div(@bitCast(a), @bitCast(b)));
}
inline fn div(a: i128, b: i128) i128 {
const s_a = a >> (128 - 1);
const s_b = b >> (128 - 1);
const an = (a ^ s_a) -% s_a;
const bn = (b ^ s_b) -% s_b;
const r = udivmod(u128, @bitCast(an), @bitCast(bn), null);
const s = s_a ^ s_b;
return (@as(i128, @bitCast(r)) ^ s) -% s;
}
test {
_ = @import("divti3_test.zig");
}

View file

@ -1,4 +1,4 @@
const __divti3 = @import("divti3.zig").__divti3;
const __divti3 = @import("udivmod.zig").__divti3;
const testing = @import("std").testing;
fn test__divti3(a: i128, b: i128, expected: i128) !void {

View file

@ -2,12 +2,13 @@ const std = @import("std");
const builtin = @import("builtin");
const arch = builtin.cpu.arch;
const common = @import("common.zig");
const normalize = common.normalize;
const wideMultiply = common.wideMultiply;
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const normalize = compiler_rt.normalize;
const wideMultiply = compiler_rt.wideMultiply;
comptime {
@export(&__divxf3, .{ .name = "__divxf3", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__divxf3, "__divxf3");
}
pub fn __divxf3(a: f80, b: f80) callconv(.c) f80 {

View file

@ -5,7 +5,8 @@
const std = @import("std");
const builtin = @import("builtin");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const abort = std.process.abort;
const assert = std.debug.assert;
@ -17,7 +18,7 @@ const gcc_word = usize;
comptime {
if (builtin.link_libc and (builtin.abi.isAndroid() or builtin.abi.isOpenHarmony() or builtin.os.tag == .openbsd)) {
@export(&__emutls_get_address, .{ .name = "__emutls_get_address", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__emutls_get_address, "__emutls_get_address");
}
}

View file

@ -13,7 +13,7 @@ const mem = std.mem;
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
@ -21,7 +21,7 @@ comptime {
symbol(&expf, "expf");
symbol(&exp, "exp");
symbol(&__expx, "__expx");
if (common.want_ppc_abi) {
if (compiler_rt.want_ppc_abi) {
symbol(&expq, "expf128");
}
symbol(&expq, "expq");
@ -61,7 +61,7 @@ pub fn expf(x_: f32) callconv(.c) f32 {
return x * 0x1.0p127;
}
if (sign != 0) {
if (common.want_float_exceptions) mem.doNotOptimizeAway(-0x1.0p-149 / x); // overflow
if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(-0x1.0p-149 / x); // overflow
// x <= -103.972084
if (hx >= 0x42CFF1B5) {
return 0;
@ -93,7 +93,7 @@ pub fn expf(x_: f32) callconv(.c) f32 {
hi = x;
lo = 0;
} else {
if (common.want_float_exceptions) mem.doNotOptimizeAway(0x1.0p127 + x); // inexact
if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(0x1.0p127 + x); // inexact
return 1 + x;
}
@ -137,11 +137,11 @@ pub fn exp(x_: f64) callconv(.c) f64 {
}
if (x > 709.782712893383973096) {
// overflow if x != inf
return if (common.want_float_exceptions) x * 0x1p1023 else std.math.inf(f64);
return if (compiler_rt.want_float_exceptions) x * 0x1p1023 else std.math.inf(f64);
}
if (x < -708.39641853226410622) {
// underflow if x != -inf
if (common.want_float_exceptions) mem.doNotOptimizeAway(-0x0.0000000000001p-1022 / x);
if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(-0x0.0000000000001p-1022 / x);
if (x < -745.13321910194110842) {
return 0;
}
@ -174,7 +174,7 @@ pub fn exp(x_: f64) callconv(.c) f64 {
lo = 0;
} else {
// inexact if x != 0
if (common.want_float_exceptions) mem.doNotOptimizeAway(0x1.0p1023 + x);
if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(0x1.0p1023 + x);
return 1 + x;
}

View file

@ -11,18 +11,19 @@ const math = std.math;
const mem = std.mem;
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
comptime {
@export(&__exp2h, .{ .name = "__exp2h", .linkage = common.linkage, .visibility = common.visibility });
@export(&exp2f, .{ .name = "exp2f", .linkage = common.linkage, .visibility = common.visibility });
@export(&exp2, .{ .name = "exp2", .linkage = common.linkage, .visibility = common.visibility });
@export(&__exp2x, .{ .name = "__exp2x", .linkage = common.linkage, .visibility = common.visibility });
if (common.want_ppc_abi) {
@export(&exp2q, .{ .name = "exp2f128", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__exp2h, "__exp2h");
symbol(&exp2f, "exp2f");
symbol(&exp2, "exp2");
symbol(&__exp2x, "__exp2x");
if (compiler_rt.want_ppc_abi) {
symbol(&exp2q, "exp2f128");
}
@export(&exp2q, .{ .name = "exp2q", .linkage = common.linkage, .visibility = common.visibility });
@export(&exp2l, .{ .name = "exp2l", .linkage = common.linkage, .visibility = common.visibility });
symbol(&exp2q, "exp2q");
symbol(&exp2l, "exp2l");
}
pub fn __exp2h(x: f16) callconv(.c) f16 {
@ -54,7 +55,7 @@ pub fn exp2f(x: f32) callconv(.c) f32 {
// x < -126
if (u >= 0x80000000) {
if (u >= 0xC3160000 or u & 0x000FFFF != 0) {
if (common.want_float_exceptions) mem.doNotOptimizeAway(-0x1.0p-149 / x);
if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(-0x1.0p-149 / x);
}
// x <= -150
if (u >= 0xC3160000) {
@ -108,7 +109,7 @@ pub fn exp2(x: f64) callconv(.c) f64 {
if (ix >= 0x408FF000) {
// x >= 1024 or nan
if (ix >= 0x40900000 and ux >> 63 == 0) {
return if (common.want_float_exceptions) x * 0x1p1023 else std.math.inf(f64);
return if (compiler_rt.want_float_exceptions) x * 0x1p1023 else std.math.inf(f64);
}
// -inf or -nan
if (ix >= 0x7FF00000) {
@ -118,7 +119,7 @@ pub fn exp2(x: f64) callconv(.c) f64 {
if (ux >> 63 != 0) {
// underflow
if (x <= -1075 or x - 0x1.0p52 + 0x1.0p52 != x) {
if (common.want_float_exceptions) mem.doNotOptimizeAway(@as(f32, @floatCast(-0x1.0p-149 / x)));
if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(@as(f32, @floatCast(-0x1.0p-149 / x)));
}
if (x <= -1075) {
return 0;

View file

@ -1,11 +1,11 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const extendf = @import("./extendf.zig").extendf;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_ppc_abi) {
if (compiler_rt.want_ppc_abi) {
symbol(&__extenddftf2, "__extenddfkf2");
} else if (common.want_sparc_abi) {
} else if (compiler_rt.want_sparc_abi) {
symbol(&_Qp_dtoq, "_Qp_dtoq");
}
symbol(&__extenddftf2, "__extenddftf2");

View file

@ -1,8 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const extend_f80 = @import("./extendf.zig").extend_f80;
comptime {
@export(&__extenddfxf2, .{ .name = "__extenddfxf2", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__extenddfxf2, "__extenddfxf2");
}
pub fn __extenddfxf2(a: f64) callconv(.c) f80 {

View file

@ -1,12 +1,14 @@
const builtin = @import("builtin");
const std = @import("std");
const math = std.math;
const builtin = @import("builtin");
const __extendhfsf2 = @import("extendhfsf2.zig").__extendhfsf2;
const __extendhftf2 = @import("extendhftf2.zig").__extendhftf2;
const __extendsftf2 = @import("extendsftf2.zig").__extendsftf2;
const __extenddftf2 = @import("extenddftf2.zig").__extenddftf2;
const __extenddfxf2 = @import("extenddfxf2.zig").__extenddfxf2;
const F16T = @import("./common.zig").F16T;
const F16T = @import("../compiler_rt.zig").F16T;
fn test__extenddfxf2(a: f64, expected: u80) !void {
const x = __extenddfxf2(a);

View file

@ -1,4 +1,4 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = @import("../compiler_rt.zig").symbol;
const extendf = @import("./extendf.zig").extendf;
@ -6,6 +6,6 @@ comptime {
symbol(&__extendhfdf2, "__extendhfdf2");
}
pub fn __extendhfdf2(a: common.F16T(f64)) callconv(.c) f64 {
pub fn __extendhfdf2(a: compiler_rt.F16T(f64)) callconv(.c) f64 {
return extendf(f64, f16, @as(u16, @bitCast(a)));
}

View file

@ -1,21 +1,21 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const extendf = @import("./extendf.zig").extendf;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.gnu_f16_abi) {
if (compiler_rt.gnu_f16_abi) {
symbol(&__gnu_h2f_ieee, "__gnu_h2f_ieee");
} else if (common.want_aeabi) {
} else if (compiler_rt.want_aeabi) {
symbol(&__aeabi_h2f, "__aeabi_h2f");
}
symbol(&__extendhfsf2, "__extendhfsf2");
}
pub fn __extendhfsf2(a: common.F16T(f32)) callconv(.c) f32 {
pub fn __extendhfsf2(a: compiler_rt.F16T(f32)) callconv(.c) f32 {
return extendf(f32, f16, @as(u16, @bitCast(a)));
}
fn __gnu_h2f_ieee(a: common.F16T(f32)) callconv(.c) f32 {
fn __gnu_h2f_ieee(a: compiler_rt.F16T(f32)) callconv(.c) f32 {
return extendf(f32, f16, @as(u16, @bitCast(a)));
}

View file

@ -1,10 +1,11 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const extendf = @import("./extendf.zig").extendf;
comptime {
@export(&__extendhftf2, .{ .name = "__extendhftf2", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__extendhftf2, "__extendhftf2");
}
pub fn __extendhftf2(a: common.F16T(f128)) callconv(.c) f128 {
pub fn __extendhftf2(a: compiler_rt.F16T(f128)) callconv(.c) f128 {
return extendf(f128, f16, @as(u16, @bitCast(a)));
}

View file

@ -1,10 +1,11 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const extend_f80 = @import("./extendf.zig").extend_f80;
comptime {
@export(&__extendhfxf2, .{ .name = "__extendhfxf2", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__extendhfxf2, "__extendhfxf2");
}
fn __extendhfxf2(a: common.F16T(f80)) callconv(.c) f80 {
fn __extendhfxf2(a: compiler_rt.F16T(f80)) callconv(.c) f80 {
return extend_f80(f16, @as(u16, @bitCast(a)));
}

View file

@ -1,11 +1,12 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const extendf = @import("./extendf.zig").extendf;
comptime {
if (common.want_aeabi) {
@export(&__aeabi_f2d, .{ .name = "__aeabi_f2d", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_f2d, "__aeabi_f2d");
} else {
@export(&__extendsfdf2, .{ .name = "__extendsfdf2", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__extendsfdf2, "__extendsfdf2");
}
}

View file

@ -1,13 +1,14 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const extendf = @import("./extendf.zig").extendf;
comptime {
if (common.want_ppc_abi) {
@export(&__extendsftf2, .{ .name = "__extendsfkf2", .linkage = common.linkage, .visibility = common.visibility });
} else if (common.want_sparc_abi) {
@export(&_Qp_stoq, .{ .name = "_Qp_stoq", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_ppc_abi) {
symbol(&__extendsftf2, "__extendsfkf2");
} else if (compiler_rt.want_sparc_abi) {
symbol(&_Qp_stoq, "_Qp_stoq");
}
@export(&__extendsftf2, .{ .name = "__extendsftf2", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__extendsftf2, "__extendsftf2");
}
pub fn __extendsftf2(a: f32) callconv(.c) f128 {

View file

@ -1,18 +1,19 @@
const std = @import("std");
const builtin = @import("builtin");
const arch = builtin.cpu.arch;
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
comptime {
@export(&__fabsh, .{ .name = "__fabsh", .linkage = common.linkage, .visibility = common.visibility });
@export(&fabsf, .{ .name = "fabsf", .linkage = common.linkage, .visibility = common.visibility });
@export(&fabs, .{ .name = "fabs", .linkage = common.linkage, .visibility = common.visibility });
@export(&__fabsx, .{ .name = "__fabsx", .linkage = common.linkage, .visibility = common.visibility });
if (common.want_ppc_abi) {
@export(&fabsq, .{ .name = "fabsf128", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fabsh, "__fabsh");
symbol(&fabsf, "fabsf");
symbol(&fabs, "fabs");
symbol(&__fabsx, "__fabsx");
if (compiler_rt.want_ppc_abi) {
symbol(&fabsq, "fabsf128");
}
@export(&fabsq, .{ .name = "fabsq", .linkage = common.linkage, .visibility = common.visibility });
@export(&fabsl, .{ .name = "fabsl", .linkage = common.linkage, .visibility = common.visibility });
symbol(&fabsq, "fabsq");
symbol(&fabsl, "fabsl");
}
pub fn __fabsh(a: f16) callconv(.c) f16 {

View file

@ -1,15 +1,16 @@
const builtin = @import("builtin");
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
if (common.want_aeabi) {
@export(&__aeabi_d2lz, .{ .name = "__aeabi_d2lz", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_d2lz, "__aeabi_d2lz");
} else {
if (common.want_windows_arm_abi) {
@export(&__fixdfdi, .{ .name = "__dtoi64", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_windows_arm_abi) {
symbol(&__fixdfdi, "__dtoi64");
}
@export(&__fixdfdi, .{ .name = "__fixdfdi", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixdfdi, "__fixdfdi");
}
}

View file

@ -1,10 +1,11 @@
const std = @import("std");
const builtin = @import("builtin");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat;
comptime {
@export(&__fixdfei, .{ .name = "__fixdfei", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixdfei, "__fixdfei");
}
pub fn __fixdfei(r: [*]u8, bits: usize, a: f64) callconv(.c) void {

View file

@ -1,9 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_aeabi) {
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_d2iz, "__aeabi_d2iz");
} else {
symbol(&__fixdfsi, "__fixdfsi");

View file

@ -1,9 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_windows_v2u64_abi) {
if (compiler_rt.want_windows_v2u64_abi) {
symbol(&__fixdfti_windows_x86_64, "__fixdfti");
} else {
symbol(&__fixdfti, "__fixdfti");

View file

@ -1,10 +0,0 @@
const common = @import("./common.zig");
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
@export(&__fixhfdi, .{ .name = "__fixhfdi", .linkage = common.linkage, .visibility = common.visibility });
}
fn __fixhfdi(a: f16) callconv(.c) i64 {
return intFromFloat(i64, a);
}

View file

@ -1,10 +1,11 @@
const std = @import("std");
const builtin = @import("builtin");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat;
comptime {
@export(&__fixhfei, .{ .name = "__fixhfei", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixhfei, "__fixhfei");
}
pub fn __fixhfei(r: [*]u8, bits: usize, a: f16) callconv(.c) void {

View file

@ -1,10 +0,0 @@
const common = @import("./common.zig");
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
@export(&__fixhfsi, .{ .name = "__fixhfsi", .linkage = common.linkage, .visibility = common.visibility });
}
fn __fixhfsi(a: f16) callconv(.c) i32 {
return intFromFloat(i32, a);
}

View file

@ -1,21 +0,0 @@
const builtin = @import("builtin");
const common = @import("./common.zig");
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
if (common.want_windows_v2u64_abi) {
@export(&__fixhfti_windows_x86_64, .{ .name = "__fixhfti", .linkage = common.linkage, .visibility = common.visibility });
} else {
@export(&__fixhfti, .{ .name = "__fixhfti", .linkage = common.linkage, .visibility = common.visibility });
}
}
pub fn __fixhfti(a: f16) callconv(.c) i128 {
return intFromFloat(i128, a);
}
const v2u64 = @Vector(2, u64);
fn __fixhfti_windows_x86_64(a: f16) callconv(.c) v2u64 {
return @bitCast(intFromFloat(i128, a));
}

View file

@ -1,13 +1,13 @@
const builtin = @import("builtin");
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_aeabi) {
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_f2lz, "__aeabi_f2lz");
} else {
if (common.want_windows_arm_abi) {
if (compiler_rt.want_windows_arm_abi) {
symbol(&__fixsfdi, "__stoi64");
}
symbol(&__fixsfdi, "__fixsfdi");

View file

@ -1,10 +1,11 @@
const std = @import("std");
const builtin = @import("builtin");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat;
comptime {
@export(&__fixsfei, .{ .name = "__fixsfei", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixsfei, "__fixsfei");
}
pub fn __fixsfei(r: [*]u8, bits: usize, a: f32) callconv(.c) void {

View file

@ -1,11 +1,12 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
if (common.want_aeabi) {
@export(&__aeabi_f2iz, .{ .name = "__aeabi_f2iz", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_f2iz, "__aeabi_f2iz");
} else {
@export(&__fixsfsi, .{ .name = "__fixsfsi", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixsfsi, "__fixsfsi");
}
}

View file

@ -1,12 +1,13 @@
const builtin = @import("builtin");
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
if (common.want_windows_v2u64_abi) {
@export(&__fixsfti_windows_x86_64, .{ .name = "__fixsfti", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_windows_v2u64_abi) {
symbol(&__fixsfti_windows_x86_64, "__fixsfti");
} else {
@export(&__fixsfti, .{ .name = "__fixsfti", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixsfti, "__fixsfti");
}
}

View file

@ -1,11 +1,11 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_ppc_abi) {
if (compiler_rt.want_ppc_abi) {
symbol(&__fixtfdi, "__fixkfdi");
} else if (common.want_sparc_abi) {
} else if (compiler_rt.want_sparc_abi) {
symbol(&_Qp_qtox, "_Qp_qtox");
}
symbol(&__fixtfdi, "__fixtfdi");

View file

@ -1,10 +1,11 @@
const std = @import("std");
const builtin = @import("builtin");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat;
comptime {
@export(&__fixtfei, .{ .name = "__fixtfei", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixtfei, "__fixtfei");
}
pub fn __fixtfei(r: [*]u8, bits: usize, a: f128) callconv(.c) void {

View file

@ -1,11 +1,11 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = @import("../compiler_rt.zig").symbol;
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
if (common.want_ppc_abi) {
if (compiler_rt.want_ppc_abi) {
symbol(&__fixtfsi, "__fixkfsi");
} else if (common.want_sparc_abi) {
} else if (compiler_rt.want_sparc_abi) {
symbol(&_Qp_qtoi, "_Qp_qtoi");
}
symbol(&__fixtfsi, "__fixtfsi");

View file

@ -1,12 +1,12 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_windows_v2u64_abi) {
if (compiler_rt.want_windows_v2u64_abi) {
symbol(&__fixtfti_windows_x86_64, "__fixtfti");
} else {
if (common.want_ppc_abi)
if (compiler_rt.want_ppc_abi)
symbol(&__fixtfti, "__fixkfti");
symbol(&__fixtfti, "__fixtfti");
}

View file

@ -1,15 +1,16 @@
const builtin = @import("builtin");
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
if (common.want_aeabi) {
@export(&__aeabi_d2ulz, .{ .name = "__aeabi_d2ulz", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_d2ulz, "__aeabi_d2ulz");
} else {
if (common.want_windows_arm_abi) {
@export(&__fixunsdfdi, .{ .name = "__dtou64", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_windows_arm_abi) {
symbol(&__fixunsdfdi, "__dtou64");
}
@export(&__fixunsdfdi, .{ .name = "__fixunsdfdi", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixunsdfdi, "__fixunsdfdi");
}
}

View file

@ -1,11 +1,12 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
if (common.want_aeabi) {
@export(&__aeabi_d2uiz, .{ .name = "__aeabi_d2uiz", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_d2uiz, "__aeabi_d2uiz");
} else {
@export(&__fixunsdfsi, .{ .name = "__fixunsdfsi", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixunsdfsi, "__fixunsdfsi");
}
}

View file

@ -1,9 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = @import("../compiler_rt.zig").symbol;
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
if (common.want_windows_v2u64_abi) {
if (compiler_rt.want_windows_v2u64_abi) {
symbol(&__fixunsdfti_windows_x86_64, "__fixunsdfti");
} else {
symbol(&__fixunsdfti, "__fixunsdfti");

View file

@ -1,8 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
@export(&__fixunshfsi, .{ .name = "__fixunshfsi", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixunshfsi, "__fixunshfsi");
}
fn __fixunshfsi(a: f16) callconv(.c) u32 {

View file

@ -1,9 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_windows_v2u64_abi) {
if (compiler_rt.want_windows_v2u64_abi) {
symbol(&__fixunshfti_windows_x86_64, "__fixunshfti");
} else {
symbol(&__fixunshfti, "__fixunshfti");

View file

@ -1,15 +1,16 @@
const builtin = @import("builtin");
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
if (common.want_aeabi) {
@export(&__aeabi_f2ulz, .{ .name = "__aeabi_f2ulz", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_f2ulz, "__aeabi_f2ulz");
} else {
if (common.want_windows_arm_abi) {
@export(&__fixunssfdi, .{ .name = "__stou64", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_windows_arm_abi) {
symbol(&__fixunssfdi, "__stou64");
}
@export(&__fixunssfdi, .{ .name = "__fixunssfdi", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixunssfdi, "__fixunssfdi");
}
}

View file

@ -1,11 +1,12 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
if (common.want_aeabi) {
@export(&__aeabi_f2uiz, .{ .name = "__aeabi_f2uiz", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_f2uiz, "__aeabi_f2uiz");
} else {
@export(&__fixunssfsi, .{ .name = "__fixunssfsi", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixunssfsi, "__fixunssfsi");
}
}

View file

@ -1,10 +1,10 @@
const builtin = @import("builtin");
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_windows_v2u64_abi) {
if (compiler_rt.want_windows_v2u64_abi) {
symbol(&__fixunssfti_windows_x86_64, "__fixunssfti");
} else {
symbol(&__fixunssfti, "__fixunssfti");

View file

@ -1,13 +1,14 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
if (common.want_ppc_abi) {
@export(&__fixunstfdi, .{ .name = "__fixunskfdi", .linkage = common.linkage, .visibility = common.visibility });
} else if (common.want_sparc_abi) {
@export(&_Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_ppc_abi) {
symbol(&__fixunstfdi, "__fixunskfdi");
} else if (compiler_rt.want_sparc_abi) {
symbol(&_Qp_qtoux, "_Qp_qtoux");
}
@export(&__fixunstfdi, .{ .name = "__fixunstfdi", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixunstfdi, "__fixunstfdi");
}
pub fn __fixunstfdi(a: f128) callconv(.c) u64 {

View file

@ -1,13 +1,14 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
if (common.want_ppc_abi) {
@export(&__fixunstfsi, .{ .name = "__fixunskfsi", .linkage = common.linkage, .visibility = common.visibility });
} else if (common.want_sparc_abi) {
@export(&_Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_ppc_abi) {
symbol(&__fixunstfsi, "__fixunskfsi");
} else if (compiler_rt.want_sparc_abi) {
symbol(&_Qp_qtoui, "_Qp_qtoui");
}
@export(&__fixunstfsi, .{ .name = "__fixunstfsi", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixunstfsi, "__fixunstfsi");
}
pub fn __fixunstfsi(a: f128) callconv(.c) u32 {

View file

@ -1,14 +1,15 @@
const builtin = @import("builtin");
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
if (common.want_windows_v2u64_abi) {
@export(&__fixunstfti_windows_x86_64, .{ .name = "__fixunstfti", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_windows_v2u64_abi) {
symbol(&__fixunstfti_windows_x86_64, "__fixunstfti");
} else {
if (common.want_ppc_abi)
@export(&__fixunstfti, .{ .name = "__fixunskfti", .linkage = common.linkage, .visibility = common.visibility });
@export(&__fixunstfti, .{ .name = "__fixunstfti", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_ppc_abi)
symbol(&__fixunstfti, "__fixunskfti");
symbol(&__fixunstfti, "__fixunstfti");
}
}

View file

@ -1,8 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
@export(&__fixunsxfsi, .{ .name = "__fixunsxfsi", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixunsxfsi, "__fixunsxfsi");
}
fn __fixunsxfsi(a: f80) callconv(.c) u32 {

View file

@ -1,12 +1,13 @@
const builtin = @import("builtin");
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
if (common.want_windows_v2u64_abi) {
@export(&__fixunsxfti_windows_x86_64, .{ .name = "__fixunsxfti", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_windows_v2u64_abi) {
symbol(&__fixunsxfti_windows_x86_64, "__fixunsxfti");
} else {
@export(&__fixunsxfti, .{ .name = "__fixunsxfti", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixunsxfti, "__fixunsxfti");
}
}

View file

@ -1,10 +1,11 @@
const std = @import("std");
const builtin = @import("builtin");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat;
comptime {
@export(&__fixxfei, .{ .name = "__fixxfei", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixxfei, "__fixxfei");
}
pub fn __fixxfei(r: [*]u8, bits: usize, a: f80) callconv(.c) void {

View file

@ -1,8 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
comptime {
@export(&__fixxfsi, .{ .name = "__fixxfsi", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__fixxfsi, "__fixxfsi");
}
fn __fixxfsi(a: f80) callconv(.c) i32 {

View file

@ -1,23 +0,0 @@
const builtin = @import("builtin");
const common = @import("./common.zig");
const intFromFloat = @import("./int_from_float.zig").intFromFloat;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_windows_v2u64_abi) {
symbol(&__fixxfti_windows_x86_64, "__fixxfti");
} else {
symbol(&__fixxfti, "__fixxfti");
}
}
pub fn __fixxfti(a: f80) callconv(.c) i128 {
return intFromFloat(i128, a);
}
const v2u64 = @Vector(2, u64);
fn __fixxfti_windows_x86_64(a: f80) callconv(.c) v2u64 {
return @bitCast(intFromFloat(i128, a));
}

View file

@ -1,15 +1,16 @@
const builtin = @import("builtin");
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const floatFromInt = @import("./float_from_int.zig").floatFromInt;
comptime {
if (common.want_aeabi) {
@export(&__aeabi_l2d, .{ .name = "__aeabi_l2d", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_l2d, "__aeabi_l2d");
} else {
if (common.want_windows_arm_abi) {
@export(&__floatdidf, .{ .name = "__i64tod", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_windows_arm_abi) {
symbol(&__floatdidf, "__i64tod");
}
@export(&__floatdidf, .{ .name = "__floatdidf", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__floatdidf, "__floatdidf");
}
}

View file

@ -1,12 +1,12 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = @import("../compiler_rt.zig").symbol;
const floatFromInt = @import("./float_from_int.zig").floatFromInt;
comptime {
if (common.want_aeabi) {
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_l2f, "__aeabi_l2f");
} else {
if (common.want_windows_arm_abi) {
if (compiler_rt.want_windows_arm_abi) {
symbol(&__floatdisf, "__i64tos");
}
symbol(&__floatdisf, "__floatdisf");

View file

@ -1,11 +1,11 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const floatFromInt = @import("./float_from_int.zig").floatFromInt;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_ppc_abi) {
if (compiler_rt.want_ppc_abi) {
symbol(&__floatditf, "__floatdikf");
} else if (common.want_sparc_abi) {
} else if (compiler_rt.want_sparc_abi) {
symbol(&_Qp_xtoq, "_Qp_xtoq");
}
symbol(&__floatditf, "__floatditf");

View file

@ -1,10 +1,11 @@
const std = @import("std");
const builtin = @import("builtin");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;
comptime {
@export(&__floateihf, .{ .name = "__floateihf", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__floateihf, "__floateihf");
}
pub fn __floateihf(a: [*]const u8, bits: usize) callconv(.c) f16 {

View file

@ -1,10 +1,11 @@
const std = @import("std");
const builtin = @import("builtin");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;
comptime {
@export(&__floateisf, .{ .name = "__floateisf", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__floateisf, "__floateisf");
}
pub fn __floateisf(a: [*]const u8, bits: usize) callconv(.c) f32 {

View file

@ -1,10 +1,11 @@
const std = @import("std");
const builtin = @import("builtin");
const common = @import("common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;
comptime {
@export(&__floateitf, .{ .name = "__floateitf", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__floateitf, "__floateitf");
}
pub fn __floateitf(a: [*]const u8, bits: usize) callconv(.c) f128 {

View file

@ -1,11 +1,12 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const floatFromInt = @import("./float_from_int.zig").floatFromInt;
comptime {
if (common.want_aeabi) {
@export(&__aeabi_i2d, .{ .name = "__aeabi_i2d", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_i2d, "__aeabi_i2d");
} else {
@export(&__floatsidf, .{ .name = "__floatsidf", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__floatsidf, "__floatsidf");
}
}

View file

@ -1,8 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const floatFromInt = @import("./float_from_int.zig").floatFromInt;
comptime {
@export(&__floatsihf, .{ .name = "__floatsihf", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__floatsihf, "__floatsihf");
}
fn __floatsihf(a: i32) callconv(.c) f16 {

View file

@ -1,11 +1,12 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const floatFromInt = @import("./float_from_int.zig").floatFromInt;
comptime {
if (common.want_aeabi) {
@export(&__aeabi_i2f, .{ .name = "__aeabi_i2f", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_i2f, "__aeabi_i2f");
} else {
@export(&__floatsisf, .{ .name = "__floatsisf", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__floatsisf, "__floatsisf");
}
}

View file

@ -1,13 +1,14 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const floatFromInt = @import("./float_from_int.zig").floatFromInt;
comptime {
if (common.want_ppc_abi) {
@export(&__floatsitf, .{ .name = "__floatsikf", .linkage = common.linkage, .visibility = common.visibility });
} else if (common.want_sparc_abi) {
@export(&_Qp_itoq, .{ .name = "_Qp_itoq", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_ppc_abi) {
symbol(&__floatsitf, "__floatsikf");
} else if (compiler_rt.want_sparc_abi) {
symbol(&_Qp_itoq, "_Qp_itoq");
}
@export(&__floatsitf, .{ .name = "__floatsitf", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__floatsitf, "__floatsitf");
}
pub fn __floatsitf(a: i32) callconv(.c) f128 {

View file

@ -1,4 +1,4 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const floatFromInt = @import("./float_from_int.zig").floatFromInt;
const symbol = @import("../compiler_rt.zig").symbol;

View file

@ -1,9 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = @import("../compiler_rt.zig").symbol;
const floatFromInt = @import("./float_from_int.zig").floatFromInt;
comptime {
if (common.want_windows_v2u64_abi) {
if (compiler_rt.want_windows_v2u64_abi) {
symbol(&__floattidf_windows_x86_64, "__floattidf");
} else {
symbol(&__floattidf, "__floattidf");

View file

@ -1,12 +1,13 @@
const builtin = @import("builtin");
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const floatFromInt = @import("./float_from_int.zig").floatFromInt;
comptime {
if (common.want_windows_v2u64_abi) {
@export(&__floattihf_windows_x86_64, .{ .name = "__floattihf", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_windows_v2u64_abi) {
symbol(&__floattihf_windows_x86_64, "__floattihf");
} else {
@export(&__floattihf, .{ .name = "__floattihf", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__floattihf, "__floattihf");
}
}

View file

@ -1,9 +1,9 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const floatFromInt = @import("./float_from_int.zig").floatFromInt;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_windows_v2u64_abi) {
if (compiler_rt.want_windows_v2u64_abi) {
symbol(&__floattisf_windows_x86_64, "__floattisf");
} else {
symbol(&__floattisf, "__floattisf");

View file

@ -1,12 +1,12 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = @import("../compiler_rt.zig").symbol;
const floatFromInt = @import("./float_from_int.zig").floatFromInt;
comptime {
if (common.want_windows_v2u64_abi) {
if (compiler_rt.want_windows_v2u64_abi) {
symbol(&__floattitf_windows_x86_64, "__floattitf");
} else {
if (common.want_ppc_abi)
if (compiler_rt.want_ppc_abi)
symbol(&__floattitf, "__floattikf");
symbol(&__floattitf, "__floattitf");
}

View file

@ -1,12 +1,13 @@
const builtin = @import("builtin");
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const symbol = compiler_rt.symbol;
const floatFromInt = @import("./float_from_int.zig").floatFromInt;
comptime {
if (common.want_windows_v2u64_abi) {
@export(&__floattixf_windows_x86_64, .{ .name = "__floattixf", .linkage = common.linkage, .visibility = common.visibility });
if (compiler_rt.want_windows_v2u64_abi) {
symbol(&__floattixf_windows_x86_64, "__floattixf");
} else {
@export(&__floattixf, .{ .name = "__floattixf", .linkage = common.linkage, .visibility = common.visibility });
symbol(&__floattixf, "__floattixf");
}
}

View file

@ -1,12 +1,12 @@
const common = @import("./common.zig");
const compiler_rt = @import("../compiler_rt.zig");
const floatFromInt = @import("./float_from_int.zig").floatFromInt;
const symbol = @import("../compiler_rt.zig").symbol;
comptime {
if (common.want_aeabi) {
if (compiler_rt.want_aeabi) {
symbol(&__aeabi_ul2d, "__aeabi_ul2d");
} else {
if (common.want_windows_arm_abi) {
if (compiler_rt.want_windows_arm_abi) {
symbol(&__floatundidf, "__u64tod");
}
symbol(&__floatundidf, "__floatundidf");

Some files were not shown because too many files have changed in this diff Show more