authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-02-09 18:47:03-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-02-09 20:03:15-08:00
log74608293afa6d825c6482d2253eed28a89705351
tree8c88af9f9790d33cd6d9b74b3aecab1c2dcfcf2b
parent6c7814fabd5cc94dce13ed02e5313069be9af482

compiler_rt: common -> compiler_rt

use the "symbol" helper function in all exports move all declarations from common.zig to compiler_rt.zig flatten the tree structure somewhat (move contents of tiny files into parent files) No functional changes.

191 files changed, 1607 insertions(+), 1690 deletions(-)

lib/compiler_rt.zig+402-23
...@@ -1,5 +1,6 @@...@@ -1,5 +1,6 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const ofmt_c = builtin.object_format == .c;2const ofmt_c = builtin.object_format == .c;
3const native_endian = builtin.cpu.arch.endian();
34
4const std = @import("std");5const std = @import("std");
56
...@@ -57,13 +58,12 @@ comptime {...@@ -57,13 +58,12 @@ comptime {
57 _ = @import("compiler_rt/cmp.zig");58 _ = @import("compiler_rt/cmp.zig");
5859
59 _ = @import("compiler_rt/shift.zig");60 _ = @import("compiler_rt/shift.zig");
60 _ = @import("compiler_rt/negXi2.zig");61 symbol(&__negsi2, "__negsi2");
62 symbol(&__negdi2, "__negdi2");
63 symbol(&__negti2, "__negti2");
61 _ = @import("compiler_rt/int.zig");64 _ = @import("compiler_rt/int.zig");
62 _ = @import("compiler_rt/mulXi3.zig");65 _ = @import("compiler_rt/mulXi3.zig");
63 _ = @import("compiler_rt/divti3.zig");66 _ = @import("compiler_rt/udivmod.zig");
64 _ = @import("compiler_rt/udivti3.zig");
65 _ = @import("compiler_rt/modti3.zig");
66 _ = @import("compiler_rt/umodti3.zig");
6767
68 _ = @import("compiler_rt/absv.zig");68 _ = @import("compiler_rt/absv.zig");
69 _ = @import("compiler_rt/absvsi2.zig");69 _ = @import("compiler_rt/absvsi2.zig");
...@@ -108,9 +108,6 @@ comptime {...@@ -108,9 +108,6 @@ comptime {
108 _ = @import("compiler_rt/trunctfxf2.zig");108 _ = @import("compiler_rt/trunctfxf2.zig");
109109
110 _ = @import("compiler_rt/int_from_float.zig");110 _ = @import("compiler_rt/int_from_float.zig");
111 _ = @import("compiler_rt/fixhfsi.zig");
112 _ = @import("compiler_rt/fixhfdi.zig");
113 _ = @import("compiler_rt/fixhfti.zig");
114 _ = @import("compiler_rt/fixhfei.zig");111 _ = @import("compiler_rt/fixhfei.zig");
115 _ = @import("compiler_rt/fixsfsi.zig");112 _ = @import("compiler_rt/fixsfsi.zig");
116 _ = @import("compiler_rt/fixsfdi.zig");113 _ = @import("compiler_rt/fixsfdi.zig");
...@@ -126,8 +123,8 @@ comptime {...@@ -126,8 +123,8 @@ comptime {
126 _ = @import("compiler_rt/fixtfei.zig");123 _ = @import("compiler_rt/fixtfei.zig");
127 _ = @import("compiler_rt/fixxfsi.zig");124 _ = @import("compiler_rt/fixxfsi.zig");
128 _ = @import("compiler_rt/fixxfdi.zig");125 _ = @import("compiler_rt/fixxfdi.zig");
129 _ = @import("compiler_rt/fixxfti.zig");
130 _ = @import("compiler_rt/fixxfei.zig");126 _ = @import("compiler_rt/fixxfei.zig");
127
131 _ = @import("compiler_rt/fixunshfsi.zig");128 _ = @import("compiler_rt/fixunshfsi.zig");
132 _ = @import("compiler_rt/fixunshfdi.zig");129 _ = @import("compiler_rt/fixunshfdi.zig");
133 _ = @import("compiler_rt/fixunshfti.zig");130 _ = @import("compiler_rt/fixunshfti.zig");
...@@ -193,16 +190,10 @@ comptime {...@@ -193,16 +190,10 @@ comptime {
193190
194 // comparison191 // comparison
195 _ = @import("compiler_rt/comparef.zig");192 _ = @import("compiler_rt/comparef.zig");
196 _ = @import("compiler_rt/cmphf2.zig");
197 _ = @import("compiler_rt/cmpsf2.zig");
198 _ = @import("compiler_rt/cmpdf2.zig");193 _ = @import("compiler_rt/cmpdf2.zig");
199 _ = @import("compiler_rt/cmptf2.zig");194 _ = @import("compiler_rt/cmptf2.zig");
200 _ = @import("compiler_rt/cmpxf2.zig");195 _ = @import("compiler_rt/cmpxf2.zig");
201 _ = @import("compiler_rt/unordhf2.zig");
202 _ = @import("compiler_rt/unordsf2.zig");
203 _ = @import("compiler_rt/unorddf2.zig");196 _ = @import("compiler_rt/unorddf2.zig");
204 _ = @import("compiler_rt/unordxf2.zig");
205 _ = @import("compiler_rt/unordtf2.zig");
206 _ = @import("compiler_rt/gehf2.zig");197 _ = @import("compiler_rt/gehf2.zig");
207 _ = @import("compiler_rt/gesf2.zig");198 _ = @import("compiler_rt/gesf2.zig");
208 _ = @import("compiler_rt/gedf2.zig");199 _ = @import("compiler_rt/gedf2.zig");
...@@ -236,11 +227,17 @@ comptime {...@@ -236,11 +227,17 @@ comptime {
236 _ = @import("compiler_rt/divxf3.zig");227 _ = @import("compiler_rt/divxf3.zig");
237 _ = @import("compiler_rt/divtf3.zig");228 _ = @import("compiler_rt/divtf3.zig");
238229
239 _ = @import("compiler_rt/neghf2.zig");230 symbol(&__neghf2, "__neghf2");
240 _ = @import("compiler_rt/negsf2.zig");231 if (want_aeabi) {
241 _ = @import("compiler_rt/negdf2.zig");232 symbol(&__aeabi_fneg, "__aeabi_fneg");
242 _ = @import("compiler_rt/negtf2.zig");233 symbol(&__aeabi_dneg, "__aeabi_dneg");
243 _ = @import("compiler_rt/negxf2.zig");234 } else {
235 symbol(&__negsf2, "__negsf2");
236 symbol(&__negdf2, "__negdf2");
237 }
238 if (want_ppc_abi) symbol(&__negtf2, "__negkf2");
239 symbol(&__negtf2, "__negtf2");
240 symbol(&__negxf2, "__negxf2");
244241
245 // other242 // other
246 _ = @import("compiler_rt/powiXf2.zig");243 _ = @import("compiler_rt/powiXf2.zig");
...@@ -281,7 +278,6 @@ comptime {...@@ -281,7 +278,6 @@ comptime {
281 // BigInt. Alphabetically sorted.278 // BigInt. Alphabetically sorted.
282 _ = @import("compiler_rt/divmodei4.zig");279 _ = @import("compiler_rt/divmodei4.zig");
283 _ = @import("compiler_rt/udivmodei4.zig");280 _ = @import("compiler_rt/udivmodei4.zig");
284 _ = @import("compiler_rt/udivmodti4.zig");
285281
286 // extra282 // extra
287 _ = @import("compiler_rt/os_version_check.zig");283 _ = @import("compiler_rt/os_version_check.zig");
...@@ -302,10 +298,13 @@ comptime {...@@ -302,10 +298,13 @@ comptime {
302 }298 }
303299
304 _ = @import("compiler_rt/memcpy.zig");300 _ = @import("compiler_rt/memcpy.zig");
305 _ = @import("compiler_rt/memset.zig");301 if (!ofmt_c) {
302 symbol(&memset, "memset");
303 symbol(&__memset, "__memset");
304 }
306 _ = @import("compiler_rt/memmove.zig");305 _ = @import("compiler_rt/memmove.zig");
307 symbol(&memcmp, "memcmp");306 symbol(&memcmp, "memcmp");
308 _ = @import("compiler_rt/bcmp.zig");307 symbol(&bcmp, "bcmp");
309 _ = @import("compiler_rt/ssp.zig");308 _ = @import("compiler_rt/ssp.zig");
310 symbol(&strlen, "strlen");309 symbol(&strlen, "strlen");
311 }310 }
...@@ -345,3 +344,383 @@ test "memcmp" {...@@ -345,3 +344,383 @@ test "memcmp" {
345 try std.testing.expect(memcmp(arr0, arr4, 3) < 0);344 try std.testing.expect(memcmp(arr0, arr4, 3) < 0);
346 try std.testing.expect(memcmp(arr4, arr0, 3) > 0);345 try std.testing.expect(memcmp(arr4, arr0, 3) > 0);
347}346}
347
348pub const PreferredLoadStoreElement = element: {
349 if (std.simd.suggestVectorLength(u8)) |vec_size| {
350 const Vec = @Vector(vec_size, u8);
351
352 if (@sizeOf(Vec) == vec_size and std.math.isPowerOfTwo(vec_size)) {
353 break :element Vec;
354 }
355 }
356 break :element usize;
357};
358
359pub const want_aeabi = switch (builtin.abi) {
360 .eabi,
361 .eabihf,
362 .musleabi,
363 .musleabihf,
364 .gnueabi,
365 .gnueabihf,
366 .android,
367 .androideabi,
368 => switch (builtin.cpu.arch) {
369 .arm, .armeb, .thumb, .thumbeb => true,
370 else => false,
371 },
372 else => false,
373};
374
375/// These functions are required on Windows on ARM. They are provided by MSVC libc, but in libc-less
376/// builds or when linking MinGW libc they are our responsibility.
377/// Temporarily used for thumb-uefi until https://github.com/ziglang/zig/issues/21630 is addressed.
378pub const want_windows_arm_abi = e: {
379 if (!builtin.cpu.arch.isArm()) break :e false;
380 switch (builtin.os.tag) {
381 .windows, .uefi => {},
382 else => break :e false,
383 }
384 // The ABI is needed, but it's only our reponsibility if libc won't provide it.
385 break :e builtin.abi.isGnu() or !builtin.link_libc;
386};
387
388/// These functions are required by on Windows on x86 on some ABIs. They are provided by MSVC libc,
389/// but in libc-less builds they are our responsibility.
390pub const want_windows_x86_msvc_abi = e: {
391 if (builtin.cpu.arch != .x86) break :e false;
392 if (builtin.os.tag != .windows) break :e false;
393 switch (builtin.abi) {
394 .none, .msvc, .itanium => {},
395 else => break :e false,
396 }
397 // The ABI is needed, but it's only our responsibility if libc won't provide it.
398 break :e !builtin.link_libc;
399};
400
401pub const want_ppc_abi = builtin.cpu.arch.isPowerPC();
402
403pub const want_float_exceptions = !builtin.cpu.arch.isWasm();
404
405// Libcalls that involve u128 on Windows x86-64 are expected by LLVM to use the
406// calling convention of @Vector(2, u64), rather than what's standard.
407pub const want_windows_v2u64_abi = builtin.os.tag == .windows and builtin.cpu.arch == .x86_64 and !ofmt_c;
408
409/// This governs whether to use these symbol names for f16/f32 conversions
410/// rather than the standard names:
411/// * __gnu_f2h_ieee
412/// * __gnu_h2f_ieee
413/// Known correct configurations:
414/// x86_64-freestanding-none => true
415/// x86_64-linux-none => true
416/// x86_64-linux-gnu => true
417/// x86_64-linux-musl => true
418/// x86_64-linux-eabi => true
419/// arm-linux-musleabihf => true
420/// arm-linux-gnueabihf => true
421/// arm-linux-eabihf => false
422/// wasm32-wasi-musl => false
423/// wasm32-freestanding-none => false
424/// x86_64-windows-gnu => true
425/// x86_64-windows-msvc => true
426/// any-macos-any => false
427pub const gnu_f16_abi = switch (builtin.cpu.arch) {
428 .wasm32,
429 .wasm64,
430 .riscv64,
431 .riscv64be,
432 .riscv32,
433 .riscv32be,
434 => false,
435
436 .x86, .x86_64 => true,
437
438 .arm, .armeb, .thumb, .thumbeb => switch (builtin.abi) {
439 .eabi, .eabihf => false,
440 else => true,
441 },
442
443 else => !builtin.os.tag.isDarwin(),
444};
445
446pub const want_sparc_abi = builtin.cpu.arch.isSPARC();
447
448/// This seems to mostly correspond to `clang::TargetInfo::HasFloat16`.
449pub fn F16T(comptime OtherType: type) type {
450 return switch (builtin.cpu.arch) {
451 .amdgcn,
452 .arm,
453 .armeb,
454 .thumb,
455 .thumbeb,
456 .aarch64,
457 .aarch64_be,
458 .hexagon,
459 .loongarch32,
460 .loongarch64,
461 .nvptx,
462 .nvptx64,
463 .riscv32,
464 .riscv32be,
465 .riscv64,
466 .riscv64be,
467 .s390x,
468 .spirv32,
469 .spirv64,
470 => f16,
471 .x86, .x86_64 => if (builtin.target.os.tag.isDarwin()) switch (OtherType) {
472 // Starting with LLVM 16, Darwin uses different abi for f16
473 // depending on the type of the other return/argument..???
474 f32, f64 => u16,
475 f80, f128 => f16,
476 else => unreachable,
477 } else f16,
478 else => u16,
479 };
480}
481
482pub fn wideMultiply(comptime Z: type, a: Z, b: Z, hi: *Z, lo: *Z) void {
483 switch (Z) {
484 u16 => {
485 // 16x16 --> 32 bit multiply
486 const product = @as(u32, a) * @as(u32, b);
487 hi.* = @intCast(product >> 16);
488 lo.* = @truncate(product);
489 },
490 u32 => {
491 // 32x32 --> 64 bit multiply
492 const product = @as(u64, a) * @as(u64, b);
493 hi.* = @truncate(product >> 32);
494 lo.* = @truncate(product);
495 },
496 u64 => {
497 const S = struct {
498 fn loWord(x: u64) u64 {
499 return @as(u32, @truncate(x));
500 }
501 fn hiWord(x: u64) u64 {
502 return @as(u32, @truncate(x >> 32));
503 }
504 };
505 // 64x64 -> 128 wide multiply for platforms that don't have such an operation;
506 // many 64-bit platforms have this operation, but they tend to have hardware
507 // floating-point, so we don't bother with a special case for them here.
508 // Each of the component 32x32 -> 64 products
509 const plolo: u64 = S.loWord(a) * S.loWord(b);
510 const plohi: u64 = S.loWord(a) * S.hiWord(b);
511 const philo: u64 = S.hiWord(a) * S.loWord(b);
512 const phihi: u64 = S.hiWord(a) * S.hiWord(b);
513 // Sum terms that contribute to lo in a way that allows us to get the carry
514 const r0: u64 = S.loWord(plolo);
515 const r1: u64 = S.hiWord(plolo) +% S.loWord(plohi) +% S.loWord(philo);
516 lo.* = r0 +% (r1 << 32);
517 // Sum terms contributing to hi with the carry from lo
518 hi.* = S.hiWord(plohi) +% S.hiWord(philo) +% S.hiWord(r1) +% phihi;
519 },
520 u128 => {
521 const Word_LoMask: u64 = 0x00000000ffffffff;
522 const Word_HiMask: u64 = 0xffffffff00000000;
523 const Word_FullMask: u64 = 0xffffffffffffffff;
524 const S = struct {
525 fn Word_1(x: u128) u64 {
526 return @as(u32, @truncate(x >> 96));
527 }
528 fn Word_2(x: u128) u64 {
529 return @as(u32, @truncate(x >> 64));
530 }
531 fn Word_3(x: u128) u64 {
532 return @as(u32, @truncate(x >> 32));
533 }
534 fn Word_4(x: u128) u64 {
535 return @as(u32, @truncate(x));
536 }
537 };
538 // 128x128 -> 256 wide multiply for platforms that don't have such an operation;
539 // many 64-bit platforms have this operation, but they tend to have hardware
540 // floating-point, so we don't bother with a special case for them here.
541
542 const product11: u64 = S.Word_1(a) * S.Word_1(b);
543 const product12: u64 = S.Word_1(a) * S.Word_2(b);
544 const product13: u64 = S.Word_1(a) * S.Word_3(b);
545 const product14: u64 = S.Word_1(a) * S.Word_4(b);
546 const product21: u64 = S.Word_2(a) * S.Word_1(b);
547 const product22: u64 = S.Word_2(a) * S.Word_2(b);
548 const product23: u64 = S.Word_2(a) * S.Word_3(b);
549 const product24: u64 = S.Word_2(a) * S.Word_4(b);
550 const product31: u64 = S.Word_3(a) * S.Word_1(b);
551 const product32: u64 = S.Word_3(a) * S.Word_2(b);
552 const product33: u64 = S.Word_3(a) * S.Word_3(b);
553 const product34: u64 = S.Word_3(a) * S.Word_4(b);
554 const product41: u64 = S.Word_4(a) * S.Word_1(b);
555 const product42: u64 = S.Word_4(a) * S.Word_2(b);
556 const product43: u64 = S.Word_4(a) * S.Word_3(b);
557 const product44: u64 = S.Word_4(a) * S.Word_4(b);
558
559 const sum0: u128 = @as(u128, product44);
560 const sum1: u128 = @as(u128, product34) +%
561 @as(u128, product43);
562 const sum2: u128 = @as(u128, product24) +%
563 @as(u128, product33) +%
564 @as(u128, product42);
565 const sum3: u128 = @as(u128, product14) +%
566 @as(u128, product23) +%
567 @as(u128, product32) +%
568 @as(u128, product41);
569 const sum4: u128 = @as(u128, product13) +%
570 @as(u128, product22) +%
571 @as(u128, product31);
572 const sum5: u128 = @as(u128, product12) +%
573 @as(u128, product21);
574 const sum6: u128 = @as(u128, product11);
575
576 const r0: u128 = (sum0 & Word_FullMask) +%
577 ((sum1 & Word_LoMask) << 32);
578 const r1: u128 = (sum0 >> 64) +%
579 ((sum1 >> 32) & Word_FullMask) +%
580 (sum2 & Word_FullMask) +%
581 ((sum3 << 32) & Word_HiMask);
582
583 lo.* = r0 +% (r1 << 64);
584 hi.* = (r1 >> 64) +%
585 (sum1 >> 96) +%
586 (sum2 >> 64) +%
587 (sum3 >> 32) +%
588 sum4 +%
589 (sum5 << 32) +%
590 (sum6 << 64);
591 },
592 else => @compileError("unsupported"),
593 }
594}
595
596pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeInfo(T).float.bits)) i32 {
597 const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
598 const integerBit = @as(Z, 1) << std.math.floatFractionalBits(T);
599
600 const shift = @clz(significand.*) - @clz(integerBit);
601 significand.* <<= @as(std.math.Log2Int(Z), @intCast(shift));
602 return @as(i32, 1) - shift;
603}
604
605pub inline fn fneg(a: anytype) @TypeOf(a) {
606 const F = @TypeOf(a);
607 const bits = @typeInfo(F).float.bits;
608 const U = @Int(.unsigned, bits);
609 const sign_bit_mask = @as(U, 1) << (bits - 1);
610 const negated = @as(U, @bitCast(a)) ^ sign_bit_mask;
611 return @bitCast(negated);
612}
613
614fn __negxf2(a: f80) callconv(.c) f80 {
615 return fneg(a);
616}
617
618fn __neghf2(a: f16) callconv(.c) f16 {
619 return fneg(a);
620}
621
622fn __negdf2(a: f64) callconv(.c) f64 {
623 return fneg(a);
624}
625
626fn __aeabi_dneg(a: f64) callconv(.{ .arm_aapcs = .{} }) f64 {
627 return fneg(a);
628}
629
630fn __negtf2(a: f128) callconv(.c) f128 {
631 return fneg(a);
632}
633
634fn __negsf2(a: f32) callconv(.c) f32 {
635 return fneg(a);
636}
637
638fn __aeabi_fneg(a: f32) callconv(.{ .arm_aapcs = .{} }) f32 {
639 return fneg(a);
640}
641
642/// Allows to access underlying bits as two equally sized lower and higher
643/// signed or unsigned integers.
644pub fn HalveInt(comptime T: type, comptime signed_half: bool) type {
645 return extern union {
646 pub const bits = @divExact(@typeInfo(T).int.bits, 2);
647 pub const HalfTU = std.meta.Int(.unsigned, bits);
648 pub const HalfTS = std.meta.Int(.signed, bits);
649 pub const HalfT = if (signed_half) HalfTS else HalfTU;
650
651 all: T,
652 s: if (native_endian == .little)
653 extern struct { low: HalfT, high: HalfT }
654 else
655 extern struct { high: HalfT, low: HalfT },
656 };
657}
658
659pub fn __negsi2(a: i32) callconv(.c) i32 {
660 return negXi2(i32, a);
661}
662
663pub fn __negdi2(a: i64) callconv(.c) i64 {
664 return negXi2(i64, a);
665}
666
667pub fn __negti2(a: i128) callconv(.c) i128 {
668 return negXi2(i128, a);
669}
670
671inline fn negXi2(comptime T: type, a: T) T {
672 return -a;
673}
674
675pub fn memset(dest: ?[*]u8, c: u8, len: usize) callconv(.c) ?[*]u8 {
676 @setRuntimeSafety(false);
677
678 if (len != 0) {
679 var d = dest.?;
680 var n = len;
681 while (true) {
682 d[0] = c;
683 n -= 1;
684 if (n == 0) break;
685 d += 1;
686 }
687 }
688
689 return dest;
690}
691
692pub fn __memset(dest: ?[*]u8, c: u8, n: usize, dest_n: usize) callconv(.c) ?[*]u8 {
693 if (dest_n < n)
694 @panic("buffer overflow");
695 return memset(dest, c, n);
696}
697
698pub fn bcmp(vl: [*]allowzero const u8, vr: [*]allowzero const u8, n: usize) callconv(.c) c_int {
699 @setRuntimeSafety(false);
700
701 var index: usize = 0;
702 while (index != n) : (index += 1) {
703 if (vl[index] != vr[index]) {
704 return 1;
705 }
706 }
707
708 return 0;
709}
710
711test "bcmp" {
712 const base_arr = &[_]u8{ 1, 1, 1 };
713 const arr1 = &[_]u8{ 1, 1, 1 };
714 const arr2 = &[_]u8{ 1, 0, 1 };
715 const arr3 = &[_]u8{ 1, 2, 1 };
716
717 try std.testing.expect(bcmp(base_arr[0..], arr1[0..], base_arr.len) == 0);
718 try std.testing.expect(bcmp(base_arr[0..], arr2[0..], base_arr.len) != 0);
719 try std.testing.expect(bcmp(base_arr[0..], arr3[0..], base_arr.len) != 0);
720}
721
722test {
723 _ = @import("compiler_rt/negsi2_test.zig");
724 _ = @import("compiler_rt/negdi2_test.zig");
725 _ = @import("compiler_rt/negti2_test.zig");
726}
lib/compiler_rt/aarch64_outline_atomics.zig+102-101
...@@ -1,7 +1,8 @@...@@ -1,7 +1,8 @@
1//! This file is generated by tools/gen_outline_atomics.zig.1//! This file is generated by tools/gen_outline_atomics.zig.
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const std = @import("std");3const std = @import("std");
4const common = @import("common.zig");4const compiler_rt = @import("../compiler_rt.zig");
5const symbol = compiler_rt.symbol;
5const always_has_lse = builtin.cpu.has(.aarch64, .lse);6const always_has_lse = builtin.cpu.has(.aarch64, .lse);
67
7/// This default is overridden at runtime after inspecting CPU properties.8/// This default is overridden at runtime after inspecting CPU properties.
...@@ -2024,104 +2025,104 @@ fn __aarch64_cas16_acq_rel() align(16) callconv(.naked) void {...@@ -2024,104 +2025,104 @@ fn __aarch64_cas16_acq_rel() align(16) callconv(.naked) void {
2024}2025}
20252026
2026comptime {2027comptime {
2027 @export(&__aarch64_cas1_relax, .{ .name = "__aarch64_cas1_relax", .linkage = common.linkage, .visibility = common.visibility });2028 symbol(&__aarch64_cas1_relax, "__aarch64_cas1_relax");
2028 @export(&__aarch64_swp1_relax, .{ .name = "__aarch64_swp1_relax", .linkage = common.linkage, .visibility = common.visibility });2029 symbol(&__aarch64_swp1_relax, "__aarch64_swp1_relax");
2029 @export(&__aarch64_ldadd1_relax, .{ .name = "__aarch64_ldadd1_relax", .linkage = common.linkage, .visibility = common.visibility });2030 symbol(&__aarch64_ldadd1_relax, "__aarch64_ldadd1_relax");
2030 @export(&__aarch64_ldclr1_relax, .{ .name = "__aarch64_ldclr1_relax", .linkage = common.linkage, .visibility = common.visibility });2031 symbol(&__aarch64_ldclr1_relax, "__aarch64_ldclr1_relax");
2031 @export(&__aarch64_ldeor1_relax, .{ .name = "__aarch64_ldeor1_relax", .linkage = common.linkage, .visibility = common.visibility });2032 symbol(&__aarch64_ldeor1_relax, "__aarch64_ldeor1_relax");
2032 @export(&__aarch64_ldset1_relax, .{ .name = "__aarch64_ldset1_relax", .linkage = common.linkage, .visibility = common.visibility });2033 symbol(&__aarch64_ldset1_relax, "__aarch64_ldset1_relax");
2033 @export(&__aarch64_cas1_acq, .{ .name = "__aarch64_cas1_acq", .linkage = common.linkage, .visibility = common.visibility });2034 symbol(&__aarch64_cas1_acq, "__aarch64_cas1_acq");
2034 @export(&__aarch64_swp1_acq, .{ .name = "__aarch64_swp1_acq", .linkage = common.linkage, .visibility = common.visibility });2035 symbol(&__aarch64_swp1_acq, "__aarch64_swp1_acq");
2035 @export(&__aarch64_ldadd1_acq, .{ .name = "__aarch64_ldadd1_acq", .linkage = common.linkage, .visibility = common.visibility });2036 symbol(&__aarch64_ldadd1_acq, "__aarch64_ldadd1_acq");
2036 @export(&__aarch64_ldclr1_acq, .{ .name = "__aarch64_ldclr1_acq", .linkage = common.linkage, .visibility = common.visibility });2037 symbol(&__aarch64_ldclr1_acq, "__aarch64_ldclr1_acq");
2037 @export(&__aarch64_ldeor1_acq, .{ .name = "__aarch64_ldeor1_acq", .linkage = common.linkage, .visibility = common.visibility });2038 symbol(&__aarch64_ldeor1_acq, "__aarch64_ldeor1_acq");
2038 @export(&__aarch64_ldset1_acq, .{ .name = "__aarch64_ldset1_acq", .linkage = common.linkage, .visibility = common.visibility });2039 symbol(&__aarch64_ldset1_acq, "__aarch64_ldset1_acq");
2039 @export(&__aarch64_cas1_rel, .{ .name = "__aarch64_cas1_rel", .linkage = common.linkage, .visibility = common.visibility });2040 symbol(&__aarch64_cas1_rel, "__aarch64_cas1_rel");
2040 @export(&__aarch64_swp1_rel, .{ .name = "__aarch64_swp1_rel", .linkage = common.linkage, .visibility = common.visibility });2041 symbol(&__aarch64_swp1_rel, "__aarch64_swp1_rel");
2041 @export(&__aarch64_ldadd1_rel, .{ .name = "__aarch64_ldadd1_rel", .linkage = common.linkage, .visibility = common.visibility });2042 symbol(&__aarch64_ldadd1_rel, "__aarch64_ldadd1_rel");
2042 @export(&__aarch64_ldclr1_rel, .{ .name = "__aarch64_ldclr1_rel", .linkage = common.linkage, .visibility = common.visibility });2043 symbol(&__aarch64_ldclr1_rel, "__aarch64_ldclr1_rel");
2043 @export(&__aarch64_ldeor1_rel, .{ .name = "__aarch64_ldeor1_rel", .linkage = common.linkage, .visibility = common.visibility });2044 symbol(&__aarch64_ldeor1_rel, "__aarch64_ldeor1_rel");
2044 @export(&__aarch64_ldset1_rel, .{ .name = "__aarch64_ldset1_rel", .linkage = common.linkage, .visibility = common.visibility });2045 symbol(&__aarch64_ldset1_rel, "__aarch64_ldset1_rel");
2045 @export(&__aarch64_cas1_acq_rel, .{ .name = "__aarch64_cas1_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2046 symbol(&__aarch64_cas1_acq_rel, "__aarch64_cas1_acq_rel");
2046 @export(&__aarch64_swp1_acq_rel, .{ .name = "__aarch64_swp1_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2047 symbol(&__aarch64_swp1_acq_rel, "__aarch64_swp1_acq_rel");
2047 @export(&__aarch64_ldadd1_acq_rel, .{ .name = "__aarch64_ldadd1_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2048 symbol(&__aarch64_ldadd1_acq_rel, "__aarch64_ldadd1_acq_rel");
2048 @export(&__aarch64_ldclr1_acq_rel, .{ .name = "__aarch64_ldclr1_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2049 symbol(&__aarch64_ldclr1_acq_rel, "__aarch64_ldclr1_acq_rel");
2049 @export(&__aarch64_ldeor1_acq_rel, .{ .name = "__aarch64_ldeor1_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2050 symbol(&__aarch64_ldeor1_acq_rel, "__aarch64_ldeor1_acq_rel");
2050 @export(&__aarch64_ldset1_acq_rel, .{ .name = "__aarch64_ldset1_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2051 symbol(&__aarch64_ldset1_acq_rel, "__aarch64_ldset1_acq_rel");
2051 @export(&__aarch64_cas2_relax, .{ .name = "__aarch64_cas2_relax", .linkage = common.linkage, .visibility = common.visibility });2052 symbol(&__aarch64_cas2_relax, "__aarch64_cas2_relax");
2052 @export(&__aarch64_swp2_relax, .{ .name = "__aarch64_swp2_relax", .linkage = common.linkage, .visibility = common.visibility });2053 symbol(&__aarch64_swp2_relax, "__aarch64_swp2_relax");
2053 @export(&__aarch64_ldadd2_relax, .{ .name = "__aarch64_ldadd2_relax", .linkage = common.linkage, .visibility = common.visibility });2054 symbol(&__aarch64_ldadd2_relax, "__aarch64_ldadd2_relax");
2054 @export(&__aarch64_ldclr2_relax, .{ .name = "__aarch64_ldclr2_relax", .linkage = common.linkage, .visibility = common.visibility });2055 symbol(&__aarch64_ldclr2_relax, "__aarch64_ldclr2_relax");
2055 @export(&__aarch64_ldeor2_relax, .{ .name = "__aarch64_ldeor2_relax", .linkage = common.linkage, .visibility = common.visibility });2056 symbol(&__aarch64_ldeor2_relax, "__aarch64_ldeor2_relax");
2056 @export(&__aarch64_ldset2_relax, .{ .name = "__aarch64_ldset2_relax", .linkage = common.linkage, .visibility = common.visibility });2057 symbol(&__aarch64_ldset2_relax, "__aarch64_ldset2_relax");
2057 @export(&__aarch64_cas2_acq, .{ .name = "__aarch64_cas2_acq", .linkage = common.linkage, .visibility = common.visibility });2058 symbol(&__aarch64_cas2_acq, "__aarch64_cas2_acq");
2058 @export(&__aarch64_swp2_acq, .{ .name = "__aarch64_swp2_acq", .linkage = common.linkage, .visibility = common.visibility });2059 symbol(&__aarch64_swp2_acq, "__aarch64_swp2_acq");
2059 @export(&__aarch64_ldadd2_acq, .{ .name = "__aarch64_ldadd2_acq", .linkage = common.linkage, .visibility = common.visibility });2060 symbol(&__aarch64_ldadd2_acq, "__aarch64_ldadd2_acq");
2060 @export(&__aarch64_ldclr2_acq, .{ .name = "__aarch64_ldclr2_acq", .linkage = common.linkage, .visibility = common.visibility });2061 symbol(&__aarch64_ldclr2_acq, "__aarch64_ldclr2_acq");
2061 @export(&__aarch64_ldeor2_acq, .{ .name = "__aarch64_ldeor2_acq", .linkage = common.linkage, .visibility = common.visibility });2062 symbol(&__aarch64_ldeor2_acq, "__aarch64_ldeor2_acq");
2062 @export(&__aarch64_ldset2_acq, .{ .name = "__aarch64_ldset2_acq", .linkage = common.linkage, .visibility = common.visibility });2063 symbol(&__aarch64_ldset2_acq, "__aarch64_ldset2_acq");
2063 @export(&__aarch64_cas2_rel, .{ .name = "__aarch64_cas2_rel", .linkage = common.linkage, .visibility = common.visibility });2064 symbol(&__aarch64_cas2_rel, "__aarch64_cas2_rel");
2064 @export(&__aarch64_swp2_rel, .{ .name = "__aarch64_swp2_rel", .linkage = common.linkage, .visibility = common.visibility });2065 symbol(&__aarch64_swp2_rel, "__aarch64_swp2_rel");
2065 @export(&__aarch64_ldadd2_rel, .{ .name = "__aarch64_ldadd2_rel", .linkage = common.linkage, .visibility = common.visibility });2066 symbol(&__aarch64_ldadd2_rel, "__aarch64_ldadd2_rel");
2066 @export(&__aarch64_ldclr2_rel, .{ .name = "__aarch64_ldclr2_rel", .linkage = common.linkage, .visibility = common.visibility });2067 symbol(&__aarch64_ldclr2_rel, "__aarch64_ldclr2_rel");
2067 @export(&__aarch64_ldeor2_rel, .{ .name = "__aarch64_ldeor2_rel", .linkage = common.linkage, .visibility = common.visibility });2068 symbol(&__aarch64_ldeor2_rel, "__aarch64_ldeor2_rel");
2068 @export(&__aarch64_ldset2_rel, .{ .name = "__aarch64_ldset2_rel", .linkage = common.linkage, .visibility = common.visibility });2069 symbol(&__aarch64_ldset2_rel, "__aarch64_ldset2_rel");
2069 @export(&__aarch64_cas2_acq_rel, .{ .name = "__aarch64_cas2_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2070 symbol(&__aarch64_cas2_acq_rel, "__aarch64_cas2_acq_rel");
2070 @export(&__aarch64_swp2_acq_rel, .{ .name = "__aarch64_swp2_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2071 symbol(&__aarch64_swp2_acq_rel, "__aarch64_swp2_acq_rel");
2071 @export(&__aarch64_ldadd2_acq_rel, .{ .name = "__aarch64_ldadd2_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2072 symbol(&__aarch64_ldadd2_acq_rel, "__aarch64_ldadd2_acq_rel");
2072 @export(&__aarch64_ldclr2_acq_rel, .{ .name = "__aarch64_ldclr2_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2073 symbol(&__aarch64_ldclr2_acq_rel, "__aarch64_ldclr2_acq_rel");
2073 @export(&__aarch64_ldeor2_acq_rel, .{ .name = "__aarch64_ldeor2_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2074 symbol(&__aarch64_ldeor2_acq_rel, "__aarch64_ldeor2_acq_rel");
2074 @export(&__aarch64_ldset2_acq_rel, .{ .name = "__aarch64_ldset2_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2075 symbol(&__aarch64_ldset2_acq_rel, "__aarch64_ldset2_acq_rel");
2075 @export(&__aarch64_cas4_relax, .{ .name = "__aarch64_cas4_relax", .linkage = common.linkage, .visibility = common.visibility });2076 symbol(&__aarch64_cas4_relax, "__aarch64_cas4_relax");
2076 @export(&__aarch64_swp4_relax, .{ .name = "__aarch64_swp4_relax", .linkage = common.linkage, .visibility = common.visibility });2077 symbol(&__aarch64_swp4_relax, "__aarch64_swp4_relax");
2077 @export(&__aarch64_ldadd4_relax, .{ .name = "__aarch64_ldadd4_relax", .linkage = common.linkage, .visibility = common.visibility });2078 symbol(&__aarch64_ldadd4_relax, "__aarch64_ldadd4_relax");
2078 @export(&__aarch64_ldclr4_relax, .{ .name = "__aarch64_ldclr4_relax", .linkage = common.linkage, .visibility = common.visibility });2079 symbol(&__aarch64_ldclr4_relax, "__aarch64_ldclr4_relax");
2079 @export(&__aarch64_ldeor4_relax, .{ .name = "__aarch64_ldeor4_relax", .linkage = common.linkage, .visibility = common.visibility });2080 symbol(&__aarch64_ldeor4_relax, "__aarch64_ldeor4_relax");
2080 @export(&__aarch64_ldset4_relax, .{ .name = "__aarch64_ldset4_relax", .linkage = common.linkage, .visibility = common.visibility });2081 symbol(&__aarch64_ldset4_relax, "__aarch64_ldset4_relax");
2081 @export(&__aarch64_cas4_acq, .{ .name = "__aarch64_cas4_acq", .linkage = common.linkage, .visibility = common.visibility });2082 symbol(&__aarch64_cas4_acq, "__aarch64_cas4_acq");
2082 @export(&__aarch64_swp4_acq, .{ .name = "__aarch64_swp4_acq", .linkage = common.linkage, .visibility = common.visibility });2083 symbol(&__aarch64_swp4_acq, "__aarch64_swp4_acq");
2083 @export(&__aarch64_ldadd4_acq, .{ .name = "__aarch64_ldadd4_acq", .linkage = common.linkage, .visibility = common.visibility });2084 symbol(&__aarch64_ldadd4_acq, "__aarch64_ldadd4_acq");
2084 @export(&__aarch64_ldclr4_acq, .{ .name = "__aarch64_ldclr4_acq", .linkage = common.linkage, .visibility = common.visibility });2085 symbol(&__aarch64_ldclr4_acq, "__aarch64_ldclr4_acq");
2085 @export(&__aarch64_ldeor4_acq, .{ .name = "__aarch64_ldeor4_acq", .linkage = common.linkage, .visibility = common.visibility });2086 symbol(&__aarch64_ldeor4_acq, "__aarch64_ldeor4_acq");
2086 @export(&__aarch64_ldset4_acq, .{ .name = "__aarch64_ldset4_acq", .linkage = common.linkage, .visibility = common.visibility });2087 symbol(&__aarch64_ldset4_acq, "__aarch64_ldset4_acq");
2087 @export(&__aarch64_cas4_rel, .{ .name = "__aarch64_cas4_rel", .linkage = common.linkage, .visibility = common.visibility });2088 symbol(&__aarch64_cas4_rel, "__aarch64_cas4_rel");
2088 @export(&__aarch64_swp4_rel, .{ .name = "__aarch64_swp4_rel", .linkage = common.linkage, .visibility = common.visibility });2089 symbol(&__aarch64_swp4_rel, "__aarch64_swp4_rel");
2089 @export(&__aarch64_ldadd4_rel, .{ .name = "__aarch64_ldadd4_rel", .linkage = common.linkage, .visibility = common.visibility });2090 symbol(&__aarch64_ldadd4_rel, "__aarch64_ldadd4_rel");
2090 @export(&__aarch64_ldclr4_rel, .{ .name = "__aarch64_ldclr4_rel", .linkage = common.linkage, .visibility = common.visibility });2091 symbol(&__aarch64_ldclr4_rel, "__aarch64_ldclr4_rel");
2091 @export(&__aarch64_ldeor4_rel, .{ .name = "__aarch64_ldeor4_rel", .linkage = common.linkage, .visibility = common.visibility });2092 symbol(&__aarch64_ldeor4_rel, "__aarch64_ldeor4_rel");
2092 @export(&__aarch64_ldset4_rel, .{ .name = "__aarch64_ldset4_rel", .linkage = common.linkage, .visibility = common.visibility });2093 symbol(&__aarch64_ldset4_rel, "__aarch64_ldset4_rel");
2093 @export(&__aarch64_cas4_acq_rel, .{ .name = "__aarch64_cas4_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2094 symbol(&__aarch64_cas4_acq_rel, "__aarch64_cas4_acq_rel");
2094 @export(&__aarch64_swp4_acq_rel, .{ .name = "__aarch64_swp4_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2095 symbol(&__aarch64_swp4_acq_rel, "__aarch64_swp4_acq_rel");
2095 @export(&__aarch64_ldadd4_acq_rel, .{ .name = "__aarch64_ldadd4_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2096 symbol(&__aarch64_ldadd4_acq_rel, "__aarch64_ldadd4_acq_rel");
2096 @export(&__aarch64_ldclr4_acq_rel, .{ .name = "__aarch64_ldclr4_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2097 symbol(&__aarch64_ldclr4_acq_rel, "__aarch64_ldclr4_acq_rel");
2097 @export(&__aarch64_ldeor4_acq_rel, .{ .name = "__aarch64_ldeor4_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2098 symbol(&__aarch64_ldeor4_acq_rel, "__aarch64_ldeor4_acq_rel");
2098 @export(&__aarch64_ldset4_acq_rel, .{ .name = "__aarch64_ldset4_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2099 symbol(&__aarch64_ldset4_acq_rel, "__aarch64_ldset4_acq_rel");
2099 @export(&__aarch64_cas8_relax, .{ .name = "__aarch64_cas8_relax", .linkage = common.linkage, .visibility = common.visibility });2100 symbol(&__aarch64_cas8_relax, "__aarch64_cas8_relax");
2100 @export(&__aarch64_swp8_relax, .{ .name = "__aarch64_swp8_relax", .linkage = common.linkage, .visibility = common.visibility });2101 symbol(&__aarch64_swp8_relax, "__aarch64_swp8_relax");
2101 @export(&__aarch64_ldadd8_relax, .{ .name = "__aarch64_ldadd8_relax", .linkage = common.linkage, .visibility = common.visibility });2102 symbol(&__aarch64_ldadd8_relax, "__aarch64_ldadd8_relax");
2102 @export(&__aarch64_ldclr8_relax, .{ .name = "__aarch64_ldclr8_relax", .linkage = common.linkage, .visibility = common.visibility });2103 symbol(&__aarch64_ldclr8_relax, "__aarch64_ldclr8_relax");
2103 @export(&__aarch64_ldeor8_relax, .{ .name = "__aarch64_ldeor8_relax", .linkage = common.linkage, .visibility = common.visibility });2104 symbol(&__aarch64_ldeor8_relax, "__aarch64_ldeor8_relax");
2104 @export(&__aarch64_ldset8_relax, .{ .name = "__aarch64_ldset8_relax", .linkage = common.linkage, .visibility = common.visibility });2105 symbol(&__aarch64_ldset8_relax, "__aarch64_ldset8_relax");
2105 @export(&__aarch64_cas8_acq, .{ .name = "__aarch64_cas8_acq", .linkage = common.linkage, .visibility = common.visibility });2106 symbol(&__aarch64_cas8_acq, "__aarch64_cas8_acq");
2106 @export(&__aarch64_swp8_acq, .{ .name = "__aarch64_swp8_acq", .linkage = common.linkage, .visibility = common.visibility });2107 symbol(&__aarch64_swp8_acq, "__aarch64_swp8_acq");
2107 @export(&__aarch64_ldadd8_acq, .{ .name = "__aarch64_ldadd8_acq", .linkage = common.linkage, .visibility = common.visibility });2108 symbol(&__aarch64_ldadd8_acq, "__aarch64_ldadd8_acq");
2108 @export(&__aarch64_ldclr8_acq, .{ .name = "__aarch64_ldclr8_acq", .linkage = common.linkage, .visibility = common.visibility });2109 symbol(&__aarch64_ldclr8_acq, "__aarch64_ldclr8_acq");
2109 @export(&__aarch64_ldeor8_acq, .{ .name = "__aarch64_ldeor8_acq", .linkage = common.linkage, .visibility = common.visibility });2110 symbol(&__aarch64_ldeor8_acq, "__aarch64_ldeor8_acq");
2110 @export(&__aarch64_ldset8_acq, .{ .name = "__aarch64_ldset8_acq", .linkage = common.linkage, .visibility = common.visibility });2111 symbol(&__aarch64_ldset8_acq, "__aarch64_ldset8_acq");
2111 @export(&__aarch64_cas8_rel, .{ .name = "__aarch64_cas8_rel", .linkage = common.linkage, .visibility = common.visibility });2112 symbol(&__aarch64_cas8_rel, "__aarch64_cas8_rel");
2112 @export(&__aarch64_swp8_rel, .{ .name = "__aarch64_swp8_rel", .linkage = common.linkage, .visibility = common.visibility });2113 symbol(&__aarch64_swp8_rel, "__aarch64_swp8_rel");
2113 @export(&__aarch64_ldadd8_rel, .{ .name = "__aarch64_ldadd8_rel", .linkage = common.linkage, .visibility = common.visibility });2114 symbol(&__aarch64_ldadd8_rel, "__aarch64_ldadd8_rel");
2114 @export(&__aarch64_ldclr8_rel, .{ .name = "__aarch64_ldclr8_rel", .linkage = common.linkage, .visibility = common.visibility });2115 symbol(&__aarch64_ldclr8_rel, "__aarch64_ldclr8_rel");
2115 @export(&__aarch64_ldeor8_rel, .{ .name = "__aarch64_ldeor8_rel", .linkage = common.linkage, .visibility = common.visibility });2116 symbol(&__aarch64_ldeor8_rel, "__aarch64_ldeor8_rel");
2116 @export(&__aarch64_ldset8_rel, .{ .name = "__aarch64_ldset8_rel", .linkage = common.linkage, .visibility = common.visibility });2117 symbol(&__aarch64_ldset8_rel, "__aarch64_ldset8_rel");
2117 @export(&__aarch64_cas8_acq_rel, .{ .name = "__aarch64_cas8_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2118 symbol(&__aarch64_cas8_acq_rel, "__aarch64_cas8_acq_rel");
2118 @export(&__aarch64_swp8_acq_rel, .{ .name = "__aarch64_swp8_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2119 symbol(&__aarch64_swp8_acq_rel, "__aarch64_swp8_acq_rel");
2119 @export(&__aarch64_ldadd8_acq_rel, .{ .name = "__aarch64_ldadd8_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2120 symbol(&__aarch64_ldadd8_acq_rel, "__aarch64_ldadd8_acq_rel");
2120 @export(&__aarch64_ldclr8_acq_rel, .{ .name = "__aarch64_ldclr8_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2121 symbol(&__aarch64_ldclr8_acq_rel, "__aarch64_ldclr8_acq_rel");
2121 @export(&__aarch64_ldeor8_acq_rel, .{ .name = "__aarch64_ldeor8_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2122 symbol(&__aarch64_ldeor8_acq_rel, "__aarch64_ldeor8_acq_rel");
2122 @export(&__aarch64_ldset8_acq_rel, .{ .name = "__aarch64_ldset8_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2123 symbol(&__aarch64_ldset8_acq_rel, "__aarch64_ldset8_acq_rel");
2123 @export(&__aarch64_cas16_relax, .{ .name = "__aarch64_cas16_relax", .linkage = common.linkage, .visibility = common.visibility });2124 symbol(&__aarch64_cas16_relax, "__aarch64_cas16_relax");
2124 @export(&__aarch64_cas16_acq, .{ .name = "__aarch64_cas16_acq", .linkage = common.linkage, .visibility = common.visibility });2125 symbol(&__aarch64_cas16_acq, "__aarch64_cas16_acq");
2125 @export(&__aarch64_cas16_rel, .{ .name = "__aarch64_cas16_rel", .linkage = common.linkage, .visibility = common.visibility });2126 symbol(&__aarch64_cas16_rel, "__aarch64_cas16_rel");
2126 @export(&__aarch64_cas16_acq_rel, .{ .name = "__aarch64_cas16_acq_rel", .linkage = common.linkage, .visibility = common.visibility });2127 symbol(&__aarch64_cas16_acq_rel, "__aarch64_cas16_acq_rel");
2127}2128}
lib/compiler_rt/absvsi2.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const absv = @import("./absv.zig").absv;3const absv = @import("./absv.zig").absv;
34
4comptime {5comptime {
5 @export(&__absvsi2, .{ .name = "__absvsi2", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__absvsi2, "__absvsi2");
6}7}
78
8pub fn __absvsi2(a: i32) callconv(.c) i32 {9pub fn __absvsi2(a: i32) callconv(.c) i32 {
lib/compiler_rt/adddf3.zig+2-2
...@@ -1,9 +1,9 @@...@@ -1,9 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const addf3 = @import("./addf3.zig").addf3;2const addf3 = @import("./addf3.zig").addf3;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
7 symbol(&__aeabi_dadd, "__aeabi_dadd");7 symbol(&__aeabi_dadd, "__aeabi_dadd");
8 } else {8 } else {
9 symbol(&__adddf3, "__adddf3");9 symbol(&__adddf3, "__adddf3");
lib/compiler_rt/addf3.zig+2-2
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const std = @import("std");1const std = @import("std");
2const math = std.math;2const math = std.math;
3const common = @import("./common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const normalize = common.normalize;4const normalize = compiler_rt.normalize;
55
6/// Ported from:6/// Ported from:
7///7///
lib/compiler_rt/addhf3.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const addf3 = @import("./addf3.zig").addf3;3const addf3 = @import("./addf3.zig").addf3;
34
4comptime {5comptime {
5 @export(&__addhf3, .{ .name = "__addhf3", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__addhf3, "__addhf3");
6}7}
78
8fn __addhf3(a: f16, b: f16) callconv(.c) f16 {9fn __addhf3(a: f16, b: f16) callconv(.c) f16 {
lib/compiler_rt/addsf3.zig+2-2
...@@ -1,9 +1,9 @@...@@ -1,9 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const addf3 = @import("./addf3.zig").addf3;2const addf3 = @import("./addf3.zig").addf3;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
7 symbol(&__aeabi_fadd, "__aeabi_fadd");7 symbol(&__aeabi_fadd, "__aeabi_fadd");
8 } else {8 } else {
9 symbol(&__addsf3, "__addsf3");9 symbol(&__addsf3, "__addsf3");
lib/compiler_rt/addtf3.zig+7-6
...@@ -1,13 +1,14 @@...@@ -1,13 +1,14 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const addf3 = @import("./addf3.zig").addf3;3const addf3 = @import("./addf3.zig").addf3;
34
4comptime {5comptime {
5 if (common.want_ppc_abi) {6 if (compiler_rt.want_ppc_abi) {
6 @export(&__addtf3, .{ .name = "__addkf3", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__addtf3, "__addkf3");
7 } else if (common.want_sparc_abi) {8 } else if (compiler_rt.want_sparc_abi) {
8 @export(&_Qp_add, .{ .name = "_Qp_add", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&_Qp_add, "_Qp_add");
9 }10 }
10 @export(&__addtf3, .{ .name = "__addtf3", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__addtf3, "__addtf3");
11}12}
1213
13pub fn __addtf3(a: f128, b: f128) callconv(.c) f128 {14pub fn __addtf3(a: f128, b: f128) callconv(.c) f128 {
lib/compiler_rt/addvsi3.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const testing = @import("std").testing;3const testing = @import("std").testing;
34
4comptime {5comptime {
5 @export(&__addvsi3, .{ .name = "__addvsi3", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__addvsi3, "__addvsi3");
6}7}
78
8pub fn __addvsi3(a: i32, b: i32) callconv(.c) i32 {9pub fn __addvsi3(a: i32, b: i32) callconv(.c) i32 {
lib/compiler_rt/addxf3.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const addf3 = @import("./addf3.zig").addf3;3const addf3 = @import("./addf3.zig").addf3;
34
4comptime {5comptime {
5 @export(&__addxf3, .{ .name = "__addxf3", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__addxf3, "__addxf3");
6}7}
78
8pub fn __addxf3(a: f80, b: f80) callconv(.c) f80 {9pub fn __addxf3(a: f80, b: f80) callconv(.c) f80 {
lib/compiler_rt/arm.zig+29-28
...@@ -4,49 +4,50 @@ const std = @import("std");...@@ -4,49 +4,50 @@ const std = @import("std");
4const builtin = @import("builtin");4const builtin = @import("builtin");
5const target = builtin.target;5const target = builtin.target;
6const arch = builtin.cpu.arch;6const arch = builtin.cpu.arch;
7const common = @import("common.zig");7const compiler_rt = @import("../compiler_rt.zig");
8const symbol = compiler_rt.symbol;
89
9comptime {10comptime {
10 if (!builtin.is_test) {11 if (!builtin.is_test) {
11 if (arch.isArm()) {12 if (arch.isArm()) {
12 @export(&__aeabi_unwind_cpp_pr0, .{ .name = "__aeabi_unwind_cpp_pr0", .linkage = common.linkage, .visibility = common.visibility });13 symbol(&__aeabi_unwind_cpp_pr0, "__aeabi_unwind_cpp_pr0");
13 @export(&__aeabi_unwind_cpp_pr1, .{ .name = "__aeabi_unwind_cpp_pr1", .linkage = common.linkage, .visibility = common.visibility });14 symbol(&__aeabi_unwind_cpp_pr1, "__aeabi_unwind_cpp_pr1");
14 @export(&__aeabi_unwind_cpp_pr2, .{ .name = "__aeabi_unwind_cpp_pr2", .linkage = common.linkage, .visibility = common.visibility });15 symbol(&__aeabi_unwind_cpp_pr2, "__aeabi_unwind_cpp_pr2");
1516
16 if (common.want_windows_arm_abi) {17 if (compiler_rt.want_windows_arm_abi) {
17 @export(&__aeabi_ldivmod, .{ .name = "__rt_sdiv64", .linkage = common.linkage, .visibility = common.visibility });18 symbol(&__aeabi_ldivmod, "__rt_sdiv64");
18 @export(&__aeabi_uldivmod, .{ .name = "__rt_udiv64", .linkage = common.linkage, .visibility = common.visibility });19 symbol(&__aeabi_uldivmod, "__rt_udiv64");
19 @export(&__aeabi_idivmod, .{ .name = "__rt_sdiv", .linkage = common.linkage, .visibility = common.visibility });20 symbol(&__aeabi_idivmod, "__rt_sdiv");
20 @export(&__aeabi_uidivmod, .{ .name = "__rt_udiv", .linkage = common.linkage, .visibility = common.visibility });21 symbol(&__aeabi_uidivmod, "__rt_udiv");
21 }22 }
22 @export(&__aeabi_ldivmod, .{ .name = "__aeabi_ldivmod", .linkage = common.linkage, .visibility = common.visibility });23 symbol(&__aeabi_ldivmod, "__aeabi_ldivmod");
23 @export(&__aeabi_uldivmod, .{ .name = "__aeabi_uldivmod", .linkage = common.linkage, .visibility = common.visibility });24 symbol(&__aeabi_uldivmod, "__aeabi_uldivmod");
24 @export(&__aeabi_idivmod, .{ .name = "__aeabi_idivmod", .linkage = common.linkage, .visibility = common.visibility });25 symbol(&__aeabi_idivmod, "__aeabi_idivmod");
25 @export(&__aeabi_uidivmod, .{ .name = "__aeabi_uidivmod", .linkage = common.linkage, .visibility = common.visibility });26 symbol(&__aeabi_uidivmod, "__aeabi_uidivmod");
2627
27 @export(&__aeabi_memcpy, .{ .name = "__aeabi_memcpy", .linkage = common.linkage, .visibility = common.visibility });28 symbol(&__aeabi_memcpy, "__aeabi_memcpy");
28 @export(&__aeabi_memcpy4, .{ .name = "__aeabi_memcpy4", .linkage = common.linkage, .visibility = common.visibility });29 symbol(&__aeabi_memcpy4, "__aeabi_memcpy4");
29 @export(&__aeabi_memcpy8, .{ .name = "__aeabi_memcpy8", .linkage = common.linkage, .visibility = common.visibility });30 symbol(&__aeabi_memcpy8, "__aeabi_memcpy8");
3031
31 @export(&__aeabi_memmove, .{ .name = "__aeabi_memmove", .linkage = common.linkage, .visibility = common.visibility });32 symbol(&__aeabi_memmove, "__aeabi_memmove");
32 @export(&__aeabi_memmove4, .{ .name = "__aeabi_memmove4", .linkage = common.linkage, .visibility = common.visibility });33 symbol(&__aeabi_memmove4, "__aeabi_memmove4");
33 @export(&__aeabi_memmove8, .{ .name = "__aeabi_memmove8", .linkage = common.linkage, .visibility = common.visibility });34 symbol(&__aeabi_memmove8, "__aeabi_memmove8");
3435
35 @export(&__aeabi_memset, .{ .name = "__aeabi_memset", .linkage = common.linkage, .visibility = common.visibility });36 symbol(&__aeabi_memset, "__aeabi_memset");
36 @export(&__aeabi_memset4, .{ .name = "__aeabi_memset4", .linkage = common.linkage, .visibility = common.visibility });37 symbol(&__aeabi_memset4, "__aeabi_memset4");
37 @export(&__aeabi_memset8, .{ .name = "__aeabi_memset8", .linkage = common.linkage, .visibility = common.visibility });38 symbol(&__aeabi_memset8, "__aeabi_memset8");
3839
39 @export(&__aeabi_memclr, .{ .name = "__aeabi_memclr", .linkage = common.linkage, .visibility = common.visibility });40 symbol(&__aeabi_memclr, "__aeabi_memclr");
40 @export(&__aeabi_memclr4, .{ .name = "__aeabi_memclr4", .linkage = common.linkage, .visibility = common.visibility });41 symbol(&__aeabi_memclr4, "__aeabi_memclr4");
41 @export(&__aeabi_memclr8, .{ .name = "__aeabi_memclr8", .linkage = common.linkage, .visibility = common.visibility });42 symbol(&__aeabi_memclr8, "__aeabi_memclr8");
4243
43 if (builtin.os.tag == .linux or builtin.os.tag == .freebsd) {44 if (builtin.os.tag == .linux or builtin.os.tag == .freebsd) {
44 @export(&__aeabi_read_tp, .{ .name = "__aeabi_read_tp", .linkage = common.linkage, .visibility = common.visibility });45 symbol(&__aeabi_read_tp, "__aeabi_read_tp");
45 }46 }
4647
47 // floating-point helper functions (single+double-precision reverse subtraction, y – x), see subdf3.zig48 // floating-point helper functions (single+double-precision reverse subtraction, y – x), see subdf3.zig
48 @export(&__aeabi_frsub, .{ .name = "__aeabi_frsub", .linkage = common.linkage, .visibility = common.visibility });49 symbol(&__aeabi_frsub, "__aeabi_frsub");
49 @export(&__aeabi_drsub, .{ .name = "__aeabi_drsub", .linkage = common.linkage, .visibility = common.visibility });50 symbol(&__aeabi_drsub, "__aeabi_drsub");
50 }51 }
51 }52 }
52}53}
lib/compiler_rt/atomics.zig+1-1
...@@ -4,7 +4,7 @@ const arch = cpu.arch;...@@ -4,7 +4,7 @@ const arch = cpu.arch;
44
5const std = @import("std");5const std = @import("std");
66
7const common = @import("./common.zig");7const compiler_rt = @import("../compiler_rt.zig");
8const symbol = @import("../compiler_rt.zig").symbol;8const symbol = @import("../compiler_rt.zig").symbol;
99
10// This parameter is true iff the target architecture supports the bare minimum10// This parameter is true iff the target architecture supports the bare minimum
lib/compiler_rt/aulldiv.zig+2-2
...@@ -1,10 +1,10 @@...@@ -1,10 +1,10 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
22
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = @import("../compiler_rt.zig").symbol;4const symbol = @import("../compiler_rt.zig").symbol;
55
6comptime {6comptime {
7 if (common.want_windows_x86_msvc_abi) {7 if (compiler_rt.want_windows_x86_msvc_abi) {
8 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins8 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins
9 symbol(&_alldiv, "\x01__alldiv");9 symbol(&_alldiv, "\x01__alldiv");
10 symbol(&_aulldiv, "\x01__aulldiv");10 symbol(&_aulldiv, "\x01__aulldiv");
lib/compiler_rt/aullrem.zig+5-4
...@@ -3,13 +3,14 @@ const builtin = @import("builtin");...@@ -3,13 +3,14 @@ const builtin = @import("builtin");
3const arch = builtin.cpu.arch;3const arch = builtin.cpu.arch;
4const os = builtin.os.tag;4const os = builtin.os.tag;
5const abi = builtin.abi;5const abi = builtin.abi;
6const common = @import("common.zig");6const compiler_rt = @import("../compiler_rt.zig");
7const symbol = compiler_rt.symbol;
78
8comptime {9comptime {
9 if (common.want_windows_x86_msvc_abi) {10 if (compiler_rt.want_windows_x86_msvc_abi) {
10 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins11 // Don't let LLVM apply the stdcall name mangling on those MSVC builtins
11 @export(&_allrem, .{ .name = "\x01__allrem", .linkage = common.linkage, .visibility = common.visibility });12 symbol(&_allrem, "\x01__allrem");
12 @export(&_aullrem, .{ .name = "\x01__aullrem", .linkage = common.linkage, .visibility = common.visibility });13 symbol(&_aullrem, "\x01__aullrem");
13 }14 }
14}15}
1516
lib/compiler_rt/bcmp.zig deleted-30
...@@ -1,30 +0,0 @@
1const std = @import("std");
2const common = @import("./common.zig");
3
4comptime {
5 @export(&bcmp, .{ .name = "bcmp", .linkage = common.linkage, .visibility = common.visibility });
6}
7
8pub fn bcmp(vl: [*]allowzero const u8, vr: [*]allowzero const u8, n: usize) callconv(.c) c_int {
9 @setRuntimeSafety(false);
10
11 var index: usize = 0;
12 while (index != n) : (index += 1) {
13 if (vl[index] != vr[index]) {
14 return 1;
15 }
16 }
17
18 return 0;
19}
20
21test "bcmp" {
22 const base_arr = &[_]u8{ 1, 1, 1 };
23 const arr1 = &[_]u8{ 1, 1, 1 };
24 const arr2 = &[_]u8{ 1, 0, 1 };
25 const arr3 = &[_]u8{ 1, 2, 1 };
26
27 try std.testing.expect(bcmp(base_arr[0..], arr1[0..], base_arr.len) == 0);
28 try std.testing.expect(bcmp(base_arr[0..], arr2[0..], base_arr.len) != 0);
29 try std.testing.expect(bcmp(base_arr[0..], arr3[0..], base_arr.len) != 0);
30}
lib/compiler_rt/bitreverse.zig+5-4
...@@ -1,11 +1,12 @@...@@ -1,11 +1,12 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
45
5comptime {6comptime {
6 @export(&__bitreversesi2, .{ .name = "__bitreversesi2", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__bitreversesi2, "__bitreversesi2");
7 @export(&__bitreversedi2, .{ .name = "__bitreversedi2", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__bitreversedi2, "__bitreversedi2");
8 @export(&__bitreverseti2, .{ .name = "__bitreverseti2", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__bitreverseti2, "__bitreverseti2");
9}10}
1011
11inline fn bitreverseXi2(comptime T: type, a: T) T {12inline fn bitreverseXi2(comptime T: type, a: T) T {
lib/compiler_rt/bswap.zig+5-4
...@@ -1,11 +1,12 @@...@@ -1,11 +1,12 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
45
5comptime {6comptime {
6 @export(&__bswapsi2, .{ .name = "__bswapsi2", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__bswapsi2, "__bswapsi2");
7 @export(&__bswapdi2, .{ .name = "__bswapdi2", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__bswapdi2, "__bswapdi2");
8 @export(&__bswapti2, .{ .name = "__bswapti2", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__bswapti2, "__bswapti2");
9}10}
1011
11// bswap - byteswap12// bswap - byteswap
lib/compiler_rt/clear_cache.zig+3-2
...@@ -2,7 +2,8 @@ const std = @import("std");...@@ -2,7 +2,8 @@ const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const arch = builtin.cpu.arch;3const arch = builtin.cpu.arch;
4const os = builtin.os.tag;4const os = builtin.os.tag;
5const common = @import("common.zig");5const compiler_rt = @import("../compiler_rt.zig");
6const symbol = compiler_rt.symbol;
67
7// Ported from llvm-project d32170dbd5b0d54436537b6b75beaf44324e0c288// Ported from llvm-project d32170dbd5b0d54436537b6b75beaf44324e0c28
89
...@@ -188,7 +189,7 @@ fn clear_cache(start: usize, end: usize) callconv(.c) void {...@@ -188,7 +189,7 @@ fn clear_cache(start: usize, end: usize) callconv(.c) void {
188}189}
189190
190fn exportIt() void {191fn exportIt() void {
191 @export(&clear_cache, .{ .name = "__clear_cache", .linkage = common.linkage, .visibility = common.visibility });192 symbol(&clear_cache, "__clear_cache");
192}193}
193194
194// MIPS-only195// MIPS-only
lib/compiler_rt/cmp.zig+8-7
...@@ -1,14 +1,15 @@...@@ -1,14 +1,15 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
45
5comptime {6comptime {
6 @export(&__cmpsi2, .{ .name = "__cmpsi2", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__cmpsi2, "__cmpsi2");
7 @export(&__cmpdi2, .{ .name = "__cmpdi2", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__cmpdi2, "__cmpdi2");
8 @export(&__cmpti2, .{ .name = "__cmpti2", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__cmpti2, "__cmpti2");
9 @export(&__ucmpsi2, .{ .name = "__ucmpsi2", .linkage = common.linkage, .visibility = common.visibility });10 symbol(&__ucmpsi2, "__ucmpsi2");
10 @export(&__ucmpdi2, .{ .name = "__ucmpdi2", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__ucmpdi2, "__ucmpdi2");
11 @export(&__ucmpti2, .{ .name = "__ucmpti2", .linkage = common.linkage, .visibility = common.visibility });12 symbol(&__ucmpti2, "__ucmpti2");
12}13}
1314
14// cmp - signed compare15// cmp - signed compare
lib/compiler_rt/cmpdf2.zig+2-2
...@@ -1,11 +1,11 @@...@@ -1,11 +1,11 @@
1///! The quoted behavior definitions are from1///! The quoted behavior definitions are from
2///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines2///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines
3const common = @import("./common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const comparef = @import("./comparef.zig");4const comparef = @import("./comparef.zig");
5const symbol = @import("../compiler_rt.zig").symbol;5const symbol = @import("../compiler_rt.zig").symbol;
66
7comptime {7comptime {
8 if (common.want_aeabi) {8 if (compiler_rt.want_aeabi) {
9 symbol(&__aeabi_dcmpeq, "__aeabi_dcmpeq");9 symbol(&__aeabi_dcmpeq, "__aeabi_dcmpeq");
10 symbol(&__aeabi_dcmplt, "__aeabi_dcmplt");10 symbol(&__aeabi_dcmplt, "__aeabi_dcmplt");
11 symbol(&__aeabi_dcmple, "__aeabi_dcmple");11 symbol(&__aeabi_dcmple, "__aeabi_dcmple");
lib/compiler_rt/cmphf2.zig deleted-48
...@@ -1,48 +0,0 @@
1///! The quoted behavior definitions are from
2///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines
3const common = @import("./common.zig");
4const comparef = @import("./comparef.zig");
5
6comptime {
7 @export(&__eqhf2, .{ .name = "__eqhf2", .linkage = common.linkage, .visibility = common.visibility });
8 @export(&__nehf2, .{ .name = "__nehf2", .linkage = common.linkage, .visibility = common.visibility });
9 @export(&__lehf2, .{ .name = "__lehf2", .linkage = common.linkage, .visibility = common.visibility });
10 @export(&__cmphf2, .{ .name = "__cmphf2", .linkage = common.linkage, .visibility = common.visibility });
11 @export(&__lthf2, .{ .name = "__lthf2", .linkage = common.linkage, .visibility = common.visibility });
12}
13
14/// "These functions calculate a <=> b. That is, if a is less than b, they return -1;
15/// if a is greater than b, they return 1; and if a and b are equal they return 0.
16/// If either argument is NaN they return 1..."
17///
18/// Note that this matches the definition of `__lehf2`, `__eqhf2`, `__nehf2`, `__cmphf2`,
19/// and `__lthf2`.
20fn __cmphf2(a: f16, b: f16) callconv(.c) i32 {
21 return @intFromEnum(comparef.cmpf2(f16, comparef.LE, a, b));
22}
23
24/// "These functions return a value less than or equal to zero if neither argument is NaN,
25/// and a is less than or equal to b."
26pub fn __lehf2(a: f16, b: f16) callconv(.c) i32 {
27 return __cmphf2(a, b);
28}
29
30/// "These functions return zero if neither argument is NaN, and a and b are equal."
31/// Note that due to some kind of historical accident, __eqhf2 and __nehf2 are defined
32/// to have the same return value.
33pub fn __eqhf2(a: f16, b: f16) callconv(.c) i32 {
34 return __cmphf2(a, b);
35}
36
37/// "These functions return a nonzero value if either argument is NaN, or if a and b are unequal."
38/// Note that due to some kind of historical accident, __eqhf2 and __nehf2 are defined
39/// to have the same return value.
40pub fn __nehf2(a: f16, b: f16) callconv(.c) i32 {
41 return __cmphf2(a, b);
42}
43
44/// "These functions return a value less than zero if neither argument is NaN, and a
45/// is strictly less than b."
46pub fn __lthf2(a: f16, b: f16) callconv(.c) i32 {
47 return __cmphf2(a, b);
48}
lib/compiler_rt/cmpsf2.zig deleted-66
...@@ -1,66 +0,0 @@
1///! The quoted behavior definitions are from
2///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines
3const common = @import("./common.zig");
4const comparef = @import("./comparef.zig");
5
6comptime {
7 if (common.want_aeabi) {
8 @export(&__aeabi_fcmpeq, .{ .name = "__aeabi_fcmpeq", .linkage = common.linkage, .visibility = common.visibility });
9 @export(&__aeabi_fcmplt, .{ .name = "__aeabi_fcmplt", .linkage = common.linkage, .visibility = common.visibility });
10 @export(&__aeabi_fcmple, .{ .name = "__aeabi_fcmple", .linkage = common.linkage, .visibility = common.visibility });
11 } else {
12 @export(&__eqsf2, .{ .name = "__eqsf2", .linkage = common.linkage, .visibility = common.visibility });
13 @export(&__nesf2, .{ .name = "__nesf2", .linkage = common.linkage, .visibility = common.visibility });
14 @export(&__lesf2, .{ .name = "__lesf2", .linkage = common.linkage, .visibility = common.visibility });
15 @export(&__cmpsf2, .{ .name = "__cmpsf2", .linkage = common.linkage, .visibility = common.visibility });
16 @export(&__ltsf2, .{ .name = "__ltsf2", .linkage = common.linkage, .visibility = common.visibility });
17 }
18}
19
20/// "These functions calculate a <=> b. That is, if a is less than b, they return -1;
21/// if a is greater than b, they return 1; and if a and b are equal they return 0.
22/// If either argument is NaN they return 1..."
23///
24/// Note that this matches the definition of `__lesf2`, `__eqsf2`, `__nesf2`, `__cmpsf2`,
25/// and `__ltsf2`.
26fn __cmpsf2(a: f32, b: f32) callconv(.c) i32 {
27 return @intFromEnum(comparef.cmpf2(f32, comparef.LE, a, b));
28}
29
30/// "These functions return a value less than or equal to zero if neither argument is NaN,
31/// and a is less than or equal to b."
32pub fn __lesf2(a: f32, b: f32) callconv(.c) i32 {
33 return __cmpsf2(a, b);
34}
35
36/// "These functions return zero if neither argument is NaN, and a and b are equal."
37/// Note that due to some kind of historical accident, __eqsf2 and __nesf2 are defined
38/// to have the same return value.
39pub fn __eqsf2(a: f32, b: f32) callconv(.c) i32 {
40 return __cmpsf2(a, b);
41}
42
43/// "These functions return a nonzero value if either argument is NaN, or if a and b are unequal."
44/// Note that due to some kind of historical accident, __eqsf2 and __nesf2 are defined
45/// to have the same return value.
46pub fn __nesf2(a: f32, b: f32) callconv(.c) i32 {
47 return __cmpsf2(a, b);
48}
49
50/// "These functions return a value less than zero if neither argument is NaN, and a
51/// is strictly less than b."
52pub fn __ltsf2(a: f32, b: f32) callconv(.c) i32 {
53 return __cmpsf2(a, b);
54}
55
56fn __aeabi_fcmpeq(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 {
57 return @intFromBool(comparef.cmpf2(f32, comparef.LE, a, b) == .Equal);
58}
59
60fn __aeabi_fcmplt(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 {
61 return @intFromBool(comparef.cmpf2(f32, comparef.LE, a, b) == .Less);
62}
63
64fn __aeabi_fcmple(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 {
65 return @intFromBool(comparef.cmpf2(f32, comparef.LE, a, b) != .Greater);
66}
lib/compiler_rt/cmptf2.zig+3-3
...@@ -1,16 +1,16 @@...@@ -1,16 +1,16 @@
1///! The quoted behavior definitions are from1///! The quoted behavior definitions are from
2///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines2///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines
3const common = @import("./common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const comparef = @import("./comparef.zig");4const comparef = @import("./comparef.zig");
5const symbol = @import("../compiler_rt.zig").symbol;5const symbol = @import("../compiler_rt.zig").symbol;
66
7comptime {7comptime {
8 if (common.want_ppc_abi) {8 if (compiler_rt.want_ppc_abi) {
9 symbol(&__eqtf2, "__eqkf2");9 symbol(&__eqtf2, "__eqkf2");
10 symbol(&__netf2, "__nekf2");10 symbol(&__netf2, "__nekf2");
11 symbol(&__lttf2, "__ltkf2");11 symbol(&__lttf2, "__ltkf2");
12 symbol(&__letf2, "__lekf2");12 symbol(&__letf2, "__lekf2");
13 } else if (common.want_sparc_abi) {13 } else if (compiler_rt.want_sparc_abi) {
14 symbol(&_Qp_cmp, "_Qp_cmp");14 symbol(&_Qp_cmp, "_Qp_cmp");
15 symbol(&_Qp_feq, "_Qp_feq");15 symbol(&_Qp_feq, "_Qp_feq");
16 symbol(&_Qp_fne, "_Qp_fne");16 symbol(&_Qp_fne, "_Qp_fne");
lib/compiler_rt/cmpxf2.zig+7-6
...@@ -1,14 +1,15 @@...@@ -1,14 +1,15 @@
1///! The quoted behavior definitions are from1///! The quoted behavior definitions are from
2///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines2///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines
3const common = @import("./common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
4const comparef = @import("./comparef.zig");5const comparef = @import("./comparef.zig");
56
6comptime {7comptime {
7 @export(&__eqxf2, .{ .name = "__eqxf2", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__eqxf2, "__eqxf2");
8 @export(&__nexf2, .{ .name = "__nexf2", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__nexf2, "__nexf2");
9 @export(&__lexf2, .{ .name = "__lexf2", .linkage = common.linkage, .visibility = common.visibility });10 symbol(&__lexf2, "__lexf2");
10 @export(&__cmpxf2, .{ .name = "__cmpxf2", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__cmpxf2, "__cmpxf2");
11 @export(&__ltxf2, .{ .name = "__ltxf2", .linkage = common.linkage, .visibility = common.visibility });12 symbol(&__ltxf2, "__ltxf2");
12}13}
1314
14/// "These functions calculate a <=> b. That is, if a is less than b, they return -1;15/// "These functions calculate a <=> b. That is, if a is less than b, they return -1;
lib/compiler_rt/common.zig deleted-296
...@@ -1,296 +0,0 @@
1const std = @import("std");
2const builtin = @import("builtin");
3const native_endian = builtin.cpu.arch.endian();
4const ofmt_c = builtin.object_format == .c;
5
6/// Deprecated, everything in common should move to compiler_rt.zig
7pub const linkage = @import("../compiler_rt.zig").linkage;
8
9/// Deprecated, everything in common should move to compiler_rt.zig
10pub const visibility = @import("../compiler_rt.zig").visibility;
11
12pub const PreferredLoadStoreElement = element: {
13 if (std.simd.suggestVectorLength(u8)) |vec_size| {
14 const Vec = @Vector(vec_size, u8);
15
16 if (@sizeOf(Vec) == vec_size and std.math.isPowerOfTwo(vec_size)) {
17 break :element Vec;
18 }
19 }
20 break :element usize;
21};
22
23pub const want_aeabi = switch (builtin.abi) {
24 .eabi,
25 .eabihf,
26 .musleabi,
27 .musleabihf,
28 .gnueabi,
29 .gnueabihf,
30 .android,
31 .androideabi,
32 => switch (builtin.cpu.arch) {
33 .arm, .armeb, .thumb, .thumbeb => true,
34 else => false,
35 },
36 else => false,
37};
38
39/// These functions are required on Windows on ARM. They are provided by MSVC libc, but in libc-less
40/// builds or when linking MinGW libc they are our responsibility.
41/// Temporarily used for thumb-uefi until https://github.com/ziglang/zig/issues/21630 is addressed.
42pub const want_windows_arm_abi = e: {
43 if (!builtin.cpu.arch.isArm()) break :e false;
44 switch (builtin.os.tag) {
45 .windows, .uefi => {},
46 else => break :e false,
47 }
48 // The ABI is needed, but it's only our reponsibility if libc won't provide it.
49 break :e builtin.abi.isGnu() or !builtin.link_libc;
50};
51
52/// These functions are required by on Windows on x86 on some ABIs. They are provided by MSVC libc,
53/// but in libc-less builds they are our responsibility.
54pub const want_windows_x86_msvc_abi = e: {
55 if (builtin.cpu.arch != .x86) break :e false;
56 if (builtin.os.tag != .windows) break :e false;
57 switch (builtin.abi) {
58 .none, .msvc, .itanium => {},
59 else => break :e false,
60 }
61 // The ABI is needed, but it's only our responsibility if libc won't provide it.
62 break :e !builtin.link_libc;
63};
64
65pub const want_ppc_abi = builtin.cpu.arch.isPowerPC();
66
67pub const want_float_exceptions = !builtin.cpu.arch.isWasm();
68
69// Libcalls that involve u128 on Windows x86-64 are expected by LLVM to use the
70// calling convention of @Vector(2, u64), rather than what's standard.
71pub const want_windows_v2u64_abi = builtin.os.tag == .windows and builtin.cpu.arch == .x86_64 and !ofmt_c;
72
73/// This governs whether to use these symbol names for f16/f32 conversions
74/// rather than the standard names:
75/// * __gnu_f2h_ieee
76/// * __gnu_h2f_ieee
77/// Known correct configurations:
78/// x86_64-freestanding-none => true
79/// x86_64-linux-none => true
80/// x86_64-linux-gnu => true
81/// x86_64-linux-musl => true
82/// x86_64-linux-eabi => true
83/// arm-linux-musleabihf => true
84/// arm-linux-gnueabihf => true
85/// arm-linux-eabihf => false
86/// wasm32-wasi-musl => false
87/// wasm32-freestanding-none => false
88/// x86_64-windows-gnu => true
89/// x86_64-windows-msvc => true
90/// any-macos-any => false
91pub const gnu_f16_abi = switch (builtin.cpu.arch) {
92 .wasm32,
93 .wasm64,
94 .riscv64,
95 .riscv64be,
96 .riscv32,
97 .riscv32be,
98 => false,
99
100 .x86, .x86_64 => true,
101
102 .arm, .armeb, .thumb, .thumbeb => switch (builtin.abi) {
103 .eabi, .eabihf => false,
104 else => true,
105 },
106
107 else => !builtin.os.tag.isDarwin(),
108};
109
110pub const want_sparc_abi = builtin.cpu.arch.isSPARC();
111
112/// Deprecated, everything in common should move to compiler_rt.zig
113pub const test_safety = @import("../compiler_rt.zig").test_safety;
114
115/// This seems to mostly correspond to `clang::TargetInfo::HasFloat16`.
116pub fn F16T(comptime OtherType: type) type {
117 return switch (builtin.cpu.arch) {
118 .amdgcn,
119 .arm,
120 .armeb,
121 .thumb,
122 .thumbeb,
123 .aarch64,
124 .aarch64_be,
125 .hexagon,
126 .loongarch32,
127 .loongarch64,
128 .nvptx,
129 .nvptx64,
130 .riscv32,
131 .riscv32be,
132 .riscv64,
133 .riscv64be,
134 .s390x,
135 .spirv32,
136 .spirv64,
137 => f16,
138 .x86, .x86_64 => if (builtin.target.os.tag.isDarwin()) switch (OtherType) {
139 // Starting with LLVM 16, Darwin uses different abi for f16
140 // depending on the type of the other return/argument..???
141 f32, f64 => u16,
142 f80, f128 => f16,
143 else => unreachable,
144 } else f16,
145 else => u16,
146 };
147}
148
149pub fn wideMultiply(comptime Z: type, a: Z, b: Z, hi: *Z, lo: *Z) void {
150 switch (Z) {
151 u16 => {
152 // 16x16 --> 32 bit multiply
153 const product = @as(u32, a) * @as(u32, b);
154 hi.* = @intCast(product >> 16);
155 lo.* = @truncate(product);
156 },
157 u32 => {
158 // 32x32 --> 64 bit multiply
159 const product = @as(u64, a) * @as(u64, b);
160 hi.* = @truncate(product >> 32);
161 lo.* = @truncate(product);
162 },
163 u64 => {
164 const S = struct {
165 fn loWord(x: u64) u64 {
166 return @as(u32, @truncate(x));
167 }
168 fn hiWord(x: u64) u64 {
169 return @as(u32, @truncate(x >> 32));
170 }
171 };
172 // 64x64 -> 128 wide multiply for platforms that don't have such an operation;
173 // many 64-bit platforms have this operation, but they tend to have hardware
174 // floating-point, so we don't bother with a special case for them here.
175 // Each of the component 32x32 -> 64 products
176 const plolo: u64 = S.loWord(a) * S.loWord(b);
177 const plohi: u64 = S.loWord(a) * S.hiWord(b);
178 const philo: u64 = S.hiWord(a) * S.loWord(b);
179 const phihi: u64 = S.hiWord(a) * S.hiWord(b);
180 // Sum terms that contribute to lo in a way that allows us to get the carry
181 const r0: u64 = S.loWord(plolo);
182 const r1: u64 = S.hiWord(plolo) +% S.loWord(plohi) +% S.loWord(philo);
183 lo.* = r0 +% (r1 << 32);
184 // Sum terms contributing to hi with the carry from lo
185 hi.* = S.hiWord(plohi) +% S.hiWord(philo) +% S.hiWord(r1) +% phihi;
186 },
187 u128 => {
188 const Word_LoMask: u64 = 0x00000000ffffffff;
189 const Word_HiMask: u64 = 0xffffffff00000000;
190 const Word_FullMask: u64 = 0xffffffffffffffff;
191 const S = struct {
192 fn Word_1(x: u128) u64 {
193 return @as(u32, @truncate(x >> 96));
194 }
195 fn Word_2(x: u128) u64 {
196 return @as(u32, @truncate(x >> 64));
197 }
198 fn Word_3(x: u128) u64 {
199 return @as(u32, @truncate(x >> 32));
200 }
201 fn Word_4(x: u128) u64 {
202 return @as(u32, @truncate(x));
203 }
204 };
205 // 128x128 -> 256 wide multiply for platforms that don't have such an operation;
206 // many 64-bit platforms have this operation, but they tend to have hardware
207 // floating-point, so we don't bother with a special case for them here.
208
209 const product11: u64 = S.Word_1(a) * S.Word_1(b);
210 const product12: u64 = S.Word_1(a) * S.Word_2(b);
211 const product13: u64 = S.Word_1(a) * S.Word_3(b);
212 const product14: u64 = S.Word_1(a) * S.Word_4(b);
213 const product21: u64 = S.Word_2(a) * S.Word_1(b);
214 const product22: u64 = S.Word_2(a) * S.Word_2(b);
215 const product23: u64 = S.Word_2(a) * S.Word_3(b);
216 const product24: u64 = S.Word_2(a) * S.Word_4(b);
217 const product31: u64 = S.Word_3(a) * S.Word_1(b);
218 const product32: u64 = S.Word_3(a) * S.Word_2(b);
219 const product33: u64 = S.Word_3(a) * S.Word_3(b);
220 const product34: u64 = S.Word_3(a) * S.Word_4(b);
221 const product41: u64 = S.Word_4(a) * S.Word_1(b);
222 const product42: u64 = S.Word_4(a) * S.Word_2(b);
223 const product43: u64 = S.Word_4(a) * S.Word_3(b);
224 const product44: u64 = S.Word_4(a) * S.Word_4(b);
225
226 const sum0: u128 = @as(u128, product44);
227 const sum1: u128 = @as(u128, product34) +%
228 @as(u128, product43);
229 const sum2: u128 = @as(u128, product24) +%
230 @as(u128, product33) +%
231 @as(u128, product42);
232 const sum3: u128 = @as(u128, product14) +%
233 @as(u128, product23) +%
234 @as(u128, product32) +%
235 @as(u128, product41);
236 const sum4: u128 = @as(u128, product13) +%
237 @as(u128, product22) +%
238 @as(u128, product31);
239 const sum5: u128 = @as(u128, product12) +%
240 @as(u128, product21);
241 const sum6: u128 = @as(u128, product11);
242
243 const r0: u128 = (sum0 & Word_FullMask) +%
244 ((sum1 & Word_LoMask) << 32);
245 const r1: u128 = (sum0 >> 64) +%
246 ((sum1 >> 32) & Word_FullMask) +%
247 (sum2 & Word_FullMask) +%
248 ((sum3 << 32) & Word_HiMask);
249
250 lo.* = r0 +% (r1 << 64);
251 hi.* = (r1 >> 64) +%
252 (sum1 >> 96) +%
253 (sum2 >> 64) +%
254 (sum3 >> 32) +%
255 sum4 +%
256 (sum5 << 32) +%
257 (sum6 << 64);
258 },
259 else => @compileError("unsupported"),
260 }
261}
262
263pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeInfo(T).float.bits)) i32 {
264 const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
265 const integerBit = @as(Z, 1) << std.math.floatFractionalBits(T);
266
267 const shift = @clz(significand.*) - @clz(integerBit);
268 significand.* <<= @as(std.math.Log2Int(Z), @intCast(shift));
269 return @as(i32, 1) - shift;
270}
271
272pub inline fn fneg(a: anytype) @TypeOf(a) {
273 const F = @TypeOf(a);
274 const bits = @typeInfo(F).float.bits;
275 const U = @Int(.unsigned, bits);
276 const sign_bit_mask = @as(U, 1) << (bits - 1);
277 const negated = @as(U, @bitCast(a)) ^ sign_bit_mask;
278 return @bitCast(negated);
279}
280
281/// Allows to access underlying bits as two equally sized lower and higher
282/// signed or unsigned integers.
283pub fn HalveInt(comptime T: type, comptime signed_half: bool) type {
284 return extern union {
285 pub const bits = @divExact(@typeInfo(T).int.bits, 2);
286 pub const HalfTU = std.meta.Int(.unsigned, bits);
287 pub const HalfTS = std.meta.Int(.signed, bits);
288 pub const HalfT = if (signed_half) HalfTS else HalfTU;
289
290 all: T,
291 s: if (native_endian == .little)
292 extern struct { low: HalfT, high: HalfT }
293 else
294 extern struct { high: HalfT, low: HalfT },
295 };
296}
lib/compiler_rt/comparef.zig+144
...@@ -1,5 +1,149 @@...@@ -1,5 +1,149 @@
1const std = @import("std");1const std = @import("std");
22
3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
5
6comptime {
7 if (compiler_rt.want_aeabi) {
8 symbol(&__aeabi_fcmpun, "__aeabi_fcmpun");
9 } else {
10 symbol(&__unordsf2, "__unordsf2");
11 }
12
13 symbol(&__unordxf2, "__unordxf2");
14
15 symbol(&__eqhf2, "__eqhf2");
16 symbol(&__nehf2, "__nehf2");
17 symbol(&__lehf2, "__lehf2");
18 symbol(&__cmphf2, "__cmphf2");
19 symbol(&__lthf2, "__lthf2");
20
21 if (compiler_rt.want_aeabi) {
22 symbol(&__aeabi_fcmpeq, "__aeabi_fcmpeq");
23 symbol(&__aeabi_fcmplt, "__aeabi_fcmplt");
24 symbol(&__aeabi_fcmple, "__aeabi_fcmple");
25 } else {
26 symbol(&__eqsf2, "__eqsf2");
27 symbol(&__nesf2, "__nesf2");
28 symbol(&__lesf2, "__lesf2");
29 symbol(&__cmpsf2, "__cmpsf2");
30 symbol(&__ltsf2, "__ltsf2");
31 }
32
33 if (compiler_rt.want_ppc_abi) {
34 symbol(&__unordtf2, "__unordkf2");
35 } else if (compiler_rt.want_sparc_abi) {
36 // These exports are handled in cmptf2.zig because unordered comparisons
37 // are based on calling _Qp_cmp.
38 }
39 symbol(&__unordtf2, "__unordtf2");
40 symbol(&__unordhf2, "__unordhf2");
41}
42
43pub fn __unordhf2(a: f16, b: f16) callconv(.c) i32 {
44 return unordcmp(f16, a, b);
45}
46
47pub fn __unordtf2(a: f128, b: f128) callconv(.c) i32 {
48 return unordcmp(f128, a, b);
49}
50
51/// "These functions calculate a <=> b. That is, if a is less than b, they return -1;
52/// if a is greater than b, they return 1; and if a and b are equal they return 0.
53/// If either argument is NaN they return 1..."
54///
55/// Note that this matches the definition of `__lesf2`, `__eqsf2`, `__nesf2`, `__cmpsf2`,
56/// and `__ltsf2`.
57fn __cmpsf2(a: f32, b: f32) callconv(.c) i32 {
58 return @intFromEnum(cmpf2(f32, LE, a, b));
59}
60
61/// "These functions return a value less than or equal to zero if neither argument is NaN,
62/// and a is less than or equal to b."
63pub fn __lesf2(a: f32, b: f32) callconv(.c) i32 {
64 return __cmpsf2(a, b);
65}
66
67/// "These functions return zero if neither argument is NaN, and a and b are equal."
68/// Note that due to some kind of historical accident, __eqsf2 and __nesf2 are defined
69/// to have the same return value.
70pub fn __eqsf2(a: f32, b: f32) callconv(.c) i32 {
71 return __cmpsf2(a, b);
72}
73
74/// "These functions return a nonzero value if either argument is NaN, or if a and b are unequal."
75/// Note that due to some kind of historical accident, __eqsf2 and __nesf2 are defined
76/// to have the same return value.
77pub fn __nesf2(a: f32, b: f32) callconv(.c) i32 {
78 return __cmpsf2(a, b);
79}
80
81/// "These functions return a value less than zero if neither argument is NaN, and a
82/// is strictly less than b."
83pub fn __ltsf2(a: f32, b: f32) callconv(.c) i32 {
84 return __cmpsf2(a, b);
85}
86
87fn __aeabi_fcmpeq(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 {
88 return @intFromBool(cmpf2(f32, LE, a, b) == .Equal);
89}
90
91fn __aeabi_fcmplt(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 {
92 return @intFromBool(cmpf2(f32, LE, a, b) == .Less);
93}
94
95fn __aeabi_fcmple(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 {
96 return @intFromBool(cmpf2(f32, LE, a, b) != .Greater);
97}
98
99/// "These functions calculate a <=> b. That is, if a is less than b, they return -1;
100/// if a is greater than b, they return 1; and if a and b are equal they return 0.
101/// If either argument is NaN they return 1..."
102///
103/// Note that this matches the definition of `__lehf2`, `__eqhf2`, `__nehf2`, `__cmphf2`,
104/// and `__lthf2`.
105fn __cmphf2(a: f16, b: f16) callconv(.c) i32 {
106 return @intFromEnum(cmpf2(f16, LE, a, b));
107}
108
109/// "These functions return a value less than or equal to zero if neither argument is NaN,
110/// and a is less than or equal to b."
111fn __lehf2(a: f16, b: f16) callconv(.c) i32 {
112 return __cmphf2(a, b);
113}
114
115/// "These functions return zero if neither argument is NaN, and a and b are equal."
116/// Note that due to some kind of historical accident, __eqhf2 and __nehf2 are defined
117/// to have the same return value.
118fn __eqhf2(a: f16, b: f16) callconv(.c) i32 {
119 return __cmphf2(a, b);
120}
121
122/// "These functions return a nonzero value if either argument is NaN, or if a and b are unequal."
123/// Note that due to some kind of historical accident, __eqhf2 and __nehf2 are defined
124/// to have the same return value.
125fn __nehf2(a: f16, b: f16) callconv(.c) i32 {
126 return __cmphf2(a, b);
127}
128
129/// "These functions return a value less than zero if neither argument is NaN, and a
130/// is strictly less than b."
131fn __lthf2(a: f16, b: f16) callconv(.c) i32 {
132 return __cmphf2(a, b);
133}
134
135fn __unordxf2(a: f80, b: f80) callconv(.c) i32 {
136 return unordcmp(f80, a, b);
137}
138
139pub fn __unordsf2(a: f32, b: f32) callconv(.c) i32 {
140 return unordcmp(f32, a, b);
141}
142
143fn __aeabi_fcmpun(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 {
144 return unordcmp(f32, a, b);
145}
146
3pub const LE = enum(i32) {147pub const LE = enum(i32) {
4 Less = -1,148 Less = -1,
5 Equal = 0,149 Equal = 0,
lib/compiler_rt/comparesf2_test.zig+5-5
...@@ -5,15 +5,15 @@...@@ -5,15 +5,15 @@
5const std = @import("std");5const std = @import("std");
6const builtin = @import("builtin");6const builtin = @import("builtin");
77
8const __eqsf2 = @import("./cmpsf2.zig").__eqsf2;8const __eqsf2 = @import("./comparef.zig").__eqsf2;
9const __lesf2 = @import("./cmpsf2.zig").__lesf2;9const __lesf2 = @import("./comparef.zig").__lesf2;
10const __ltsf2 = @import("./cmpsf2.zig").__ltsf2;10const __ltsf2 = @import("./comparef.zig").__ltsf2;
11const __nesf2 = @import("./cmpsf2.zig").__nesf2;11const __nesf2 = @import("./comparef.zig").__nesf2;
1212
13const __gesf2 = @import("./gesf2.zig").__gesf2;13const __gesf2 = @import("./gesf2.zig").__gesf2;
14const __gtsf2 = @import("./gesf2.zig").__gtsf2;14const __gtsf2 = @import("./gesf2.zig").__gtsf2;
1515
16const __unordsf2 = @import("./unordsf2.zig").__unordsf2;16const __unordsf2 = @import("./comparef.zig").__unordsf2;
1717
18const TestVector = struct {18const TestVector = struct {
19 a: f32,19 a: f32,
lib/compiler_rt/cos.zig+4-4
...@@ -3,7 +3,7 @@ const math = std.math;...@@ -3,7 +3,7 @@ const math = std.math;
3const mem = std.mem;3const mem = std.mem;
4const expect = std.testing.expect;4const expect = std.testing.expect;
55
6const common = @import("common.zig");6const compiler_rt = @import("../compiler_rt.zig");
7const symbol = @import("../compiler_rt.zig").symbol;7const symbol = @import("../compiler_rt.zig").symbol;
8const trig = @import("trig.zig");8const trig = @import("trig.zig");
9const rem_pio2 = @import("rem_pio2.zig").rem_pio2;9const rem_pio2 = @import("rem_pio2.zig").rem_pio2;
...@@ -14,7 +14,7 @@ comptime {...@@ -14,7 +14,7 @@ comptime {
14 symbol(&cosf, "cosf");14 symbol(&cosf, "cosf");
15 symbol(&cos, "cos");15 symbol(&cos, "cos");
16 symbol(&__cosx, "__cosx");16 symbol(&__cosx, "__cosx");
17 if (common.want_ppc_abi) {17 if (compiler_rt.want_ppc_abi) {
18 symbol(&cosq, "cosf128");18 symbol(&cosq, "cosf128");
19 }19 }
20 symbol(&cosq, "cosq");20 symbol(&cosq, "cosq");
...@@ -40,7 +40,7 @@ pub fn cosf(x: f32) callconv(.c) f32 {...@@ -40,7 +40,7 @@ pub fn cosf(x: f32) callconv(.c) f32 {
40 if (ix <= 0x3f490fda) { // |x| ~<= pi/440 if (ix <= 0x3f490fda) { // |x| ~<= pi/4
41 if (ix < 0x39800000) { // |x| < 2**-1241 if (ix < 0x39800000) { // |x| < 2**-12
42 // raise inexact if x != 042 // raise inexact if x != 0
43 if (common.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120);43 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120);
44 return 1.0;44 return 1.0;
45 }45 }
46 return trig.__cosdf(x);46 return trig.__cosdf(x);
...@@ -91,7 +91,7 @@ pub fn cos(x: f64) callconv(.c) f64 {...@@ -91,7 +91,7 @@ pub fn cos(x: f64) callconv(.c) f64 {
91 if (ix <= 0x3fe921fb) {91 if (ix <= 0x3fe921fb) {
92 if (ix < 0x3e46a09e) { // |x| < 2**-27 * sqrt(2)92 if (ix < 0x3e46a09e) { // |x| < 2**-27 * sqrt(2)
93 // raise inexact if x!=093 // raise inexact if x!=0
94 if (common.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120);94 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120);
95 return 1.0;95 return 1.0;
96 }96 }
97 return trig.__cos(x, 0);97 return trig.__cos(x, 0);
lib/compiler_rt/divdf3.zig+4-4
...@@ -3,14 +3,14 @@...@@ -3,14 +3,14 @@
3//! https://github.com/llvm/llvm-project/commit/d674d96bc56c0f377879d01c9d8dfdaaa7859cdb/compiler-rt/lib/builtins/divdf3.c3//! https://github.com/llvm/llvm-project/commit/d674d96bc56c0f377879d01c9d8dfdaaa7859cdb/compiler-rt/lib/builtins/divdf3.c
44
5const std = @import("std");5const std = @import("std");
6const common = @import("common.zig");6const compiler_rt = @import("../compiler_rt.zig");
7const symbol = @import("../compiler_rt.zig").symbol;7const symbol = @import("../compiler_rt.zig").symbol;
88
9const normalize = common.normalize;9const normalize = compiler_rt.normalize;
10const wideMultiply = common.wideMultiply;10const wideMultiply = compiler_rt.wideMultiply;
1111
12comptime {12comptime {
13 if (common.want_aeabi) {13 if (compiler_rt.want_aeabi) {
14 symbol(&__aeabi_ddiv, "__aeabi_ddiv");14 symbol(&__aeabi_ddiv, "__aeabi_ddiv");
15 } else {15 } else {
16 symbol(&__divdf3, "__divdf3");16 symbol(&__divdf3, "__divdf3");
lib/compiler_rt/divhc3.zig+3-2
...@@ -1,10 +1,11 @@...@@ -1,10 +1,11 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const divc3 = @import("./divc3.zig");3const divc3 = @import("./divc3.zig");
3const Complex = @import("./mulc3.zig").Complex;4const Complex = @import("./mulc3.zig").Complex;
45
5comptime {6comptime {
6 if (@import("builtin").zig_backend != .stage2_c) {7 if (@import("builtin").zig_backend != .stage2_c) {
7 @export(&__divhc3, .{ .name = "__divhc3", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__divhc3, "__divhc3");
8 }9 }
9}10}
1011
lib/compiler_rt/divmodei4.zig+3-3
...@@ -3,7 +3,7 @@ const endian = builtin.cpu.arch.endian();...@@ -3,7 +3,7 @@ const endian = builtin.cpu.arch.endian();
33
4const std = @import("std");4const std = @import("std");
55
6const common = @import("common.zig");6const compiler_rt = @import("../compiler_rt.zig");
7const udivmod = @import("udivmodei4.zig").divmod;7const udivmod = @import("udivmodei4.zig").divmod;
8const symbol = @import("../compiler_rt.zig").symbol;8const symbol = @import("../compiler_rt.zig").symbol;
99
...@@ -36,7 +36,7 @@ fn divmod(q: ?[]u32, r: ?[]u32, u: []u32, v: []u32) !void {...@@ -36,7 +36,7 @@ fn divmod(q: ?[]u32, r: ?[]u32, u: []u32, v: []u32) !void {
36}36}
3737
38pub fn __divei4(q_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) void {38pub fn __divei4(q_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) void {
39 @setRuntimeSafety(common.test_safety);39 @setRuntimeSafety(compiler_rt.test_safety);
40 const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits));40 const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits));
41 const q: []u32 = @ptrCast(@alignCast(q_p[0..byte_size]));41 const q: []u32 = @ptrCast(@alignCast(q_p[0..byte_size]));
42 const u: []u32 = @ptrCast(@alignCast(u_p[0..byte_size]));42 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...@@ -45,7 +45,7 @@ pub fn __divei4(q_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) vo
45}45}
4646
47pub fn __modei4(r_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) void {47pub fn __modei4(r_p: [*]u8, u_p: [*]u8, v_p: [*]u8, bits: usize) callconv(.c) void {
48 @setRuntimeSafety(common.test_safety);48 @setRuntimeSafety(compiler_rt.test_safety);
49 const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits));49 const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits));
50 const r: []u32 = @ptrCast(@alignCast(r_p[0..byte_size]));50 const r: []u32 = @ptrCast(@alignCast(r_p[0..byte_size]));
51 const u: []u32 = @ptrCast(@alignCast(u_p[0..byte_size]));51 const u: []u32 = @ptrCast(@alignCast(u_p[0..byte_size]));
lib/compiler_rt/divsf3.zig+3-3
...@@ -4,12 +4,12 @@...@@ -4,12 +4,12 @@
44
5const std = @import("std");5const std = @import("std");
66
7const common = @import("common.zig");7const compiler_rt = @import("../compiler_rt.zig");
8const symbol = @import("../compiler_rt.zig").symbol;8const symbol = @import("../compiler_rt.zig").symbol;
9const normalize = common.normalize;9const normalize = compiler_rt.normalize;
1010
11comptime {11comptime {
12 if (common.want_aeabi) {12 if (compiler_rt.want_aeabi) {
13 symbol(&__aeabi_fdiv, "__aeabi_fdiv");13 symbol(&__aeabi_fdiv, "__aeabi_fdiv");
14 } else {14 } else {
15 symbol(&__divsf3, "__divsf3");15 symbol(&__divsf3, "__divsf3");
lib/compiler_rt/divtc3.zig+2-2
...@@ -1,11 +1,11 @@...@@ -1,11 +1,11 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const divc3 = @import("./divc3.zig");2const divc3 = @import("./divc3.zig");
3const Complex = @import("./mulc3.zig").Complex;3const Complex = @import("./mulc3.zig").Complex;
4const symbol = @import("../compiler_rt.zig").symbol;4const symbol = @import("../compiler_rt.zig").symbol;
55
6comptime {6comptime {
7 if (@import("builtin").zig_backend != .stage2_c) {7 if (@import("builtin").zig_backend != .stage2_c) {
8 if (common.want_ppc_abi)8 if (compiler_rt.want_ppc_abi)
9 symbol(&__divtc3, "__divkc3");9 symbol(&__divtc3, "__divkc3");
10 symbol(&__divtc3, "__divtc3");10 symbol(&__divtc3, "__divtc3");
11 }11 }
lib/compiler_rt/divtf3.zig+9-8
...@@ -1,17 +1,18 @@...@@ -1,17 +1,18 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
33
4const common = @import("common.zig");4const compiler_rt = @import("../compiler_rt.zig");
5const normalize = common.normalize;5const symbol = compiler_rt.symbol;
6const wideMultiply = common.wideMultiply;6const normalize = compiler_rt.normalize;
7const wideMultiply = compiler_rt.wideMultiply;
78
8comptime {9comptime {
9 if (common.want_ppc_abi) {10 if (compiler_rt.want_ppc_abi) {
10 @export(&__divtf3, .{ .name = "__divkf3", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__divtf3, "__divkf3");
11 } else if (common.want_sparc_abi) {12 } else if (compiler_rt.want_sparc_abi) {
12 @export(&_Qp_div, .{ .name = "_Qp_div", .linkage = common.linkage, .visibility = common.visibility });13 symbol(&_Qp_div, "_Qp_div");
13 }14 }
14 @export(&__divtf3, .{ .name = "__divtf3", .linkage = common.linkage, .visibility = common.visibility });15 symbol(&__divtf3, "__divtf3");
15}16}
1617
17pub fn __divtf3(a: f128, b: f128) callconv(.c) f128 {18pub fn __divtf3(a: f128, b: f128) callconv(.c) f128 {
lib/compiler_rt/divti3.zig deleted-39
...@@ -1,39 +0,0 @@
1const std = @import("std");
2const builtin = @import("builtin");
3const udivmod = @import("udivmod.zig").udivmod;
4const arch = builtin.cpu.arch;
5const common = @import("common.zig");
6
7comptime {
8 if (common.want_windows_v2u64_abi) {
9 @export(&__divti3_windows_x86_64, .{ .name = "__divti3", .linkage = common.linkage, .visibility = common.visibility });
10 } else {
11 @export(&__divti3, .{ .name = "__divti3", .linkage = common.linkage, .visibility = common.visibility });
12 }
13}
14
15pub fn __divti3(a: i128, b: i128) callconv(.c) i128 {
16 return div(a, b);
17}
18
19const v128 = @Vector(2, u64);
20
21fn __divti3_windows_x86_64(a: v128, b: v128) callconv(.c) v128 {
22 return @bitCast(div(@bitCast(a), @bitCast(b)));
23}
24
25inline fn div(a: i128, b: i128) i128 {
26 const s_a = a >> (128 - 1);
27 const s_b = b >> (128 - 1);
28
29 const an = (a ^ s_a) -% s_a;
30 const bn = (b ^ s_b) -% s_b;
31
32 const r = udivmod(u128, @bitCast(an), @bitCast(bn), null);
33 const s = s_a ^ s_b;
34 return (@as(i128, @bitCast(r)) ^ s) -% s;
35}
36
37test {
38 _ = @import("divti3_test.zig");
39}
lib/compiler_rt/divti3_test.zig+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1const __divti3 = @import("divti3.zig").__divti3;1const __divti3 = @import("udivmod.zig").__divti3;
2const testing = @import("std").testing;2const testing = @import("std").testing;
33
4fn test__divti3(a: i128, b: i128, expected: i128) !void {4fn test__divti3(a: i128, b: i128, expected: i128) !void {
lib/compiler_rt/divxf3.zig+5-4
...@@ -2,12 +2,13 @@ const std = @import("std");...@@ -2,12 +2,13 @@ const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const arch = builtin.cpu.arch;3const arch = builtin.cpu.arch;
44
5const common = @import("common.zig");5const compiler_rt = @import("../compiler_rt.zig");
6const normalize = common.normalize;6const symbol = compiler_rt.symbol;
7const wideMultiply = common.wideMultiply;7const normalize = compiler_rt.normalize;
8const wideMultiply = compiler_rt.wideMultiply;
89
9comptime {10comptime {
10 @export(&__divxf3, .{ .name = "__divxf3", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__divxf3, "__divxf3");
11}12}
1213
13pub fn __divxf3(a: f80, b: f80) callconv(.c) f80 {14pub fn __divxf3(a: f80, b: f80) callconv(.c) f80 {
lib/compiler_rt/emutls.zig+3-2
...@@ -5,7 +5,8 @@...@@ -5,7 +5,8 @@
55
6const std = @import("std");6const std = @import("std");
7const builtin = @import("builtin");7const builtin = @import("builtin");
8const common = @import("common.zig");8const compiler_rt = @import("../compiler_rt.zig");
9const symbol = compiler_rt.symbol;
910
10const abort = std.process.abort;11const abort = std.process.abort;
11const assert = std.debug.assert;12const assert = std.debug.assert;
...@@ -17,7 +18,7 @@ const gcc_word = usize;...@@ -17,7 +18,7 @@ const gcc_word = usize;
1718
18comptime {19comptime {
19 if (builtin.link_libc and (builtin.abi.isAndroid() or builtin.abi.isOpenHarmony() or builtin.os.tag == .openbsd)) {20 if (builtin.link_libc and (builtin.abi.isAndroid() or builtin.abi.isOpenHarmony() or builtin.os.tag == .openbsd)) {
20 @export(&__emutls_get_address, .{ .name = "__emutls_get_address", .linkage = common.linkage, .visibility = common.visibility });21 symbol(&__emutls_get_address, "__emutls_get_address");
21 }22 }
22}23}
2324
lib/compiler_rt/exp.zig+7-7
...@@ -13,7 +13,7 @@ const mem = std.mem;...@@ -13,7 +13,7 @@ const mem = std.mem;
13const expect = std.testing.expect;13const expect = std.testing.expect;
14const expectEqual = std.testing.expectEqual;14const expectEqual = std.testing.expectEqual;
1515
16const common = @import("common.zig");16const compiler_rt = @import("../compiler_rt.zig");
17const symbol = @import("../compiler_rt.zig").symbol;17const symbol = @import("../compiler_rt.zig").symbol;
1818
19comptime {19comptime {
...@@ -21,7 +21,7 @@ comptime {...@@ -21,7 +21,7 @@ comptime {
21 symbol(&expf, "expf");21 symbol(&expf, "expf");
22 symbol(&exp, "exp");22 symbol(&exp, "exp");
23 symbol(&__expx, "__expx");23 symbol(&__expx, "__expx");
24 if (common.want_ppc_abi) {24 if (compiler_rt.want_ppc_abi) {
25 symbol(&expq, "expf128");25 symbol(&expq, "expf128");
26 }26 }
27 symbol(&expq, "expq");27 symbol(&expq, "expq");
...@@ -61,7 +61,7 @@ pub fn expf(x_: f32) callconv(.c) f32 {...@@ -61,7 +61,7 @@ pub fn expf(x_: f32) callconv(.c) f32 {
61 return x * 0x1.0p127;61 return x * 0x1.0p127;
62 }62 }
63 if (sign != 0) {63 if (sign != 0) {
64 if (common.want_float_exceptions) mem.doNotOptimizeAway(-0x1.0p-149 / x); // overflow64 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(-0x1.0p-149 / x); // overflow
65 // x <= -103.97208465 // x <= -103.972084
66 if (hx >= 0x42CFF1B5) {66 if (hx >= 0x42CFF1B5) {
67 return 0;67 return 0;
...@@ -93,7 +93,7 @@ pub fn expf(x_: f32) callconv(.c) f32 {...@@ -93,7 +93,7 @@ pub fn expf(x_: f32) callconv(.c) f32 {
93 hi = x;93 hi = x;
94 lo = 0;94 lo = 0;
95 } else {95 } else {
96 if (common.want_float_exceptions) mem.doNotOptimizeAway(0x1.0p127 + x); // inexact96 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(0x1.0p127 + x); // inexact
97 return 1 + x;97 return 1 + x;
98 }98 }
9999
...@@ -137,11 +137,11 @@ pub fn exp(x_: f64) callconv(.c) f64 {...@@ -137,11 +137,11 @@ pub fn exp(x_: f64) callconv(.c) f64 {
137 }137 }
138 if (x > 709.782712893383973096) {138 if (x > 709.782712893383973096) {
139 // overflow if x != inf139 // overflow if x != inf
140 return if (common.want_float_exceptions) x * 0x1p1023 else std.math.inf(f64);140 return if (compiler_rt.want_float_exceptions) x * 0x1p1023 else std.math.inf(f64);
141 }141 }
142 if (x < -708.39641853226410622) {142 if (x < -708.39641853226410622) {
143 // underflow if x != -inf143 // underflow if x != -inf
144 if (common.want_float_exceptions) mem.doNotOptimizeAway(-0x0.0000000000001p-1022 / x);144 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(-0x0.0000000000001p-1022 / x);
145 if (x < -745.13321910194110842) {145 if (x < -745.13321910194110842) {
146 return 0;146 return 0;
147 }147 }
...@@ -174,7 +174,7 @@ pub fn exp(x_: f64) callconv(.c) f64 {...@@ -174,7 +174,7 @@ pub fn exp(x_: f64) callconv(.c) f64 {
174 lo = 0;174 lo = 0;
175 } else {175 } else {
176 // inexact if x != 0176 // inexact if x != 0
177 if (common.want_float_exceptions) mem.doNotOptimizeAway(0x1.0p1023 + x);177 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(0x1.0p1023 + x);
178 return 1 + x;178 return 1 + x;
179 }179 }
180180
lib/compiler_rt/exp2.zig+13-12
...@@ -11,18 +11,19 @@ const math = std.math;...@@ -11,18 +11,19 @@ const math = std.math;
11const mem = std.mem;11const mem = std.mem;
12const expect = std.testing.expect;12const expect = std.testing.expect;
13const expectEqual = std.testing.expectEqual;13const expectEqual = std.testing.expectEqual;
14const common = @import("common.zig");14const compiler_rt = @import("../compiler_rt.zig");
15const symbol = compiler_rt.symbol;
1516
16comptime {17comptime {
17 @export(&__exp2h, .{ .name = "__exp2h", .linkage = common.linkage, .visibility = common.visibility });18 symbol(&__exp2h, "__exp2h");
18 @export(&exp2f, .{ .name = "exp2f", .linkage = common.linkage, .visibility = common.visibility });19 symbol(&exp2f, "exp2f");
19 @export(&exp2, .{ .name = "exp2", .linkage = common.linkage, .visibility = common.visibility });20 symbol(&exp2, "exp2");
20 @export(&__exp2x, .{ .name = "__exp2x", .linkage = common.linkage, .visibility = common.visibility });21 symbol(&__exp2x, "__exp2x");
21 if (common.want_ppc_abi) {22 if (compiler_rt.want_ppc_abi) {
22 @export(&exp2q, .{ .name = "exp2f128", .linkage = common.linkage, .visibility = common.visibility });23 symbol(&exp2q, "exp2f128");
23 }24 }
24 @export(&exp2q, .{ .name = "exp2q", .linkage = common.linkage, .visibility = common.visibility });25 symbol(&exp2q, "exp2q");
25 @export(&exp2l, .{ .name = "exp2l", .linkage = common.linkage, .visibility = common.visibility });26 symbol(&exp2l, "exp2l");
26}27}
2728
28pub fn __exp2h(x: f16) callconv(.c) f16 {29pub fn __exp2h(x: f16) callconv(.c) f16 {
...@@ -54,7 +55,7 @@ pub fn exp2f(x: f32) callconv(.c) f32 {...@@ -54,7 +55,7 @@ pub fn exp2f(x: f32) callconv(.c) f32 {
54 // x < -12655 // x < -126
55 if (u >= 0x80000000) {56 if (u >= 0x80000000) {
56 if (u >= 0xC3160000 or u & 0x000FFFF != 0) {57 if (u >= 0xC3160000 or u & 0x000FFFF != 0) {
57 if (common.want_float_exceptions) mem.doNotOptimizeAway(-0x1.0p-149 / x);58 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(-0x1.0p-149 / x);
58 }59 }
59 // x <= -15060 // x <= -150
60 if (u >= 0xC3160000) {61 if (u >= 0xC3160000) {
...@@ -108,7 +109,7 @@ pub fn exp2(x: f64) callconv(.c) f64 {...@@ -108,7 +109,7 @@ pub fn exp2(x: f64) callconv(.c) f64 {
108 if (ix >= 0x408FF000) {109 if (ix >= 0x408FF000) {
109 // x >= 1024 or nan110 // x >= 1024 or nan
110 if (ix >= 0x40900000 and ux >> 63 == 0) {111 if (ix >= 0x40900000 and ux >> 63 == 0) {
111 return if (common.want_float_exceptions) x * 0x1p1023 else std.math.inf(f64);112 return if (compiler_rt.want_float_exceptions) x * 0x1p1023 else std.math.inf(f64);
112 }113 }
113 // -inf or -nan114 // -inf or -nan
114 if (ix >= 0x7FF00000) {115 if (ix >= 0x7FF00000) {
...@@ -118,7 +119,7 @@ pub fn exp2(x: f64) callconv(.c) f64 {...@@ -118,7 +119,7 @@ pub fn exp2(x: f64) callconv(.c) f64 {
118 if (ux >> 63 != 0) {119 if (ux >> 63 != 0) {
119 // underflow120 // underflow
120 if (x <= -1075 or x - 0x1.0p52 + 0x1.0p52 != x) {121 if (x <= -1075 or x - 0x1.0p52 + 0x1.0p52 != x) {
121 if (common.want_float_exceptions) mem.doNotOptimizeAway(@as(f32, @floatCast(-0x1.0p-149 / x)));122 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(@as(f32, @floatCast(-0x1.0p-149 / x)));
122 }123 }
123 if (x <= -1075) {124 if (x <= -1075) {
124 return 0;125 return 0;
lib/compiler_rt/extenddftf2.zig+3-3
...@@ -1,11 +1,11 @@...@@ -1,11 +1,11 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const extendf = @import("./extendf.zig").extendf;2const extendf = @import("./extendf.zig").extendf;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_ppc_abi) {6 if (compiler_rt.want_ppc_abi) {
7 symbol(&__extenddftf2, "__extenddfkf2");7 symbol(&__extenddftf2, "__extenddfkf2");
8 } else if (common.want_sparc_abi) {8 } else if (compiler_rt.want_sparc_abi) {
9 symbol(&_Qp_dtoq, "_Qp_dtoq");9 symbol(&_Qp_dtoq, "_Qp_dtoq");
10 }10 }
11 symbol(&__extenddftf2, "__extenddftf2");11 symbol(&__extenddftf2, "__extenddftf2");
lib/compiler_rt/extenddfxf2.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const extend_f80 = @import("./extendf.zig").extend_f80;3const extend_f80 = @import("./extendf.zig").extend_f80;
34
4comptime {5comptime {
5 @export(&__extenddfxf2, .{ .name = "__extenddfxf2", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__extenddfxf2, "__extenddfxf2");
6}7}
78
8pub fn __extenddfxf2(a: f64) callconv(.c) f80 {9pub fn __extenddfxf2(a: f64) callconv(.c) f80 {
lib/compiler_rt/extendf_test.zig+4-2
...@@ -1,12 +1,14 @@...@@ -1,12 +1,14 @@
1const builtin = @import("builtin");
2
1const std = @import("std");3const std = @import("std");
2const math = std.math;4const math = std.math;
3const builtin = @import("builtin");5
4const __extendhfsf2 = @import("extendhfsf2.zig").__extendhfsf2;6const __extendhfsf2 = @import("extendhfsf2.zig").__extendhfsf2;
5const __extendhftf2 = @import("extendhftf2.zig").__extendhftf2;7const __extendhftf2 = @import("extendhftf2.zig").__extendhftf2;
6const __extendsftf2 = @import("extendsftf2.zig").__extendsftf2;8const __extendsftf2 = @import("extendsftf2.zig").__extendsftf2;
7const __extenddftf2 = @import("extenddftf2.zig").__extenddftf2;9const __extenddftf2 = @import("extenddftf2.zig").__extenddftf2;
8const __extenddfxf2 = @import("extenddfxf2.zig").__extenddfxf2;10const __extenddfxf2 = @import("extenddfxf2.zig").__extenddfxf2;
9const F16T = @import("./common.zig").F16T;11const F16T = @import("../compiler_rt.zig").F16T;
1012
11fn test__extenddfxf2(a: f64, expected: u80) !void {13fn test__extenddfxf2(a: f64, expected: u80) !void {
12 const x = __extenddfxf2(a);14 const x = __extenddfxf2(a);
lib/compiler_rt/extendhfdf2.zig+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = @import("../compiler_rt.zig").symbol;2const symbol = @import("../compiler_rt.zig").symbol;
3const extendf = @import("./extendf.zig").extendf;3const extendf = @import("./extendf.zig").extendf;
44
...@@ -6,6 +6,6 @@ comptime {...@@ -6,6 +6,6 @@ comptime {
6 symbol(&__extendhfdf2, "__extendhfdf2");6 symbol(&__extendhfdf2, "__extendhfdf2");
7}7}
88
9pub fn __extendhfdf2(a: common.F16T(f64)) callconv(.c) f64 {9pub fn __extendhfdf2(a: compiler_rt.F16T(f64)) callconv(.c) f64 {
10 return extendf(f64, f16, @as(u16, @bitCast(a)));10 return extendf(f64, f16, @as(u16, @bitCast(a)));
11}11}
lib/compiler_rt/extendhfsf2.zig+5-5
...@@ -1,21 +1,21 @@...@@ -1,21 +1,21 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const extendf = @import("./extendf.zig").extendf;2const extendf = @import("./extendf.zig").extendf;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.gnu_f16_abi) {6 if (compiler_rt.gnu_f16_abi) {
7 symbol(&__gnu_h2f_ieee, "__gnu_h2f_ieee");7 symbol(&__gnu_h2f_ieee, "__gnu_h2f_ieee");
8 } else if (common.want_aeabi) {8 } else if (compiler_rt.want_aeabi) {
9 symbol(&__aeabi_h2f, "__aeabi_h2f");9 symbol(&__aeabi_h2f, "__aeabi_h2f");
10 }10 }
11 symbol(&__extendhfsf2, "__extendhfsf2");11 symbol(&__extendhfsf2, "__extendhfsf2");
12}12}
1313
14pub fn __extendhfsf2(a: common.F16T(f32)) callconv(.c) f32 {14pub fn __extendhfsf2(a: compiler_rt.F16T(f32)) callconv(.c) f32 {
15 return extendf(f32, f16, @as(u16, @bitCast(a)));15 return extendf(f32, f16, @as(u16, @bitCast(a)));
16}16}
1717
18fn __gnu_h2f_ieee(a: common.F16T(f32)) callconv(.c) f32 {18fn __gnu_h2f_ieee(a: compiler_rt.F16T(f32)) callconv(.c) f32 {
19 return extendf(f32, f16, @as(u16, @bitCast(a)));19 return extendf(f32, f16, @as(u16, @bitCast(a)));
20}20}
2121
lib/compiler_rt/extendhftf2.zig+4-3
...@@ -1,10 +1,11 @@...@@ -1,10 +1,11 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const extendf = @import("./extendf.zig").extendf;3const extendf = @import("./extendf.zig").extendf;
34
4comptime {5comptime {
5 @export(&__extendhftf2, .{ .name = "__extendhftf2", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__extendhftf2, "__extendhftf2");
6}7}
78
8pub fn __extendhftf2(a: common.F16T(f128)) callconv(.c) f128 {9pub fn __extendhftf2(a: compiler_rt.F16T(f128)) callconv(.c) f128 {
9 return extendf(f128, f16, @as(u16, @bitCast(a)));10 return extendf(f128, f16, @as(u16, @bitCast(a)));
10}11}
lib/compiler_rt/extendhfxf2.zig+4-3
...@@ -1,10 +1,11 @@...@@ -1,10 +1,11 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const extend_f80 = @import("./extendf.zig").extend_f80;3const extend_f80 = @import("./extendf.zig").extend_f80;
34
4comptime {5comptime {
5 @export(&__extendhfxf2, .{ .name = "__extendhfxf2", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__extendhfxf2, "__extendhfxf2");
6}7}
78
8fn __extendhfxf2(a: common.F16T(f80)) callconv(.c) f80 {9fn __extendhfxf2(a: compiler_rt.F16T(f80)) callconv(.c) f80 {
9 return extend_f80(f16, @as(u16, @bitCast(a)));10 return extend_f80(f16, @as(u16, @bitCast(a)));
10}11}
lib/compiler_rt/extendsfdf2.zig+5-4
...@@ -1,11 +1,12 @@...@@ -1,11 +1,12 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const extendf = @import("./extendf.zig").extendf;3const extendf = @import("./extendf.zig").extendf;
34
4comptime {5comptime {
5 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
6 @export(&__aeabi_f2d, .{ .name = "__aeabi_f2d", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__aeabi_f2d, "__aeabi_f2d");
7 } else {8 } else {
8 @export(&__extendsfdf2, .{ .name = "__extendsfdf2", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__extendsfdf2, "__extendsfdf2");
9 }10 }
10}11}
1112
lib/compiler_rt/extendsftf2.zig+7-6
...@@ -1,13 +1,14 @@...@@ -1,13 +1,14 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const extendf = @import("./extendf.zig").extendf;3const extendf = @import("./extendf.zig").extendf;
34
4comptime {5comptime {
5 if (common.want_ppc_abi) {6 if (compiler_rt.want_ppc_abi) {
6 @export(&__extendsftf2, .{ .name = "__extendsfkf2", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__extendsftf2, "__extendsfkf2");
7 } else if (common.want_sparc_abi) {8 } else if (compiler_rt.want_sparc_abi) {
8 @export(&_Qp_stoq, .{ .name = "_Qp_stoq", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&_Qp_stoq, "_Qp_stoq");
9 }10 }
10 @export(&__extendsftf2, .{ .name = "__extendsftf2", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__extendsftf2, "__extendsftf2");
11}12}
1213
13pub fn __extendsftf2(a: f32) callconv(.c) f128 {14pub fn __extendsftf2(a: f32) callconv(.c) f128 {
lib/compiler_rt/fabs.zig+10-9
...@@ -1,18 +1,19 @@...@@ -1,18 +1,19 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const arch = builtin.cpu.arch;3const arch = builtin.cpu.arch;
4const common = @import("common.zig");4const compiler_rt = @import("../compiler_rt.zig");
5const symbol = compiler_rt.symbol;
56
6comptime {7comptime {
7 @export(&__fabsh, .{ .name = "__fabsh", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__fabsh, "__fabsh");
8 @export(&fabsf, .{ .name = "fabsf", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&fabsf, "fabsf");
9 @export(&fabs, .{ .name = "fabs", .linkage = common.linkage, .visibility = common.visibility });10 symbol(&fabs, "fabs");
10 @export(&__fabsx, .{ .name = "__fabsx", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__fabsx, "__fabsx");
11 if (common.want_ppc_abi) {12 if (compiler_rt.want_ppc_abi) {
12 @export(&fabsq, .{ .name = "fabsf128", .linkage = common.linkage, .visibility = common.visibility });13 symbol(&fabsq, "fabsf128");
13 }14 }
14 @export(&fabsq, .{ .name = "fabsq", .linkage = common.linkage, .visibility = common.visibility });15 symbol(&fabsq, "fabsq");
15 @export(&fabsl, .{ .name = "fabsl", .linkage = common.linkage, .visibility = common.visibility });16 symbol(&fabsl, "fabsl");
16}17}
1718
18pub fn __fabsh(a: f16) callconv(.c) f16 {19pub fn __fabsh(a: f16) callconv(.c) f16 {
lib/compiler_rt/fixdfdi.zig+7-6
...@@ -1,15 +1,16 @@...@@ -1,15 +1,16 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const common = @import("./common.zig");2const compiler_rt = @import("../compiler_rt.zig");
3const symbol = compiler_rt.symbol;
3const intFromFloat = @import("./int_from_float.zig").intFromFloat;4const intFromFloat = @import("./int_from_float.zig").intFromFloat;
45
5comptime {6comptime {
6 if (common.want_aeabi) {7 if (compiler_rt.want_aeabi) {
7 @export(&__aeabi_d2lz, .{ .name = "__aeabi_d2lz", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__aeabi_d2lz, "__aeabi_d2lz");
8 } else {9 } else {
9 if (common.want_windows_arm_abi) {10 if (compiler_rt.want_windows_arm_abi) {
10 @export(&__fixdfdi, .{ .name = "__dtoi64", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__fixdfdi, "__dtoi64");
11 }12 }
12 @export(&__fixdfdi, .{ .name = "__fixdfdi", .linkage = common.linkage, .visibility = common.visibility });13 symbol(&__fixdfdi, "__fixdfdi");
13 }14 }
14}15}
1516
lib/compiler_rt/fixdfei.zig+3-2
...@@ -1,10 +1,11 @@...@@ -1,10 +1,11 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
4const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat;5const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat;
56
6comptime {7comptime {
7 @export(&__fixdfei, .{ .name = "__fixdfei", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__fixdfei, "__fixdfei");
8}9}
910
10pub fn __fixdfei(r: [*]u8, bits: usize, a: f64) callconv(.c) void {11pub fn __fixdfei(r: [*]u8, bits: usize, a: f64) callconv(.c) void {
lib/compiler_rt/fixdfsi.zig+2-2
...@@ -1,9 +1,9 @@...@@ -1,9 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const intFromFloat = @import("./int_from_float.zig").intFromFloat;2const intFromFloat = @import("./int_from_float.zig").intFromFloat;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
7 symbol(&__aeabi_d2iz, "__aeabi_d2iz");7 symbol(&__aeabi_d2iz, "__aeabi_d2iz");
8 } else {8 } else {
9 symbol(&__fixdfsi, "__fixdfsi");9 symbol(&__fixdfsi, "__fixdfsi");
lib/compiler_rt/fixdfti.zig+2-2
...@@ -1,9 +1,9 @@...@@ -1,9 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const intFromFloat = @import("./int_from_float.zig").intFromFloat;2const intFromFloat = @import("./int_from_float.zig").intFromFloat;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_windows_v2u64_abi) {6 if (compiler_rt.want_windows_v2u64_abi) {
7 symbol(&__fixdfti_windows_x86_64, "__fixdfti");7 symbol(&__fixdfti_windows_x86_64, "__fixdfti");
8 } else {8 } else {
9 symbol(&__fixdfti, "__fixdfti");9 symbol(&__fixdfti, "__fixdfti");
lib/compiler_rt/fixhfdi.zig deleted-10
...@@ -1,10 +0,0 @@
1const common = @import("./common.zig");
2const intFromFloat = @import("./int_from_float.zig").intFromFloat;
3
4comptime {
5 @export(&__fixhfdi, .{ .name = "__fixhfdi", .linkage = common.linkage, .visibility = common.visibility });
6}
7
8fn __fixhfdi(a: f16) callconv(.c) i64 {
9 return intFromFloat(i64, a);
10}
lib/compiler_rt/fixhfei.zig+3-2
...@@ -1,10 +1,11 @@...@@ -1,10 +1,11 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
4const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat;5const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat;
56
6comptime {7comptime {
7 @export(&__fixhfei, .{ .name = "__fixhfei", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__fixhfei, "__fixhfei");
8}9}
910
10pub fn __fixhfei(r: [*]u8, bits: usize, a: f16) callconv(.c) void {11pub fn __fixhfei(r: [*]u8, bits: usize, a: f16) callconv(.c) void {
lib/compiler_rt/fixhfsi.zig deleted-10
...@@ -1,10 +0,0 @@
1const common = @import("./common.zig");
2const intFromFloat = @import("./int_from_float.zig").intFromFloat;
3
4comptime {
5 @export(&__fixhfsi, .{ .name = "__fixhfsi", .linkage = common.linkage, .visibility = common.visibility });
6}
7
8fn __fixhfsi(a: f16) callconv(.c) i32 {
9 return intFromFloat(i32, a);
10}
lib/compiler_rt/fixhfti.zig deleted-21
...@@ -1,21 +0,0 @@
1const builtin = @import("builtin");
2const common = @import("./common.zig");
3const intFromFloat = @import("./int_from_float.zig").intFromFloat;
4
5comptime {
6 if (common.want_windows_v2u64_abi) {
7 @export(&__fixhfti_windows_x86_64, .{ .name = "__fixhfti", .linkage = common.linkage, .visibility = common.visibility });
8 } else {
9 @export(&__fixhfti, .{ .name = "__fixhfti", .linkage = common.linkage, .visibility = common.visibility });
10 }
11}
12
13pub fn __fixhfti(a: f16) callconv(.c) i128 {
14 return intFromFloat(i128, a);
15}
16
17const v2u64 = @Vector(2, u64);
18
19fn __fixhfti_windows_x86_64(a: f16) callconv(.c) v2u64 {
20 return @bitCast(intFromFloat(i128, a));
21}
lib/compiler_rt/fixsfdi.zig+3-3
...@@ -1,13 +1,13 @@...@@ -1,13 +1,13 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const common = @import("./common.zig");2const compiler_rt = @import("../compiler_rt.zig");
3const intFromFloat = @import("./int_from_float.zig").intFromFloat;3const intFromFloat = @import("./int_from_float.zig").intFromFloat;
4const symbol = @import("../compiler_rt.zig").symbol;4const symbol = @import("../compiler_rt.zig").symbol;
55
6comptime {6comptime {
7 if (common.want_aeabi) {7 if (compiler_rt.want_aeabi) {
8 symbol(&__aeabi_f2lz, "__aeabi_f2lz");8 symbol(&__aeabi_f2lz, "__aeabi_f2lz");
9 } else {9 } else {
10 if (common.want_windows_arm_abi) {10 if (compiler_rt.want_windows_arm_abi) {
11 symbol(&__fixsfdi, "__stoi64");11 symbol(&__fixsfdi, "__stoi64");
12 }12 }
13 symbol(&__fixsfdi, "__fixsfdi");13 symbol(&__fixsfdi, "__fixsfdi");
lib/compiler_rt/fixsfei.zig+3-2
...@@ -1,10 +1,11 @@...@@ -1,10 +1,11 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
4const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat;5const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat;
56
6comptime {7comptime {
7 @export(&__fixsfei, .{ .name = "__fixsfei", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__fixsfei, "__fixsfei");
8}9}
910
10pub fn __fixsfei(r: [*]u8, bits: usize, a: f32) callconv(.c) void {11pub fn __fixsfei(r: [*]u8, bits: usize, a: f32) callconv(.c) void {
lib/compiler_rt/fixsfsi.zig+5-4
...@@ -1,11 +1,12 @@...@@ -1,11 +1,12 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const intFromFloat = @import("./int_from_float.zig").intFromFloat;3const intFromFloat = @import("./int_from_float.zig").intFromFloat;
34
4comptime {5comptime {
5 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
6 @export(&__aeabi_f2iz, .{ .name = "__aeabi_f2iz", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__aeabi_f2iz, "__aeabi_f2iz");
7 } else {8 } else {
8 @export(&__fixsfsi, .{ .name = "__fixsfsi", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__fixsfsi, "__fixsfsi");
9 }10 }
10}11}
1112
lib/compiler_rt/fixsfti.zig+5-4
...@@ -1,12 +1,13 @@...@@ -1,12 +1,13 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const common = @import("./common.zig");2const compiler_rt = @import("../compiler_rt.zig");
3const symbol = compiler_rt.symbol;
3const intFromFloat = @import("./int_from_float.zig").intFromFloat;4const intFromFloat = @import("./int_from_float.zig").intFromFloat;
45
5comptime {6comptime {
6 if (common.want_windows_v2u64_abi) {7 if (compiler_rt.want_windows_v2u64_abi) {
7 @export(&__fixsfti_windows_x86_64, .{ .name = "__fixsfti", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__fixsfti_windows_x86_64, "__fixsfti");
8 } else {9 } else {
9 @export(&__fixsfti, .{ .name = "__fixsfti", .linkage = common.linkage, .visibility = common.visibility });10 symbol(&__fixsfti, "__fixsfti");
10 }11 }
11}12}
1213
lib/compiler_rt/fixtfdi.zig+3-3
...@@ -1,11 +1,11 @@...@@ -1,11 +1,11 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const intFromFloat = @import("./int_from_float.zig").intFromFloat;2const intFromFloat = @import("./int_from_float.zig").intFromFloat;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_ppc_abi) {6 if (compiler_rt.want_ppc_abi) {
7 symbol(&__fixtfdi, "__fixkfdi");7 symbol(&__fixtfdi, "__fixkfdi");
8 } else if (common.want_sparc_abi) {8 } else if (compiler_rt.want_sparc_abi) {
9 symbol(&_Qp_qtox, "_Qp_qtox");9 symbol(&_Qp_qtox, "_Qp_qtox");
10 }10 }
11 symbol(&__fixtfdi, "__fixtfdi");11 symbol(&__fixtfdi, "__fixtfdi");
lib/compiler_rt/fixtfei.zig+3-2
...@@ -1,10 +1,11 @@...@@ -1,10 +1,11 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
4const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat;5const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat;
56
6comptime {7comptime {
7 @export(&__fixtfei, .{ .name = "__fixtfei", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__fixtfei, "__fixtfei");
8}9}
910
10pub fn __fixtfei(r: [*]u8, bits: usize, a: f128) callconv(.c) void {11pub fn __fixtfei(r: [*]u8, bits: usize, a: f128) callconv(.c) void {
lib/compiler_rt/fixtfsi.zig+3-3
...@@ -1,11 +1,11 @@...@@ -1,11 +1,11 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = @import("../compiler_rt.zig").symbol;2const symbol = @import("../compiler_rt.zig").symbol;
3const intFromFloat = @import("./int_from_float.zig").intFromFloat;3const intFromFloat = @import("./int_from_float.zig").intFromFloat;
44
5comptime {5comptime {
6 if (common.want_ppc_abi) {6 if (compiler_rt.want_ppc_abi) {
7 symbol(&__fixtfsi, "__fixkfsi");7 symbol(&__fixtfsi, "__fixkfsi");
8 } else if (common.want_sparc_abi) {8 } else if (compiler_rt.want_sparc_abi) {
9 symbol(&_Qp_qtoi, "_Qp_qtoi");9 symbol(&_Qp_qtoi, "_Qp_qtoi");
10 }10 }
11 symbol(&__fixtfsi, "__fixtfsi");11 symbol(&__fixtfsi, "__fixtfsi");
lib/compiler_rt/fixtfti.zig+3-3
...@@ -1,12 +1,12 @@...@@ -1,12 +1,12 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const intFromFloat = @import("./int_from_float.zig").intFromFloat;2const intFromFloat = @import("./int_from_float.zig").intFromFloat;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_windows_v2u64_abi) {6 if (compiler_rt.want_windows_v2u64_abi) {
7 symbol(&__fixtfti_windows_x86_64, "__fixtfti");7 symbol(&__fixtfti_windows_x86_64, "__fixtfti");
8 } else {8 } else {
9 if (common.want_ppc_abi)9 if (compiler_rt.want_ppc_abi)
10 symbol(&__fixtfti, "__fixkfti");10 symbol(&__fixtfti, "__fixkfti");
11 symbol(&__fixtfti, "__fixtfti");11 symbol(&__fixtfti, "__fixtfti");
12 }12 }
lib/compiler_rt/fixunsdfdi.zig+7-6
...@@ -1,15 +1,16 @@...@@ -1,15 +1,16 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const common = @import("./common.zig");2const compiler_rt = @import("../compiler_rt.zig");
3const symbol = compiler_rt.symbol;
3const intFromFloat = @import("./int_from_float.zig").intFromFloat;4const intFromFloat = @import("./int_from_float.zig").intFromFloat;
45
5comptime {6comptime {
6 if (common.want_aeabi) {7 if (compiler_rt.want_aeabi) {
7 @export(&__aeabi_d2ulz, .{ .name = "__aeabi_d2ulz", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__aeabi_d2ulz, "__aeabi_d2ulz");
8 } else {9 } else {
9 if (common.want_windows_arm_abi) {10 if (compiler_rt.want_windows_arm_abi) {
10 @export(&__fixunsdfdi, .{ .name = "__dtou64", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__fixunsdfdi, "__dtou64");
11 }12 }
12 @export(&__fixunsdfdi, .{ .name = "__fixunsdfdi", .linkage = common.linkage, .visibility = common.visibility });13 symbol(&__fixunsdfdi, "__fixunsdfdi");
13 }14 }
14}15}
1516
lib/compiler_rt/fixunsdfsi.zig+5-4
...@@ -1,11 +1,12 @@...@@ -1,11 +1,12 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const intFromFloat = @import("./int_from_float.zig").intFromFloat;3const intFromFloat = @import("./int_from_float.zig").intFromFloat;
34
4comptime {5comptime {
5 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
6 @export(&__aeabi_d2uiz, .{ .name = "__aeabi_d2uiz", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__aeabi_d2uiz, "__aeabi_d2uiz");
7 } else {8 } else {
8 @export(&__fixunsdfsi, .{ .name = "__fixunsdfsi", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__fixunsdfsi, "__fixunsdfsi");
9 }10 }
10}11}
1112
lib/compiler_rt/fixunsdfti.zig+2-2
...@@ -1,9 +1,9 @@...@@ -1,9 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = @import("../compiler_rt.zig").symbol;2const symbol = @import("../compiler_rt.zig").symbol;
3const intFromFloat = @import("./int_from_float.zig").intFromFloat;3const intFromFloat = @import("./int_from_float.zig").intFromFloat;
44
5comptime {5comptime {
6 if (common.want_windows_v2u64_abi) {6 if (compiler_rt.want_windows_v2u64_abi) {
7 symbol(&__fixunsdfti_windows_x86_64, "__fixunsdfti");7 symbol(&__fixunsdfti_windows_x86_64, "__fixunsdfti");
8 } else {8 } else {
9 symbol(&__fixunsdfti, "__fixunsdfti");9 symbol(&__fixunsdfti, "__fixunsdfti");
lib/compiler_rt/fixunshfsi.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const intFromFloat = @import("./int_from_float.zig").intFromFloat;3const intFromFloat = @import("./int_from_float.zig").intFromFloat;
34
4comptime {5comptime {
5 @export(&__fixunshfsi, .{ .name = "__fixunshfsi", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__fixunshfsi, "__fixunshfsi");
6}7}
78
8fn __fixunshfsi(a: f16) callconv(.c) u32 {9fn __fixunshfsi(a: f16) callconv(.c) u32 {
lib/compiler_rt/fixunshfti.zig+2-2
...@@ -1,9 +1,9 @@...@@ -1,9 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const intFromFloat = @import("./int_from_float.zig").intFromFloat;2const intFromFloat = @import("./int_from_float.zig").intFromFloat;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_windows_v2u64_abi) {6 if (compiler_rt.want_windows_v2u64_abi) {
7 symbol(&__fixunshfti_windows_x86_64, "__fixunshfti");7 symbol(&__fixunshfti_windows_x86_64, "__fixunshfti");
8 } else {8 } else {
9 symbol(&__fixunshfti, "__fixunshfti");9 symbol(&__fixunshfti, "__fixunshfti");
lib/compiler_rt/fixunssfdi.zig+7-6
...@@ -1,15 +1,16 @@...@@ -1,15 +1,16 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const common = @import("./common.zig");2const compiler_rt = @import("../compiler_rt.zig");
3const symbol = compiler_rt.symbol;
3const intFromFloat = @import("./int_from_float.zig").intFromFloat;4const intFromFloat = @import("./int_from_float.zig").intFromFloat;
45
5comptime {6comptime {
6 if (common.want_aeabi) {7 if (compiler_rt.want_aeabi) {
7 @export(&__aeabi_f2ulz, .{ .name = "__aeabi_f2ulz", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__aeabi_f2ulz, "__aeabi_f2ulz");
8 } else {9 } else {
9 if (common.want_windows_arm_abi) {10 if (compiler_rt.want_windows_arm_abi) {
10 @export(&__fixunssfdi, .{ .name = "__stou64", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__fixunssfdi, "__stou64");
11 }12 }
12 @export(&__fixunssfdi, .{ .name = "__fixunssfdi", .linkage = common.linkage, .visibility = common.visibility });13 symbol(&__fixunssfdi, "__fixunssfdi");
13 }14 }
14}15}
1516
lib/compiler_rt/fixunssfsi.zig+5-4
...@@ -1,11 +1,12 @@...@@ -1,11 +1,12 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const intFromFloat = @import("./int_from_float.zig").intFromFloat;3const intFromFloat = @import("./int_from_float.zig").intFromFloat;
34
4comptime {5comptime {
5 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
6 @export(&__aeabi_f2uiz, .{ .name = "__aeabi_f2uiz", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__aeabi_f2uiz, "__aeabi_f2uiz");
7 } else {8 } else {
8 @export(&__fixunssfsi, .{ .name = "__fixunssfsi", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__fixunssfsi, "__fixunssfsi");
9 }10 }
10}11}
1112
lib/compiler_rt/fixunssfti.zig+2-2
...@@ -1,10 +1,10 @@...@@ -1,10 +1,10 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const common = @import("./common.zig");2const compiler_rt = @import("../compiler_rt.zig");
3const intFromFloat = @import("./int_from_float.zig").intFromFloat;3const intFromFloat = @import("./int_from_float.zig").intFromFloat;
4const symbol = @import("../compiler_rt.zig").symbol;4const symbol = @import("../compiler_rt.zig").symbol;
55
6comptime {6comptime {
7 if (common.want_windows_v2u64_abi) {7 if (compiler_rt.want_windows_v2u64_abi) {
8 symbol(&__fixunssfti_windows_x86_64, "__fixunssfti");8 symbol(&__fixunssfti_windows_x86_64, "__fixunssfti");
9 } else {9 } else {
10 symbol(&__fixunssfti, "__fixunssfti");10 symbol(&__fixunssfti, "__fixunssfti");
lib/compiler_rt/fixunstfdi.zig+7-6
...@@ -1,13 +1,14 @@...@@ -1,13 +1,14 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const intFromFloat = @import("./int_from_float.zig").intFromFloat;3const intFromFloat = @import("./int_from_float.zig").intFromFloat;
34
4comptime {5comptime {
5 if (common.want_ppc_abi) {6 if (compiler_rt.want_ppc_abi) {
6 @export(&__fixunstfdi, .{ .name = "__fixunskfdi", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__fixunstfdi, "__fixunskfdi");
7 } else if (common.want_sparc_abi) {8 } else if (compiler_rt.want_sparc_abi) {
8 @export(&_Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&_Qp_qtoux, "_Qp_qtoux");
9 }10 }
10 @export(&__fixunstfdi, .{ .name = "__fixunstfdi", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__fixunstfdi, "__fixunstfdi");
11}12}
1213
13pub fn __fixunstfdi(a: f128) callconv(.c) u64 {14pub fn __fixunstfdi(a: f128) callconv(.c) u64 {
lib/compiler_rt/fixunstfsi.zig+7-6
...@@ -1,13 +1,14 @@...@@ -1,13 +1,14 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const intFromFloat = @import("./int_from_float.zig").intFromFloat;3const intFromFloat = @import("./int_from_float.zig").intFromFloat;
34
4comptime {5comptime {
5 if (common.want_ppc_abi) {6 if (compiler_rt.want_ppc_abi) {
6 @export(&__fixunstfsi, .{ .name = "__fixunskfsi", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__fixunstfsi, "__fixunskfsi");
7 } else if (common.want_sparc_abi) {8 } else if (compiler_rt.want_sparc_abi) {
8 @export(&_Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&_Qp_qtoui, "_Qp_qtoui");
9 }10 }
10 @export(&__fixunstfsi, .{ .name = "__fixunstfsi", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__fixunstfsi, "__fixunstfsi");
11}12}
1213
13pub fn __fixunstfsi(a: f128) callconv(.c) u32 {14pub fn __fixunstfsi(a: f128) callconv(.c) u32 {
lib/compiler_rt/fixunstfti.zig+7-6
...@@ -1,14 +1,15 @@...@@ -1,14 +1,15 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const common = @import("./common.zig");2const compiler_rt = @import("../compiler_rt.zig");
3const symbol = compiler_rt.symbol;
3const intFromFloat = @import("./int_from_float.zig").intFromFloat;4const intFromFloat = @import("./int_from_float.zig").intFromFloat;
45
5comptime {6comptime {
6 if (common.want_windows_v2u64_abi) {7 if (compiler_rt.want_windows_v2u64_abi) {
7 @export(&__fixunstfti_windows_x86_64, .{ .name = "__fixunstfti", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__fixunstfti_windows_x86_64, "__fixunstfti");
8 } else {9 } else {
9 if (common.want_ppc_abi)10 if (compiler_rt.want_ppc_abi)
10 @export(&__fixunstfti, .{ .name = "__fixunskfti", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__fixunstfti, "__fixunskfti");
11 @export(&__fixunstfti, .{ .name = "__fixunstfti", .linkage = common.linkage, .visibility = common.visibility });12 symbol(&__fixunstfti, "__fixunstfti");
12 }13 }
13}14}
1415
lib/compiler_rt/fixunsxfsi.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const intFromFloat = @import("./int_from_float.zig").intFromFloat;3const intFromFloat = @import("./int_from_float.zig").intFromFloat;
34
4comptime {5comptime {
5 @export(&__fixunsxfsi, .{ .name = "__fixunsxfsi", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__fixunsxfsi, "__fixunsxfsi");
6}7}
78
8fn __fixunsxfsi(a: f80) callconv(.c) u32 {9fn __fixunsxfsi(a: f80) callconv(.c) u32 {
lib/compiler_rt/fixunsxfti.zig+5-4
...@@ -1,12 +1,13 @@...@@ -1,12 +1,13 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const common = @import("./common.zig");2const compiler_rt = @import("../compiler_rt.zig");
3const symbol = compiler_rt.symbol;
3const intFromFloat = @import("./int_from_float.zig").intFromFloat;4const intFromFloat = @import("./int_from_float.zig").intFromFloat;
45
5comptime {6comptime {
6 if (common.want_windows_v2u64_abi) {7 if (compiler_rt.want_windows_v2u64_abi) {
7 @export(&__fixunsxfti_windows_x86_64, .{ .name = "__fixunsxfti", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__fixunsxfti_windows_x86_64, "__fixunsxfti");
8 } else {9 } else {
9 @export(&__fixunsxfti, .{ .name = "__fixunsxfti", .linkage = common.linkage, .visibility = common.visibility });10 symbol(&__fixunsxfti, "__fixunsxfti");
10 }11 }
11}12}
1213
lib/compiler_rt/fixxfei.zig+3-2
...@@ -1,10 +1,11 @@...@@ -1,10 +1,11 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
4const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat;5const bigIntFromFloat = @import("int_from_float.zig").bigIntFromFloat;
56
6comptime {7comptime {
7 @export(&__fixxfei, .{ .name = "__fixxfei", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__fixxfei, "__fixxfei");
8}9}
910
10pub fn __fixxfei(r: [*]u8, bits: usize, a: f80) callconv(.c) void {11pub fn __fixxfei(r: [*]u8, bits: usize, a: f80) callconv(.c) void {
lib/compiler_rt/fixxfsi.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const intFromFloat = @import("./int_from_float.zig").intFromFloat;3const intFromFloat = @import("./int_from_float.zig").intFromFloat;
34
4comptime {5comptime {
5 @export(&__fixxfsi, .{ .name = "__fixxfsi", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__fixxfsi, "__fixxfsi");
6}7}
78
8fn __fixxfsi(a: f80) callconv(.c) i32 {9fn __fixxfsi(a: f80) callconv(.c) i32 {
lib/compiler_rt/fixxfti.zig deleted-23
...@@ -1,23 +0,0 @@
1const builtin = @import("builtin");
2
3const common = @import("./common.zig");
4const intFromFloat = @import("./int_from_float.zig").intFromFloat;
5const symbol = @import("../compiler_rt.zig").symbol;
6
7comptime {
8 if (common.want_windows_v2u64_abi) {
9 symbol(&__fixxfti_windows_x86_64, "__fixxfti");
10 } else {
11 symbol(&__fixxfti, "__fixxfti");
12 }
13}
14
15pub fn __fixxfti(a: f80) callconv(.c) i128 {
16 return intFromFloat(i128, a);
17}
18
19const v2u64 = @Vector(2, u64);
20
21fn __fixxfti_windows_x86_64(a: f80) callconv(.c) v2u64 {
22 return @bitCast(intFromFloat(i128, a));
23}
lib/compiler_rt/floatdidf.zig+7-6
...@@ -1,15 +1,16 @@...@@ -1,15 +1,16 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const common = @import("./common.zig");2const compiler_rt = @import("../compiler_rt.zig");
3const symbol = compiler_rt.symbol;
3const floatFromInt = @import("./float_from_int.zig").floatFromInt;4const floatFromInt = @import("./float_from_int.zig").floatFromInt;
45
5comptime {6comptime {
6 if (common.want_aeabi) {7 if (compiler_rt.want_aeabi) {
7 @export(&__aeabi_l2d, .{ .name = "__aeabi_l2d", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__aeabi_l2d, "__aeabi_l2d");
8 } else {9 } else {
9 if (common.want_windows_arm_abi) {10 if (compiler_rt.want_windows_arm_abi) {
10 @export(&__floatdidf, .{ .name = "__i64tod", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__floatdidf, "__i64tod");
11 }12 }
12 @export(&__floatdidf, .{ .name = "__floatdidf", .linkage = common.linkage, .visibility = common.visibility });13 symbol(&__floatdidf, "__floatdidf");
13 }14 }
14}15}
1516
lib/compiler_rt/floatdisf.zig+3-3
...@@ -1,12 +1,12 @@...@@ -1,12 +1,12 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = @import("../compiler_rt.zig").symbol;2const symbol = @import("../compiler_rt.zig").symbol;
3const floatFromInt = @import("./float_from_int.zig").floatFromInt;3const floatFromInt = @import("./float_from_int.zig").floatFromInt;
44
5comptime {5comptime {
6 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
7 symbol(&__aeabi_l2f, "__aeabi_l2f");7 symbol(&__aeabi_l2f, "__aeabi_l2f");
8 } else {8 } else {
9 if (common.want_windows_arm_abi) {9 if (compiler_rt.want_windows_arm_abi) {
10 symbol(&__floatdisf, "__i64tos");10 symbol(&__floatdisf, "__i64tos");
11 }11 }
12 symbol(&__floatdisf, "__floatdisf");12 symbol(&__floatdisf, "__floatdisf");
lib/compiler_rt/floatditf.zig+3-3
...@@ -1,11 +1,11 @@...@@ -1,11 +1,11 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;2const floatFromInt = @import("./float_from_int.zig").floatFromInt;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_ppc_abi) {6 if (compiler_rt.want_ppc_abi) {
7 symbol(&__floatditf, "__floatdikf");7 symbol(&__floatditf, "__floatdikf");
8 } else if (common.want_sparc_abi) {8 } else if (compiler_rt.want_sparc_abi) {
9 symbol(&_Qp_xtoq, "_Qp_xtoq");9 symbol(&_Qp_xtoq, "_Qp_xtoq");
10 }10 }
11 symbol(&__floatditf, "__floatditf");11 symbol(&__floatditf, "__floatditf");
lib/compiler_rt/floateihf.zig+3-2
...@@ -1,10 +1,11 @@...@@ -1,10 +1,11 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
4const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;5const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;
56
6comptime {7comptime {
7 @export(&__floateihf, .{ .name = "__floateihf", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__floateihf, "__floateihf");
8}9}
910
10pub fn __floateihf(a: [*]const u8, bits: usize) callconv(.c) f16 {11pub fn __floateihf(a: [*]const u8, bits: usize) callconv(.c) f16 {
lib/compiler_rt/floateisf.zig+3-2
...@@ -1,10 +1,11 @@...@@ -1,10 +1,11 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
4const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;5const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;
56
6comptime {7comptime {
7 @export(&__floateisf, .{ .name = "__floateisf", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__floateisf, "__floateisf");
8}9}
910
10pub fn __floateisf(a: [*]const u8, bits: usize) callconv(.c) f32 {11pub fn __floateisf(a: [*]const u8, bits: usize) callconv(.c) f32 {
lib/compiler_rt/floateitf.zig+3-2
...@@ -1,10 +1,11 @@...@@ -1,10 +1,11 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
4const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;5const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;
56
6comptime {7comptime {
7 @export(&__floateitf, .{ .name = "__floateitf", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__floateitf, "__floateitf");
8}9}
910
10pub fn __floateitf(a: [*]const u8, bits: usize) callconv(.c) f128 {11pub fn __floateitf(a: [*]const u8, bits: usize) callconv(.c) f128 {
lib/compiler_rt/floatsidf.zig+5-4
...@@ -1,11 +1,12 @@...@@ -1,11 +1,12 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;3const floatFromInt = @import("./float_from_int.zig").floatFromInt;
34
4comptime {5comptime {
5 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
6 @export(&__aeabi_i2d, .{ .name = "__aeabi_i2d", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__aeabi_i2d, "__aeabi_i2d");
7 } else {8 } else {
8 @export(&__floatsidf, .{ .name = "__floatsidf", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__floatsidf, "__floatsidf");
9 }10 }
10}11}
1112
lib/compiler_rt/floatsihf.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;3const floatFromInt = @import("./float_from_int.zig").floatFromInt;
34
4comptime {5comptime {
5 @export(&__floatsihf, .{ .name = "__floatsihf", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__floatsihf, "__floatsihf");
6}7}
78
8fn __floatsihf(a: i32) callconv(.c) f16 {9fn __floatsihf(a: i32) callconv(.c) f16 {
lib/compiler_rt/floatsisf.zig+5-4
...@@ -1,11 +1,12 @@...@@ -1,11 +1,12 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;3const floatFromInt = @import("./float_from_int.zig").floatFromInt;
34
4comptime {5comptime {
5 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
6 @export(&__aeabi_i2f, .{ .name = "__aeabi_i2f", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__aeabi_i2f, "__aeabi_i2f");
7 } else {8 } else {
8 @export(&__floatsisf, .{ .name = "__floatsisf", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__floatsisf, "__floatsisf");
9 }10 }
10}11}
1112
lib/compiler_rt/floatsitf.zig+7-6
...@@ -1,13 +1,14 @@...@@ -1,13 +1,14 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;3const floatFromInt = @import("./float_from_int.zig").floatFromInt;
34
4comptime {5comptime {
5 if (common.want_ppc_abi) {6 if (compiler_rt.want_ppc_abi) {
6 @export(&__floatsitf, .{ .name = "__floatsikf", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__floatsitf, "__floatsikf");
7 } else if (common.want_sparc_abi) {8 } else if (compiler_rt.want_sparc_abi) {
8 @export(&_Qp_itoq, .{ .name = "_Qp_itoq", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&_Qp_itoq, "_Qp_itoq");
9 }10 }
10 @export(&__floatsitf, .{ .name = "__floatsitf", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__floatsitf, "__floatsitf");
11}12}
1213
13pub fn __floatsitf(a: i32) callconv(.c) f128 {14pub fn __floatsitf(a: i32) callconv(.c) f128 {
lib/compiler_rt/floatsixf.zig+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;2const floatFromInt = @import("./float_from_int.zig").floatFromInt;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
lib/compiler_rt/floattidf.zig+2-2
...@@ -1,9 +1,9 @@...@@ -1,9 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = @import("../compiler_rt.zig").symbol;2const symbol = @import("../compiler_rt.zig").symbol;
3const floatFromInt = @import("./float_from_int.zig").floatFromInt;3const floatFromInt = @import("./float_from_int.zig").floatFromInt;
44
5comptime {5comptime {
6 if (common.want_windows_v2u64_abi) {6 if (compiler_rt.want_windows_v2u64_abi) {
7 symbol(&__floattidf_windows_x86_64, "__floattidf");7 symbol(&__floattidf_windows_x86_64, "__floattidf");
8 } else {8 } else {
9 symbol(&__floattidf, "__floattidf");9 symbol(&__floattidf, "__floattidf");
lib/compiler_rt/floattihf.zig+5-4
...@@ -1,12 +1,13 @@...@@ -1,12 +1,13 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const common = @import("./common.zig");2const compiler_rt = @import("../compiler_rt.zig");
3const symbol = compiler_rt.symbol;
3const floatFromInt = @import("./float_from_int.zig").floatFromInt;4const floatFromInt = @import("./float_from_int.zig").floatFromInt;
45
5comptime {6comptime {
6 if (common.want_windows_v2u64_abi) {7 if (compiler_rt.want_windows_v2u64_abi) {
7 @export(&__floattihf_windows_x86_64, .{ .name = "__floattihf", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__floattihf_windows_x86_64, "__floattihf");
8 } else {9 } else {
9 @export(&__floattihf, .{ .name = "__floattihf", .linkage = common.linkage, .visibility = common.visibility });10 symbol(&__floattihf, "__floattihf");
10 }11 }
11}12}
1213
lib/compiler_rt/floattisf.zig+2-2
...@@ -1,9 +1,9 @@...@@ -1,9 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;2const floatFromInt = @import("./float_from_int.zig").floatFromInt;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_windows_v2u64_abi) {6 if (compiler_rt.want_windows_v2u64_abi) {
7 symbol(&__floattisf_windows_x86_64, "__floattisf");7 symbol(&__floattisf_windows_x86_64, "__floattisf");
8 } else {8 } else {
9 symbol(&__floattisf, "__floattisf");9 symbol(&__floattisf, "__floattisf");
lib/compiler_rt/floattitf.zig+3-3
...@@ -1,12 +1,12 @@...@@ -1,12 +1,12 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = @import("../compiler_rt.zig").symbol;2const symbol = @import("../compiler_rt.zig").symbol;
3const floatFromInt = @import("./float_from_int.zig").floatFromInt;3const floatFromInt = @import("./float_from_int.zig").floatFromInt;
44
5comptime {5comptime {
6 if (common.want_windows_v2u64_abi) {6 if (compiler_rt.want_windows_v2u64_abi) {
7 symbol(&__floattitf_windows_x86_64, "__floattitf");7 symbol(&__floattitf_windows_x86_64, "__floattitf");
8 } else {8 } else {
9 if (common.want_ppc_abi)9 if (compiler_rt.want_ppc_abi)
10 symbol(&__floattitf, "__floattikf");10 symbol(&__floattitf, "__floattikf");
11 symbol(&__floattitf, "__floattitf");11 symbol(&__floattitf, "__floattitf");
12 }12 }
lib/compiler_rt/floattixf.zig+5-4
...@@ -1,12 +1,13 @@...@@ -1,12 +1,13 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const common = @import("./common.zig");2const compiler_rt = @import("../compiler_rt.zig");
3const symbol = compiler_rt.symbol;
3const floatFromInt = @import("./float_from_int.zig").floatFromInt;4const floatFromInt = @import("./float_from_int.zig").floatFromInt;
45
5comptime {6comptime {
6 if (common.want_windows_v2u64_abi) {7 if (compiler_rt.want_windows_v2u64_abi) {
7 @export(&__floattixf_windows_x86_64, .{ .name = "__floattixf", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__floattixf_windows_x86_64, "__floattixf");
8 } else {9 } else {
9 @export(&__floattixf, .{ .name = "__floattixf", .linkage = common.linkage, .visibility = common.visibility });10 symbol(&__floattixf, "__floattixf");
10 }11 }
11}12}
1213
lib/compiler_rt/floatundidf.zig+3-3
...@@ -1,12 +1,12 @@...@@ -1,12 +1,12 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;2const floatFromInt = @import("./float_from_int.zig").floatFromInt;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
7 symbol(&__aeabi_ul2d, "__aeabi_ul2d");7 symbol(&__aeabi_ul2d, "__aeabi_ul2d");
8 } else {8 } else {
9 if (common.want_windows_arm_abi) {9 if (compiler_rt.want_windows_arm_abi) {
10 symbol(&__floatundidf, "__u64tod");10 symbol(&__floatundidf, "__u64tod");
11 }11 }
12 symbol(&__floatundidf, "__floatundidf");12 symbol(&__floatundidf, "__floatundidf");
lib/compiler_rt/floatundihf.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;3const floatFromInt = @import("./float_from_int.zig").floatFromInt;
34
4comptime {5comptime {
5 @export(&__floatundihf, .{ .name = "__floatundihf", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__floatundihf, "__floatundihf");
6}7}
78
8fn __floatundihf(a: u64) callconv(.c) f16 {9fn __floatundihf(a: u64) callconv(.c) f16 {
lib/compiler_rt/floatundisf.zig+7-6
...@@ -1,15 +1,16 @@...@@ -1,15 +1,16 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const common = @import("./common.zig");2const compiler_rt = @import("../compiler_rt.zig");
3const symbol = compiler_rt.symbol;
3const floatFromInt = @import("./float_from_int.zig").floatFromInt;4const floatFromInt = @import("./float_from_int.zig").floatFromInt;
45
5comptime {6comptime {
6 if (common.want_aeabi) {7 if (compiler_rt.want_aeabi) {
7 @export(&__aeabi_ul2f, .{ .name = "__aeabi_ul2f", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__aeabi_ul2f, "__aeabi_ul2f");
8 } else {9 } else {
9 if (common.want_windows_arm_abi) {10 if (compiler_rt.want_windows_arm_abi) {
10 @export(&__floatundisf, .{ .name = "__u64tos", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__floatundisf, "__u64tos");
11 }12 }
12 @export(&__floatundisf, .{ .name = "__floatundisf", .linkage = common.linkage, .visibility = common.visibility });13 symbol(&__floatundisf, "__floatundisf");
13 }14 }
14}15}
1516
lib/compiler_rt/floatunditf.zig+7-6
...@@ -1,13 +1,14 @@...@@ -1,13 +1,14 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;3const floatFromInt = @import("./float_from_int.zig").floatFromInt;
34
4comptime {5comptime {
5 if (common.want_ppc_abi) {6 if (compiler_rt.want_ppc_abi) {
6 @export(&__floatunditf, .{ .name = "__floatundikf", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__floatunditf, "__floatundikf");
7 } else if (common.want_sparc_abi) {8 } else if (compiler_rt.want_sparc_abi) {
8 @export(&_Qp_uxtoq, .{ .name = "_Qp_uxtoq", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&_Qp_uxtoq, "_Qp_uxtoq");
9 }10 }
10 @export(&__floatunditf, .{ .name = "__floatunditf", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__floatunditf, "__floatunditf");
11}12}
1213
13pub fn __floatunditf(a: u64) callconv(.c) f128 {14pub fn __floatunditf(a: u64) callconv(.c) f128 {
lib/compiler_rt/floatundixf.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;3const floatFromInt = @import("./float_from_int.zig").floatFromInt;
34
4comptime {5comptime {
5 @export(&__floatundixf, .{ .name = "__floatundixf", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__floatundixf, "__floatundixf");
6}7}
78
8fn __floatundixf(a: u64) callconv(.c) f80 {9fn __floatundixf(a: u64) callconv(.c) f80 {
lib/compiler_rt/floatuneidf.zig+3-2
...@@ -1,10 +1,11 @@...@@ -1,10 +1,11 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
4const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;5const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;
56
6comptime {7comptime {
7 @export(&__floatuneidf, .{ .name = "__floatuneidf", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__floatuneidf, "__floatuneidf");
8}9}
910
10pub fn __floatuneidf(a: [*]const u8, bits: usize) callconv(.c) f64 {11pub fn __floatuneidf(a: [*]const u8, bits: usize) callconv(.c) f64 {
lib/compiler_rt/floatuneihf.zig+3-2
...@@ -1,10 +1,11 @@...@@ -1,10 +1,11 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
4const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;5const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;
56
6comptime {7comptime {
7 @export(&__floatuneihf, .{ .name = "__floatuneihf", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__floatuneihf, "__floatuneihf");
8}9}
910
10pub fn __floatuneihf(a: [*]const u8, bits: usize) callconv(.c) f16 {11pub fn __floatuneihf(a: [*]const u8, bits: usize) callconv(.c) f16 {
lib/compiler_rt/floatuneisf.zig+3-2
...@@ -1,10 +1,11 @@...@@ -1,10 +1,11 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
4const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;5const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;
56
6comptime {7comptime {
7 @export(&__floatuneisf, .{ .name = "__floatuneisf", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__floatuneisf, "__floatuneisf");
8}9}
910
10pub fn __floatuneisf(a: [*]const u8, bits: usize) callconv(.c) f32 {11pub fn __floatuneisf(a: [*]const u8, bits: usize) callconv(.c) f32 {
lib/compiler_rt/floatuneixf.zig+3-2
...@@ -1,10 +1,11 @@...@@ -1,10 +1,11 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
4const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;5const floatFromBigInt = @import("float_from_int.zig").floatFromBigInt;
56
6comptime {7comptime {
7 @export(&__floatuneixf, .{ .name = "__floatuneixf", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__floatuneixf, "__floatuneixf");
8}9}
910
10pub fn __floatuneixf(a: [*]const u8, bits: usize) callconv(.c) f80 {11pub fn __floatuneixf(a: [*]const u8, bits: usize) callconv(.c) f80 {
lib/compiler_rt/floatunsidf.zig+5-4
...@@ -1,11 +1,12 @@...@@ -1,11 +1,12 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;3const floatFromInt = @import("./float_from_int.zig").floatFromInt;
34
4comptime {5comptime {
5 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
6 @export(&__aeabi_ui2d, .{ .name = "__aeabi_ui2d", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__aeabi_ui2d, "__aeabi_ui2d");
7 } else {8 } else {
8 @export(&__floatunsidf, .{ .name = "__floatunsidf", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__floatunsidf, "__floatunsidf");
9 }10 }
10}11}
1112
lib/compiler_rt/floatunsisf.zig+2-2
...@@ -1,9 +1,9 @@...@@ -1,9 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;2const floatFromInt = @import("./float_from_int.zig").floatFromInt;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
7 symbol(&__aeabi_ui2f, "__aeabi_ui2f");7 symbol(&__aeabi_ui2f, "__aeabi_ui2f");
8 } else {8 } else {
9 symbol(&__floatunsisf, "__floatunsisf");9 symbol(&__floatunsisf, "__floatunsisf");
lib/compiler_rt/floatunsitf.zig+3-3
...@@ -1,11 +1,11 @@...@@ -1,11 +1,11 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;2const floatFromInt = @import("./float_from_int.zig").floatFromInt;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_ppc_abi) {6 if (compiler_rt.want_ppc_abi) {
7 symbol(&__floatunsitf, "__floatunsikf");7 symbol(&__floatunsitf, "__floatunsikf");
8 } else if (common.want_sparc_abi) {8 } else if (compiler_rt.want_sparc_abi) {
9 symbol(&_Qp_uitoq, "_Qp_uitoq");9 symbol(&_Qp_uitoq, "_Qp_uitoq");
10 }10 }
11 symbol(&__floatunsitf, "__floatunsitf");11 symbol(&__floatunsitf, "__floatunsitf");
lib/compiler_rt/floatunsixf.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;3const floatFromInt = @import("./float_from_int.zig").floatFromInt;
34
4comptime {5comptime {
5 @export(&__floatunsixf, .{ .name = "__floatunsixf", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__floatunsixf, "__floatunsixf");
6}7}
78
8fn __floatunsixf(a: u32) callconv(.c) f80 {9fn __floatunsixf(a: u32) callconv(.c) f80 {
lib/compiler_rt/floatuntidf.zig+2-2
...@@ -1,9 +1,9 @@...@@ -1,9 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;2const floatFromInt = @import("./float_from_int.zig").floatFromInt;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_windows_v2u64_abi) {6 if (compiler_rt.want_windows_v2u64_abi) {
7 symbol(&__floatuntidf_windows_x86_64, "__floatuntidf");7 symbol(&__floatuntidf_windows_x86_64, "__floatuntidf");
8 } else {8 } else {
9 symbol(&__floatuntidf, "__floatuntidf");9 symbol(&__floatuntidf, "__floatuntidf");
lib/compiler_rt/floatuntihf.zig+2-2
...@@ -1,9 +1,9 @@...@@ -1,9 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = @import("../compiler_rt.zig").symbol;2const symbol = @import("../compiler_rt.zig").symbol;
3const floatFromInt = @import("./float_from_int.zig").floatFromInt;3const floatFromInt = @import("./float_from_int.zig").floatFromInt;
44
5comptime {5comptime {
6 if (common.want_windows_v2u64_abi) {6 if (compiler_rt.want_windows_v2u64_abi) {
7 symbol(&__floatuntihf_windows_x86_64, "__floatuntihf");7 symbol(&__floatuntihf_windows_x86_64, "__floatuntihf");
8 } else {8 } else {
9 symbol(&__floatuntihf, "__floatuntihf");9 symbol(&__floatuntihf, "__floatuntihf");
lib/compiler_rt/floatuntisf.zig+5-4
...@@ -1,12 +1,13 @@...@@ -1,12 +1,13 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const common = @import("./common.zig");2const compiler_rt = @import("../compiler_rt.zig");
3const symbol = compiler_rt.symbol;
3const floatFromInt = @import("./float_from_int.zig").floatFromInt;4const floatFromInt = @import("./float_from_int.zig").floatFromInt;
45
5comptime {6comptime {
6 if (common.want_windows_v2u64_abi) {7 if (compiler_rt.want_windows_v2u64_abi) {
7 @export(&__floatuntisf_windows_x86_64, .{ .name = "__floatuntisf", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__floatuntisf_windows_x86_64, "__floatuntisf");
8 } else {9 } else {
9 @export(&__floatuntisf, .{ .name = "__floatuntisf", .linkage = common.linkage, .visibility = common.visibility });10 symbol(&__floatuntisf, "__floatuntisf");
10 }11 }
11}12}
1213
lib/compiler_rt/floatuntitf.zig+3-3
...@@ -1,12 +1,12 @@...@@ -1,12 +1,12 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const floatFromInt = @import("./float_from_int.zig").floatFromInt;2const floatFromInt = @import("./float_from_int.zig").floatFromInt;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_windows_v2u64_abi) {6 if (compiler_rt.want_windows_v2u64_abi) {
7 symbol(&__floatuntitf_windows_x86_64, "__floatuntitf");7 symbol(&__floatuntitf_windows_x86_64, "__floatuntitf");
8 } else {8 } else {
9 if (common.want_ppc_abi)9 if (compiler_rt.want_ppc_abi)
10 symbol(&__floatuntitf, "__floatuntikf");10 symbol(&__floatuntitf, "__floatuntikf");
11 symbol(&__floatuntitf, "__floatuntitf");11 symbol(&__floatuntitf, "__floatuntitf");
12 }12 }
lib/compiler_rt/floatuntixf.zig+5-4
...@@ -1,12 +1,13 @@...@@ -1,12 +1,13 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const common = @import("./common.zig");2const compiler_rt = @import("../compiler_rt.zig");
3const symbol = compiler_rt.symbol;
3const floatFromInt = @import("./float_from_int.zig").floatFromInt;4const floatFromInt = @import("./float_from_int.zig").floatFromInt;
45
5comptime {6comptime {
6 if (common.want_windows_v2u64_abi) {7 if (compiler_rt.want_windows_v2u64_abi) {
7 @export(&__floatuntixf_windows_x86_64, .{ .name = "__floatuntixf", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__floatuntixf_windows_x86_64, "__floatuntixf");
8 } else {9 } else {
9 @export(&__floatuntixf, .{ .name = "__floatuntixf", .linkage = common.linkage, .visibility = common.visibility });10 symbol(&__floatuntixf, "__floatuntixf");
10 }11 }
11}12}
1213
lib/compiler_rt/floor_ceil.zig+6-6
...@@ -14,7 +14,7 @@ const math = std.math;...@@ -14,7 +14,7 @@ const math = std.math;
14const mem = std.mem;14const mem = std.mem;
15const expect = std.testing.expect;15const expect = std.testing.expect;
1616
17const common = @import("common.zig");17const compiler_rt = @import("../compiler_rt.zig");
18const symbol = @import("../compiler_rt.zig").symbol;18const symbol = @import("../compiler_rt.zig").symbol;
1919
20comptime {20comptime {
...@@ -23,7 +23,7 @@ comptime {...@@ -23,7 +23,7 @@ comptime {
23 symbol(&floorf, "floorf");23 symbol(&floorf, "floorf");
24 symbol(&floor, "floor");24 symbol(&floor, "floor");
25 symbol(&__floorx, "__floorx");25 symbol(&__floorx, "__floorx");
26 if (common.want_ppc_abi) {26 if (compiler_rt.want_ppc_abi) {
27 symbol(&floorq, "floorf128");27 symbol(&floorq, "floorf128");
28 }28 }
29 symbol(&floorq, "floorq");29 symbol(&floorq, "floorq");
...@@ -34,7 +34,7 @@ comptime {...@@ -34,7 +34,7 @@ comptime {
34 symbol(&ceilf, "ceilf");34 symbol(&ceilf, "ceilf");
35 symbol(&ceil, "ceil");35 symbol(&ceil, "ceil");
36 symbol(&__ceilx, "__ceilx");36 symbol(&__ceilx, "__ceilx");
37 if (common.want_ppc_abi) {37 if (compiler_rt.want_ppc_abi) {
38 symbol(&ceilq, "ceilf128");38 symbol(&ceilq, "ceilf128");
39 }39 }
40 symbol(&ceilq, "ceilq");40 symbol(&ceilq, "ceilq");
...@@ -106,11 +106,11 @@ inline fn impl(comptime T: type, comptime op: enum { floor, ceil }, x: T) T {...@@ -106,11 +106,11 @@ inline fn impl(comptime T: type, comptime op: enum { floor, ceil }, x: T) T {
106 if (e >= 0) {106 if (e >= 0) {
107 const m = (@as(U, 1) << @intCast(mantissa - e)) - 1;107 const m = (@as(U, 1) << @intCast(mantissa - e)) - 1;
108 if (u & m == 0) return x;108 if (u & m == 0) return x;
109 if (common.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1.0p120);109 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1.0p120);
110 if (u >> bits - 1 == @intFromBool(op == .floor)) u += m;110 if (u >> bits - 1 == @intFromBool(op == .floor)) u += m;
111 return @bitCast(u & ~m);111 return @bitCast(u & ~m);
112 } else {112 } else {
113 if (common.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1.0p120);113 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1.0p120);
114 return switch (op) {114 return switch (op) {
115 .floor => if (u >> bits - 1 == 0) 0.0 else if (u << 1 != 0) -1.0 else x,115 .floor => if (u >> bits - 1 == 0) 0.0 else if (u << 1 != 0) -1.0 else x,
116 .ceil => if (u >> bits - 1 != 0) -0.0 else if (u << 1 != 0) 1.0 else x,116 .ceil => if (u >> bits - 1 != 0) -0.0 else if (u << 1 != 0) 1.0 else x,
...@@ -128,7 +128,7 @@ inline fn impl(comptime T: type, comptime op: enum { floor, ceil }, x: T) T {...@@ -128,7 +128,7 @@ inline fn impl(comptime T: type, comptime op: enum { floor, ceil }, x: T) T {
128 x - C + C - x;128 x - C + C - x;
129129
130 if (e <= bias - 1) {130 if (e <= bias - 1) {
131 if (common.want_float_exceptions) mem.doNotOptimizeAway(y);131 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(y);
132 return switch (op) {132 return switch (op) {
133 .floor => if (positive) 0.0 else -1.0,133 .floor => if (positive) 0.0 else -1.0,
134 .ceil => if (positive) 1.0 else -0.0,134 .ceil => if (positive) 1.0 else -0.0,
lib/compiler_rt/fma.zig+10-9
...@@ -8,18 +8,19 @@...@@ -8,18 +8,19 @@
8const std = @import("std");8const std = @import("std");
9const math = std.math;9const math = std.math;
10const expect = std.testing.expect;10const expect = std.testing.expect;
11const common = @import("common.zig");11const compiler_rt = @import("../compiler_rt.zig");
12const symbol = compiler_rt.symbol;
1213
13comptime {14comptime {
14 @export(&__fmah, .{ .name = "__fmah", .linkage = common.linkage, .visibility = common.visibility });15 symbol(&__fmah, "__fmah");
15 @export(&fmaf, .{ .name = "fmaf", .linkage = common.linkage, .visibility = common.visibility });16 symbol(&fmaf, "fmaf");
16 @export(&fma, .{ .name = "fma", .linkage = common.linkage, .visibility = common.visibility });17 symbol(&fma, "fma");
17 @export(&__fmax, .{ .name = "__fmax", .linkage = common.linkage, .visibility = common.visibility });18 symbol(&__fmax, "__fmax");
18 if (common.want_ppc_abi) {19 if (compiler_rt.want_ppc_abi) {
19 @export(&fmaq, .{ .name = "fmaf128", .linkage = common.linkage, .visibility = common.visibility });20 symbol(&fmaq, "fmaf128");
20 }21 }
21 @export(&fmaq, .{ .name = "fmaq", .linkage = common.linkage, .visibility = common.visibility });22 symbol(&fmaq, "fmaq");
22 @export(&fmal, .{ .name = "fmal", .linkage = common.linkage, .visibility = common.visibility });23 symbol(&fmal, "fmal");
23}24}
2425
25pub fn __fmah(x: f16, y: f16, z: f16) callconv(.c) f16 {26pub fn __fmah(x: f16, y: f16, z: f16) callconv(.c) f16 {
lib/compiler_rt/fmax.zig+10-9
...@@ -2,18 +2,19 @@ const std = @import("std");...@@ -2,18 +2,19 @@ const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const math = std.math;3const math = std.math;
4const arch = builtin.cpu.arch;4const arch = builtin.cpu.arch;
5const common = @import("common.zig");5const compiler_rt = @import("../compiler_rt.zig");
6const symbol = compiler_rt.symbol;
67
7comptime {8comptime {
8 @export(&__fmaxh, .{ .name = "__fmaxh", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__fmaxh, "__fmaxh");
9 @export(&fmaxf, .{ .name = "fmaxf", .linkage = common.linkage, .visibility = common.visibility });10 symbol(&fmaxf, "fmaxf");
10 @export(&fmax, .{ .name = "fmax", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&fmax, "fmax");
11 @export(&__fmaxx, .{ .name = "__fmaxx", .linkage = common.linkage, .visibility = common.visibility });12 symbol(&__fmaxx, "__fmaxx");
12 if (common.want_ppc_abi) {13 if (compiler_rt.want_ppc_abi) {
13 @export(&fmaxq, .{ .name = "fmaxf128", .linkage = common.linkage, .visibility = common.visibility });14 symbol(&fmaxq, "fmaxf128");
14 }15 }
15 @export(&fmaxq, .{ .name = "fmaxq", .linkage = common.linkage, .visibility = common.visibility });16 symbol(&fmaxq, "fmaxq");
16 @export(&fmaxl, .{ .name = "fmaxl", .linkage = common.linkage, .visibility = common.visibility });17 symbol(&fmaxl, "fmaxl");
17}18}
1819
19pub fn __fmaxh(x: f16, y: f16) callconv(.c) f16 {20pub fn __fmaxh(x: f16, y: f16) callconv(.c) f16 {
lib/compiler_rt/fmin.zig+10-9
...@@ -2,18 +2,19 @@ const std = @import("std");...@@ -2,18 +2,19 @@ const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const math = std.math;3const math = std.math;
4const arch = builtin.cpu.arch;4const arch = builtin.cpu.arch;
5const common = @import("common.zig");5const compiler_rt = @import("../compiler_rt.zig");
6const symbol = compiler_rt.symbol;
67
7comptime {8comptime {
8 @export(&__fminh, .{ .name = "__fminh", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__fminh, "__fminh");
9 @export(&fminf, .{ .name = "fminf", .linkage = common.linkage, .visibility = common.visibility });10 symbol(&fminf, "fminf");
10 @export(&fmin, .{ .name = "fmin", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&fmin, "fmin");
11 @export(&__fminx, .{ .name = "__fminx", .linkage = common.linkage, .visibility = common.visibility });12 symbol(&__fminx, "__fminx");
12 if (common.want_ppc_abi) {13 if (compiler_rt.want_ppc_abi) {
13 @export(&fminq, .{ .name = "fminf128", .linkage = common.linkage, .visibility = common.visibility });14 symbol(&fminq, "fminf128");
14 }15 }
15 @export(&fminq, .{ .name = "fminq", .linkage = common.linkage, .visibility = common.visibility });16 symbol(&fminq, "fminq");
16 @export(&fminl, .{ .name = "fminl", .linkage = common.linkage, .visibility = common.visibility });17 symbol(&fminl, "fminl");
17}18}
1819
19pub fn __fminh(x: f16, y: f16) callconv(.c) f16 {20pub fn __fminh(x: f16, y: f16) callconv(.c) f16 {
lib/compiler_rt/fmod.zig+11-10
...@@ -3,19 +3,20 @@ const std = @import("std");...@@ -3,19 +3,20 @@ const std = @import("std");
3const math = std.math;3const math = std.math;
4const assert = std.debug.assert;4const assert = std.debug.assert;
5const arch = builtin.cpu.arch;5const arch = builtin.cpu.arch;
6const common = @import("common.zig");6const compiler_rt = @import("../compiler_rt.zig");
7const normalize = common.normalize;7const symbol = compiler_rt.symbol;
8const normalize = compiler_rt.normalize;
89
9comptime {10comptime {
10 @export(&__fmodh, .{ .name = "__fmodh", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__fmodh, "__fmodh");
11 @export(&fmodf, .{ .name = "fmodf", .linkage = common.linkage, .visibility = common.visibility });12 symbol(&fmodf, "fmodf");
12 @export(&fmod, .{ .name = "fmod", .linkage = common.linkage, .visibility = common.visibility });13 symbol(&fmod, "fmod");
13 @export(&__fmodx, .{ .name = "__fmodx", .linkage = common.linkage, .visibility = common.visibility });14 symbol(&__fmodx, "__fmodx");
14 if (common.want_ppc_abi) {15 if (compiler_rt.want_ppc_abi) {
15 @export(&fmodq, .{ .name = "fmodf128", .linkage = common.linkage, .visibility = common.visibility });16 symbol(&fmodq, "fmodf128");
16 }17 }
17 @export(&fmodq, .{ .name = "fmodq", .linkage = common.linkage, .visibility = common.visibility });18 symbol(&fmodq, "fmodq");
18 @export(&fmodl, .{ .name = "fmodl", .linkage = common.linkage, .visibility = common.visibility });19 symbol(&fmodl, "fmodl");
19}20}
2021
21pub fn __fmodh(x: f16, y: f16) callconv(.c) f16 {22pub fn __fmodh(x: f16, y: f16) callconv(.c) f16 {
lib/compiler_rt/gedf2.zig+2-2
...@@ -1,11 +1,11 @@...@@ -1,11 +1,11 @@
1///! The quoted behavior definitions are from1///! The quoted behavior definitions are from
2///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines2///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines
3const common = @import("./common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const comparef = @import("./comparef.zig");4const comparef = @import("./comparef.zig");
5const symbol = @import("../compiler_rt.zig").symbol;5const symbol = @import("../compiler_rt.zig").symbol;
66
7comptime {7comptime {
8 if (common.want_aeabi) {8 if (compiler_rt.want_aeabi) {
9 symbol(&__aeabi_dcmpge, "__aeabi_dcmpge");9 symbol(&__aeabi_dcmpge, "__aeabi_dcmpge");
10 symbol(&__aeabi_dcmpgt, "__aeabi_dcmpgt");10 symbol(&__aeabi_dcmpgt, "__aeabi_dcmpgt");
11 } else {11 } else {
lib/compiler_rt/gesf2.zig+7-6
...@@ -1,15 +1,16 @@...@@ -1,15 +1,16 @@
1///! The quoted behavior definitions are from1///! The quoted behavior definitions are from
2///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines2///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines
3const common = @import("./common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
4const comparef = @import("./comparef.zig");5const comparef = @import("./comparef.zig");
56
6comptime {7comptime {
7 if (common.want_aeabi) {8 if (compiler_rt.want_aeabi) {
8 @export(&__aeabi_fcmpge, .{ .name = "__aeabi_fcmpge", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__aeabi_fcmpge, "__aeabi_fcmpge");
9 @export(&__aeabi_fcmpgt, .{ .name = "__aeabi_fcmpgt", .linkage = common.linkage, .visibility = common.visibility });10 symbol(&__aeabi_fcmpgt, "__aeabi_fcmpgt");
10 } else {11 } else {
11 @export(&__gesf2, .{ .name = "__gesf2", .linkage = common.linkage, .visibility = common.visibility });12 symbol(&__gesf2, "__gesf2");
12 @export(&__gtsf2, .{ .name = "__gtsf2", .linkage = common.linkage, .visibility = common.visibility });13 symbol(&__gtsf2, "__gtsf2");
13 }14 }
14}15}
1516
lib/compiler_rt/getf2.zig+8-7
...@@ -1,18 +1,19 @@...@@ -1,18 +1,19 @@
1///! The quoted behavior definitions are from1///! The quoted behavior definitions are from
2///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines2///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routines
3const common = @import("./common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
4const comparef = @import("./comparef.zig");5const comparef = @import("./comparef.zig");
56
6comptime {7comptime {
7 if (common.want_ppc_abi) {8 if (compiler_rt.want_ppc_abi) {
8 @export(&__getf2, .{ .name = "__gekf2", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__getf2, "__gekf2");
9 @export(&__gttf2, .{ .name = "__gtkf2", .linkage = common.linkage, .visibility = common.visibility });10 symbol(&__gttf2, "__gtkf2");
10 } else if (common.want_sparc_abi) {11 } else if (compiler_rt.want_sparc_abi) {
11 // These exports are handled in cmptf2.zig because gt and ge on sparc12 // These exports are handled in cmptf2.zig because gt and ge on sparc
12 // are based on calling _Qp_cmp.13 // are based on calling _Qp_cmp.
13 }14 }
14 @export(&__getf2, .{ .name = "__getf2", .linkage = common.linkage, .visibility = common.visibility });15 symbol(&__getf2, "__getf2");
15 @export(&__gttf2, .{ .name = "__gttf2", .linkage = common.linkage, .visibility = common.visibility });16 symbol(&__gttf2, "__gttf2");
16}17}
1718
18/// "These functions return a value greater than or equal to zero if neither19/// "These functions return a value greater than or equal to zero if neither
lib/compiler_rt/hexagon.zig+27-25
...@@ -1,5 +1,7 @@...@@ -1,5 +1,7 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const common = @import("./common.zig");2
3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
35
4fn __hexagon_divsi3() callconv(.naked) noreturn {6fn __hexagon_divsi3() callconv(.naked) noreturn {
5 asm volatile (7 asm volatile (
...@@ -1759,29 +1761,29 @@ fn __hexagon_sqrtdf2() align(32) callconv(.naked) noreturn {...@@ -1759,29 +1761,29 @@ fn __hexagon_sqrtdf2() align(32) callconv(.naked) noreturn {
17591761
1760comptime {1762comptime {
1761 if (builtin.cpu.arch == .hexagon) {1763 if (builtin.cpu.arch == .hexagon) {
1762 @export(&__hexagon_adddf3, .{ .name = "__hexagon_adddf3", .linkage = common.linkage, .visibility = common.visibility });1764 symbol(&__hexagon_adddf3, "__hexagon_adddf3");
1763 @export(&__hexagon_adddf3, .{ .name = "__hexagon_fast_adddf3", .linkage = common.linkage, .visibility = common.visibility });1765 symbol(&__hexagon_adddf3, "__hexagon_fast_adddf3");
1764 @export(&__hexagon_subdf3, .{ .name = "__hexagon_subdf3", .linkage = common.linkage, .visibility = common.visibility });1766 symbol(&__hexagon_subdf3, "__hexagon_subdf3");
1765 @export(&__hexagon_subdf3, .{ .name = "__hexagon_fast_subdf3", .linkage = common.linkage, .visibility = common.visibility });1767 symbol(&__hexagon_subdf3, "__hexagon_fast_subdf3");
1766 @export(&__hexagon_divdf3, .{ .name = "__hexagon_divdf3", .linkage = common.linkage, .visibility = common.visibility });1768 symbol(&__hexagon_divdf3, "__hexagon_divdf3");
1767 @export(&__hexagon_divdf3, .{ .name = "__hexagon_fast_divdf3", .linkage = common.linkage, .visibility = common.visibility });1769 symbol(&__hexagon_divdf3, "__hexagon_fast_divdf3");
1768 @export(&__hexagon_muldf3, .{ .name = "__hexagon_muldf3", .linkage = common.linkage, .visibility = common.visibility });1770 symbol(&__hexagon_muldf3, "__hexagon_muldf3");
1769 @export(&__hexagon_muldf3, .{ .name = "__hexagon_fast_muldf3", .linkage = common.linkage, .visibility = common.visibility });1771 symbol(&__hexagon_muldf3, "__hexagon_fast_muldf3");
1770 @export(&__hexagon_sqrtdf2, .{ .name = "__hexagon_sqrtdf2", .linkage = common.linkage, .visibility = common.visibility });1772 symbol(&__hexagon_sqrtdf2, "__hexagon_sqrtdf2");
1771 @export(&__hexagon_sqrtdf2, .{ .name = "__hexagon_fast2_sqrtdf2", .linkage = common.linkage, .visibility = common.visibility });1773 symbol(&__hexagon_sqrtdf2, "__hexagon_fast2_sqrtdf2");
1772 @export(&__hexagon_sqrtdf2, .{ .name = "__hexagon_sqrt", .linkage = common.linkage, .visibility = common.visibility });1774 symbol(&__hexagon_sqrtdf2, "__hexagon_sqrt");
1773 @export(&__hexagon_divsf3, .{ .name = "__hexagon_divsf3", .linkage = common.linkage, .visibility = common.visibility });1775 symbol(&__hexagon_divsf3, "__hexagon_divsf3");
1774 @export(&__hexagon_divsf3, .{ .name = "__hexagon_fast_divsf3", .linkage = common.linkage, .visibility = common.visibility });1776 symbol(&__hexagon_divsf3, "__hexagon_fast_divsf3");
1775 @export(&__hexagon_divsi3, .{ .name = "__hexagon_divsi3", .linkage = common.linkage, .visibility = common.visibility });1777 symbol(&__hexagon_divsi3, "__hexagon_divsi3");
1776 @export(&__hexagon_umodsi3, .{ .name = "__hexagon_umodsi3", .linkage = common.linkage, .visibility = common.visibility });1778 symbol(&__hexagon_umodsi3, "__hexagon_umodsi3");
1777 @export(&__hexagon_sqrtf, .{ .name = "__hexagon_sqrtf", .linkage = common.linkage, .visibility = common.visibility });1779 symbol(&__hexagon_sqrtf, "__hexagon_sqrtf");
1778 @export(&__hexagon_sqrtf, .{ .name = "__hexagon_fast2_sqrtf", .linkage = common.linkage, .visibility = common.visibility });1780 symbol(&__hexagon_sqrtf, "__hexagon_fast2_sqrtf");
1779 @export(&__hexagon_moddi3, .{ .name = "__hexagon_moddi3", .linkage = common.linkage, .visibility = common.visibility });1781 symbol(&__hexagon_moddi3, "__hexagon_moddi3");
1780 @export(&__hexagon_divdi3, .{ .name = "__hexagon_divdi3", .linkage = common.linkage, .visibility = common.visibility });1782 symbol(&__hexagon_divdi3, "__hexagon_divdi3");
1781 @export(&__hexagon_udivdi3, .{ .name = "__hexagon_udivdi3", .linkage = common.linkage, .visibility = common.visibility });1783 symbol(&__hexagon_udivdi3, "__hexagon_udivdi3");
1782 @export(&__hexagon_umoddi3, .{ .name = "__hexagon_umoddi3", .linkage = common.linkage, .visibility = common.visibility });1784 symbol(&__hexagon_umoddi3, "__hexagon_umoddi3");
1783 @export(&__hexagon_modsi3, .{ .name = "__hexagon_modsi3", .linkage = common.linkage, .visibility = common.visibility });1785 symbol(&__hexagon_modsi3, "__hexagon_modsi3");
1784 @export(&__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes, .{ .name = "__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes", .linkage = common.linkage, .visibility = common.visibility });1786 symbol(&__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes, "__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes");
1785 @export(&__hexagon_udivsi3, .{ .name = "__hexagon_udivsi3", .linkage = common.linkage, .visibility = common.visibility });1787 symbol(&__hexagon_udivsi3, "__hexagon_udivsi3");
1786 }1788 }
1787}1789}
lib/compiler_rt/int.zig+4-4
...@@ -8,16 +8,16 @@ const testing = std.testing;...@@ -8,16 +8,16 @@ const testing = std.testing;
8const maxInt = std.math.maxInt;8const maxInt = std.math.maxInt;
9const minInt = std.math.minInt;9const minInt = std.math.minInt;
1010
11const common = @import("common.zig");11const compiler_rt = @import("../compiler_rt.zig");
12const symbol = @import("../compiler_rt.zig").symbol;12const symbol = compiler_rt.symbol;
13const udivmod = @import("udivmod.zig").udivmod;13const udivmod = @import("udivmod.zig").udivmod;
14const __divti3 = @import("divti3.zig").__divti3;14const __divti3 = @import("udivmod.zig").__divti3;
1515
16comptime {16comptime {
17 symbol(&__divmodti4, "__divmodti4");17 symbol(&__divmodti4, "__divmodti4");
18 symbol(&__udivmoddi4, "__udivmoddi4");18 symbol(&__udivmoddi4, "__udivmoddi4");
19 symbol(&__divmoddi4, "__divmoddi4");19 symbol(&__divmoddi4, "__divmoddi4");
20 if (common.want_aeabi) {20 if (compiler_rt.want_aeabi) {
21 symbol(&__aeabi_idiv, "__aeabi_idiv");21 symbol(&__aeabi_idiv, "__aeabi_idiv");
22 symbol(&__aeabi_uidiv, "__aeabi_uidiv");22 symbol(&__aeabi_uidiv, "__aeabi_uidiv");
23 } else {23 } else {
lib/compiler_rt/int_from_float.zig+48-3
...@@ -1,13 +1,58 @@...@@ -1,13 +1,58 @@
1const std = @import("std");1const std = @import("std");
2const Int = std.meta.Int;
3const math = std.math;2const math = std.math;
4const Log2Int = math.Log2Int;3const Log2Int = std.math.Log2Int;
4
5const compiler_rt = @import("../compiler_rt.zig");
6const symbol = compiler_rt.symbol;
7
8comptime {
9 if (compiler_rt.want_windows_v2u64_abi) {
10 symbol(&__fixxfti_windows_x86_64, "__fixxfti");
11 } else {
12 symbol(&__fixxfti, "__fixxfti");
13 }
14
15 symbol(&__fixhfsi, "__fixhfsi");
16 symbol(&__fixhfdi, "__fixhfdi");
17
18 if (compiler_rt.want_windows_v2u64_abi) {
19 symbol(&__fixhfti_windows_x86_64, "__fixhfti");
20 } else {
21 symbol(&__fixhfti, "__fixhfti");
22 }
23}
24
25const v2u64 = @Vector(2, u64);
26
27pub fn __fixhfti(a: f16) callconv(.c) i128 {
28 return intFromFloat(i128, a);
29}
30
31fn __fixhfti_windows_x86_64(a: f16) callconv(.c) v2u64 {
32 return @bitCast(intFromFloat(i128, a));
33}
34
35fn __fixhfdi(a: f16) callconv(.c) i64 {
36 return intFromFloat(i64, a);
37}
38
39fn __fixhfsi(a: f16) callconv(.c) i32 {
40 return intFromFloat(i32, a);
41}
42
43pub fn __fixxfti(a: f80) callconv(.c) i128 {
44 return intFromFloat(i128, a);
45}
46
47fn __fixxfti_windows_x86_64(a: f80) callconv(.c) v2u64 {
48 return @bitCast(intFromFloat(i128, a));
49}
550
6pub inline fn intFromFloat(comptime I: type, a: anytype) I {51pub inline fn intFromFloat(comptime I: type, a: anytype) I {
7 const F = @TypeOf(a);52 const F = @TypeOf(a);
8 const float_bits = @typeInfo(F).float.bits;53 const float_bits = @typeInfo(F).float.bits;
9 const int_bits = @typeInfo(I).int.bits;54 const int_bits = @typeInfo(I).int.bits;
10 const rep_t = Int(.unsigned, float_bits);55 const rep_t = @Int(.unsigned, float_bits);
11 const sig_bits = math.floatMantissaBits(F);56 const sig_bits = math.floatMantissaBits(F);
12 const exp_bits = math.floatExponentBits(F);57 const exp_bits = math.floatExponentBits(F);
13 const fractional_bits = math.floatFractionalBits(F);58 const fractional_bits = math.floatFractionalBits(F);
lib/compiler_rt/log.zig+6-6
...@@ -9,7 +9,7 @@ const math = std.math;...@@ -9,7 +9,7 @@ const math = std.math;
9const expect = std.testing.expect;9const expect = std.testing.expect;
10const expectEqual = std.testing.expectEqual;10const expectEqual = std.testing.expectEqual;
1111
12const common = @import("common.zig");12const compiler_rt = @import("../compiler_rt.zig");
13const symbol = @import("../compiler_rt.zig").symbol;13const symbol = @import("../compiler_rt.zig").symbol;
1414
15comptime {15comptime {
...@@ -17,7 +17,7 @@ comptime {...@@ -17,7 +17,7 @@ comptime {
17 symbol(&logf, "logf");17 symbol(&logf, "logf");
18 symbol(&log, "log");18 symbol(&log, "log");
19 symbol(&__logx, "__logx");19 symbol(&__logx, "__logx");
20 if (common.want_ppc_abi) {20 if (compiler_rt.want_ppc_abi) {
21 symbol(&logq, "logf128");21 symbol(&logq, "logf128");
22 }22 }
23 symbol(&logq, "logq");23 symbol(&logq, "logq");
...@@ -45,11 +45,11 @@ pub fn logf(x_: f32) callconv(.c) f32 {...@@ -45,11 +45,11 @@ pub fn logf(x_: f32) callconv(.c) f32 {
45 if (ix < 0x00800000 or ix >> 31 != 0) {45 if (ix < 0x00800000 or ix >> 31 != 0) {
46 // log(+-0) = -inf46 // log(+-0) = -inf
47 if (ix << 1 == 0) {47 if (ix << 1 == 0) {
48 return if (common.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64);48 return if (compiler_rt.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64);
49 }49 }
50 // log(-#) = nan50 // log(-#) = nan
51 if (ix >> 31 != 0) {51 if (ix >> 31 != 0) {
52 return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f64);52 return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f64);
53 }53 }
5454
55 // subnormal, scale x55 // subnormal, scale x
...@@ -398,13 +398,13 @@ pub fn log(x: f64) callconv(.c) f64 {...@@ -398,13 +398,13 @@ pub fn log(x: f64) callconv(.c) f64 {
398 @branchHint(.unlikely);398 @branchHint(.unlikely);
399399
400 if (ix << 1 == 0)400 if (ix << 1 == 0)
401 return if (common.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64);401 return if (compiler_rt.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64);
402402
403 if (ix == @as(i64, @bitCast(std.math.inf(f64))))403 if (ix == @as(i64, @bitCast(std.math.inf(f64))))
404 return x;404 return x;
405405
406 if (top & 0x8000 != 0 or top & 0x7ff0 == 0x7ff0)406 if (top & 0x8000 != 0 or top & 0x7ff0 == 0x7ff0)
407 return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f64);407 return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f64);
408408
409 ix = @as(i64, @bitCast(x * 0x1p52)) - (52 << 52);409 ix = @as(i64, @bitCast(x * 0x1p52)) - (52 << 52);
410 }410 }
lib/compiler_rt/log10.zig+6-6
...@@ -10,7 +10,7 @@ const expect = std.testing.expect;...@@ -10,7 +10,7 @@ const expect = std.testing.expect;
10const expectEqual = std.testing.expectEqual;10const expectEqual = std.testing.expectEqual;
11const maxInt = std.math.maxInt;11const maxInt = std.math.maxInt;
1212
13const common = @import("common.zig");13const compiler_rt = @import("../compiler_rt.zig");
14const symbol = @import("../compiler_rt.zig").symbol;14const symbol = @import("../compiler_rt.zig").symbol;
1515
16comptime {16comptime {
...@@ -18,7 +18,7 @@ comptime {...@@ -18,7 +18,7 @@ comptime {
18 symbol(&log10f, "log10f");18 symbol(&log10f, "log10f");
19 symbol(&log10, "log10");19 symbol(&log10, "log10");
20 symbol(&__log10x, "__log10x");20 symbol(&__log10x, "__log10x");
21 if (common.want_ppc_abi) {21 if (compiler_rt.want_ppc_abi) {
22 symbol(&log10q, "log10f128");22 symbol(&log10q, "log10f128");
23 }23 }
24 symbol(&log10q, "log10q");24 symbol(&log10q, "log10q");
...@@ -49,11 +49,11 @@ pub fn log10f(x_: f32) callconv(.c) f32 {...@@ -49,11 +49,11 @@ pub fn log10f(x_: f32) callconv(.c) f32 {
49 if (ix < 0x00800000 or ix >> 31 != 0) {49 if (ix < 0x00800000 or ix >> 31 != 0) {
50 // log(+-0) = -inf50 // log(+-0) = -inf
51 if (ix << 1 == 0) {51 if (ix << 1 == 0) {
52 return if (common.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64);52 return if (compiler_rt.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64);
53 }53 }
54 // log(-#) = nan54 // log(-#) = nan
55 if (ix >> 31 != 0) {55 if (ix >> 31 != 0) {
56 return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f64);56 return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f64);
57 }57 }
5858
59 k -= 25;59 k -= 25;
...@@ -111,11 +111,11 @@ pub fn log10(x_: f64) callconv(.c) f64 {...@@ -111,11 +111,11 @@ pub fn log10(x_: f64) callconv(.c) f64 {
111 if (hx < 0x00100000 or hx >> 31 != 0) {111 if (hx < 0x00100000 or hx >> 31 != 0) {
112 // log(+-0) = -inf112 // log(+-0) = -inf
113 if (ix << 1 == 0) {113 if (ix << 1 == 0) {
114 return if (common.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64);114 return if (compiler_rt.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64);
115 }115 }
116 // log(-#) = nan116 // log(-#) = nan
117 if (hx >> 31 != 0) {117 if (hx >> 31 != 0) {
118 return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f64);118 return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f64);
119 }119 }
120120
121 // subnormal, scale x121 // subnormal, scale x
lib/compiler_rt/log2.zig+14-13
...@@ -11,18 +11,19 @@ const expect = std.testing.expect;...@@ -11,18 +11,19 @@ const expect = std.testing.expect;
11const expectEqual = std.testing.expectEqual;11const expectEqual = std.testing.expectEqual;
12const maxInt = std.math.maxInt;12const maxInt = std.math.maxInt;
13const arch = builtin.cpu.arch;13const arch = builtin.cpu.arch;
14const common = @import("common.zig");14const compiler_rt = @import("../compiler_rt.zig");
15const symbol = compiler_rt.symbol;
1516
16comptime {17comptime {
17 @export(&__log2h, .{ .name = "__log2h", .linkage = common.linkage, .visibility = common.visibility });18 symbol(&__log2h, "__log2h");
18 @export(&log2f, .{ .name = "log2f", .linkage = common.linkage, .visibility = common.visibility });19 symbol(&log2f, "log2f");
19 @export(&log2, .{ .name = "log2", .linkage = common.linkage, .visibility = common.visibility });20 symbol(&log2, "log2");
20 @export(&__log2x, .{ .name = "__log2x", .linkage = common.linkage, .visibility = common.visibility });21 symbol(&__log2x, "__log2x");
21 if (common.want_ppc_abi) {22 if (compiler_rt.want_ppc_abi) {
22 @export(&log2q, .{ .name = "log2f128", .linkage = common.linkage, .visibility = common.visibility });23 symbol(&log2q, "log2f128");
23 }24 }
24 @export(&log2q, .{ .name = "log2q", .linkage = common.linkage, .visibility = common.visibility });25 symbol(&log2q, "log2q");
25 @export(&log2l, .{ .name = "log2l", .linkage = common.linkage, .visibility = common.visibility });26 symbol(&log2l, "log2l");
26}27}
2728
28pub fn __log2h(a: f16) callconv(.c) f16 {29pub fn __log2h(a: f16) callconv(.c) f16 {
...@@ -47,11 +48,11 @@ pub fn log2f(x_: f32) callconv(.c) f32 {...@@ -47,11 +48,11 @@ pub fn log2f(x_: f32) callconv(.c) f32 {
47 if (ix < 0x00800000 or ix >> 31 != 0) {48 if (ix < 0x00800000 or ix >> 31 != 0) {
48 // log(+-0) = -inf49 // log(+-0) = -inf
49 if (ix << 1 == 0) {50 if (ix << 1 == 0) {
50 return if (common.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64);51 return if (compiler_rt.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64);
51 }52 }
52 // log(-#) = nan53 // log(-#) = nan
53 if (ix >> 31 != 0) {54 if (ix >> 31 != 0) {
54 return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f64);55 return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f64);
55 }56 }
5657
57 k -= 25;58 k -= 25;
...@@ -105,11 +106,11 @@ pub fn log2(x_: f64) callconv(.c) f64 {...@@ -105,11 +106,11 @@ pub fn log2(x_: f64) callconv(.c) f64 {
105 if (hx < 0x00100000 or hx >> 31 != 0) {106 if (hx < 0x00100000 or hx >> 31 != 0) {
106 // log(+-0) = -inf107 // log(+-0) = -inf
107 if (ix << 1 == 0) {108 if (ix << 1 == 0) {
108 return if (common.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64);109 return if (compiler_rt.want_float_exceptions) -1 / (x * x) else -std.math.inf(f64);
109 }110 }
110 // log(-#) = nan111 // log(-#) = nan
111 if (hx >> 31 != 0) {112 if (hx >> 31 != 0) {
112 return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f64);113 return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f64);
113 }114 }
114115
115 // subnormal, scale x116 // subnormal, scale x
lib/compiler_rt/memcpy.zig+4-4
...@@ -1,14 +1,14 @@...@@ -1,14 +1,14 @@
1const std = @import("std");1const std = @import("std");
2const assert = std.debug.assert;2const assert = std.debug.assert;
3const common = @import("./common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const builtin = @import("builtin");4const builtin = @import("builtin");
55
6comptime {6comptime {
7 if (builtin.object_format != .c) {7 if (builtin.object_format != .c) {
8 const export_options: std.builtin.ExportOptions = .{8 const export_options: std.builtin.ExportOptions = .{
9 .name = "memcpy",9 .name = "memcpy",
10 .linkage = common.linkage,10 .linkage = compiler_rt.linkage,
11 .visibility = common.visibility,11 .visibility = compiler_rt.visibility,
12 };12 };
1313
14 if (builtin.mode == .ReleaseSmall or builtin.zig_backend == .stage2_aarch64)14 if (builtin.mode == .ReleaseSmall or builtin.zig_backend == .stage2_aarch64)
...@@ -18,7 +18,7 @@ comptime {...@@ -18,7 +18,7 @@ comptime {
18 }18 }
19}19}
2020
21const Element = common.PreferredLoadStoreElement;21const Element = compiler_rt.PreferredLoadStoreElement;
2222
23comptime {23comptime {
24 assert(std.math.isPowerOfTwo(@sizeOf(Element)));24 assert(std.math.isPowerOfTwo(@sizeOf(Element)));
lib/compiler_rt/memmove.zig+10-10
...@@ -1,17 +1,17 @@...@@ -1,17 +1,17 @@
1const std = @import("std");1const std = @import("std");
2const common = @import("./common.zig");2const compiler_rt = @import("../compiler_rt.zig");
3const builtin = @import("builtin");3const builtin = @import("builtin");
4const assert = std.debug.assert;4const assert = std.debug.assert;
5const memcpy = @import("memcpy.zig");5const memcpy = @import("memcpy.zig");
66
7const Element = common.PreferredLoadStoreElement;7const Element = compiler_rt.PreferredLoadStoreElement;
88
9comptime {9comptime {
10 if (builtin.object_format != .c) {10 if (builtin.object_format != .c) {
11 const export_options: std.builtin.ExportOptions = .{11 const export_options: std.builtin.ExportOptions = .{
12 .name = "memmove",12 .name = "memmove",
13 .linkage = common.linkage,13 .linkage = compiler_rt.linkage,
14 .visibility = common.visibility,14 .visibility = compiler_rt.visibility,
15 };15 };
1616
17 if (builtin.mode == .ReleaseSmall or builtin.zig_backend == .stage2_aarch64)17 if (builtin.mode == .ReleaseSmall or builtin.zig_backend == .stage2_aarch64)
...@@ -39,7 +39,7 @@ fn memmoveSmall(opt_dest: ?[*]u8, opt_src: ?[*]const u8, len: usize) callconv(.c...@@ -39,7 +39,7 @@ fn memmoveSmall(opt_dest: ?[*]u8, opt_src: ?[*]const u8, len: usize) callconv(.c
39}39}
4040
41fn memmoveFast(dest: ?[*]u8, src: ?[*]u8, len: usize) callconv(.c) ?[*]u8 {41fn memmoveFast(dest: ?[*]u8, src: ?[*]u8, len: usize) callconv(.c) ?[*]u8 {
42 @setRuntimeSafety(common.test_safety);42 @setRuntimeSafety(compiler_rt.test_safety);
43 const small_limit = @max(2 * @sizeOf(Element), @sizeOf(Element));43 const small_limit = @max(2 * @sizeOf(Element), @sizeOf(Element));
4444
45 if (copySmallLength(small_limit, dest.?, src.?, len)) return dest;45 if (copySmallLength(small_limit, dest.?, src.?, len)) return dest;
...@@ -79,7 +79,7 @@ inline fn copyLessThan16(...@@ -79,7 +79,7 @@ inline fn copyLessThan16(
79 src: [*]const u8,79 src: [*]const u8,
80 len: usize,80 len: usize,
81) void {81) void {
82 @setRuntimeSafety(common.test_safety);82 @setRuntimeSafety(compiler_rt.test_safety);
83 if (len < 4) {83 if (len < 4) {
84 if (len == 0) return;84 if (len == 0) return;
85 const b = len / 2;85 const b = len / 2;
...@@ -100,7 +100,7 @@ inline fn copy16ToSmallLimit(...@@ -100,7 +100,7 @@ inline fn copy16ToSmallLimit(
100 src: [*]const u8,100 src: [*]const u8,
101 len: usize,101 len: usize,
102) bool {102) bool {
103 @setRuntimeSafety(common.test_safety);103 @setRuntimeSafety(compiler_rt.test_safety);
104 inline for (2..(std.math.log2(small_limit) + 1) / 2 + 1) |p| {104 inline for (2..(std.math.log2(small_limit) + 1) / 2 + 1) |p| {
105 const limit = 1 << (2 * p);105 const limit = 1 << (2 * p);
106 if (len < limit) {106 if (len < limit) {
...@@ -119,7 +119,7 @@ inline fn copyRange4(...@@ -119,7 +119,7 @@ inline fn copyRange4(
119 src: [*]const u8,119 src: [*]const u8,
120 len: usize,120 len: usize,
121) void {121) void {
122 @setRuntimeSafety(common.test_safety);122 @setRuntimeSafety(compiler_rt.test_safety);
123 comptime assert(std.math.isPowerOfTwo(copy_len));123 comptime assert(std.math.isPowerOfTwo(copy_len));
124 assert(len >= copy_len);124 assert(len >= copy_len);
125 assert(len < 4 * copy_len);125 assert(len < 4 * copy_len);
...@@ -147,7 +147,7 @@ inline fn copyForwards(...@@ -147,7 +147,7 @@ inline fn copyForwards(
147 src: [*]const u8,147 src: [*]const u8,
148 len: usize,148 len: usize,
149) void {149) void {
150 @setRuntimeSafety(common.test_safety);150 @setRuntimeSafety(compiler_rt.test_safety);
151 assert(len >= 2 * @sizeOf(Element));151 assert(len >= 2 * @sizeOf(Element));
152152
153 const head = src[0..@sizeOf(Element)].*;153 const head = src[0..@sizeOf(Element)].*;
...@@ -181,7 +181,7 @@ inline fn copyBlocks(...@@ -181,7 +181,7 @@ inline fn copyBlocks(
181 src: anytype,181 src: anytype,
182 max_bytes: usize,182 max_bytes: usize,
183) void {183) void {
184 @setRuntimeSafety(common.test_safety);184 @setRuntimeSafety(compiler_rt.test_safety);
185185
186 const T = @typeInfo(@TypeOf(dest)).pointer.child;186 const T = @typeInfo(@TypeOf(dest)).pointer.child;
187 comptime assert(T == @typeInfo(@TypeOf(src)).pointer.child);187 comptime assert(T == @typeInfo(@TypeOf(src)).pointer.child);
lib/compiler_rt/memset.zig deleted-33
...@@ -1,33 +0,0 @@
1const std = @import("std");
2const common = @import("./common.zig");
3const builtin = @import("builtin");
4
5comptime {
6 if (builtin.object_format != .c) {
7 @export(&memset, .{ .name = "memset", .linkage = common.linkage, .visibility = common.visibility });
8 @export(&__memset, .{ .name = "__memset", .linkage = common.linkage, .visibility = common.visibility });
9 }
10}
11
12pub fn memset(dest: ?[*]u8, c: u8, len: usize) callconv(.c) ?[*]u8 {
13 @setRuntimeSafety(false);
14
15 if (len != 0) {
16 var d = dest.?;
17 var n = len;
18 while (true) {
19 d[0] = c;
20 n -= 1;
21 if (n == 0) break;
22 d += 1;
23 }
24 }
25
26 return dest;
27}
28
29pub fn __memset(dest: ?[*]u8, c: u8, n: usize, dest_n: usize) callconv(.c) ?[*]u8 {
30 if (dest_n < n)
31 @panic("buffer overflow");
32 return memset(dest, c, n);
33}
lib/compiler_rt/modti3.zig deleted-42
...@@ -1,42 +0,0 @@
1//! Ported from:
2//!
3//! https://github.com/llvm/llvm-project/blob/2ffb1b0413efa9a24eb3c49e710e36f92e2cb50b/compiler-rt/lib/builtins/modti3.c
4
5const std = @import("std");
6const builtin = @import("builtin");
7const udivmod = @import("udivmod.zig").udivmod;
8const common = @import("common.zig");
9
10comptime {
11 if (common.want_windows_v2u64_abi) {
12 @export(&__modti3_windows_x86_64, .{ .name = "__modti3", .linkage = common.linkage, .visibility = common.visibility });
13 } else {
14 @export(&__modti3, .{ .name = "__modti3", .linkage = common.linkage, .visibility = common.visibility });
15 }
16}
17
18pub fn __modti3(a: i128, b: i128) callconv(.c) i128 {
19 return mod(a, b);
20}
21
22const v2u64 = @Vector(2, u64);
23
24fn __modti3_windows_x86_64(a: v2u64, b: v2u64) callconv(.c) v2u64 {
25 return @bitCast(mod(@as(i128, @bitCast(a)), @as(i128, @bitCast(b))));
26}
27
28inline fn mod(a: i128, b: i128) i128 {
29 const s_a = a >> (128 - 1); // s = a < 0 ? -1 : 0
30 const s_b = b >> (128 - 1); // s = b < 0 ? -1 : 0
31
32 const an = (a ^ s_a) -% s_a; // negate if s == -1
33 const bn = (b ^ s_b) -% s_b; // negate if s == -1
34
35 var r: u128 = undefined;
36 _ = udivmod(u128, @as(u128, @bitCast(an)), @as(u128, @bitCast(bn)), &r);
37 return (@as(i128, @bitCast(r)) ^ s_a) -% s_a; // negate if s == -1
38}
39
40test {
41 _ = @import("modti3_test.zig");
42}
lib/compiler_rt/modti3_test.zig+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1const __modti3 = @import("modti3.zig").__modti3;1const __modti3 = @import("udivmod.zig").__modti3;
2const testing = @import("std").testing;2const testing = @import("std").testing;
33
4fn test__modti3(a: i128, b: i128, expected: i128) !void {4fn test__modti3(a: i128, b: i128, expected: i128) !void {
lib/compiler_rt/mulXi3.zig+11-10
...@@ -1,20 +1,21 @@...@@ -1,20 +1,21 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const std = @import("std");2const std = @import("std");
3const testing = std.testing;3const testing = std.testing;
4const common = @import("common.zig");4const compiler_rt = @import("../compiler_rt.zig");
5const symbol = compiler_rt.symbol;
5const native_endian = builtin.cpu.arch.endian();6const native_endian = builtin.cpu.arch.endian();
67
7comptime {8comptime {
8 @export(&__mulsi3, .{ .name = "__mulsi3", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__mulsi3, "__mulsi3");
9 if (common.want_aeabi) {10 if (compiler_rt.want_aeabi) {
10 @export(&__aeabi_lmul, .{ .name = "__aeabi_lmul", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__aeabi_lmul, "__aeabi_lmul");
11 } else {12 } else {
12 @export(&__muldi3, .{ .name = "__muldi3", .linkage = common.linkage, .visibility = common.visibility });13 symbol(&__muldi3, "__muldi3");
13 }14 }
14 if (common.want_windows_v2u64_abi) {15 if (compiler_rt.want_windows_v2u64_abi) {
15 @export(&__multi3_windows_x86_64, .{ .name = "__multi3", .linkage = common.linkage, .visibility = common.visibility });16 symbol(&__multi3_windows_x86_64, "__multi3");
16 } else {17 } else {
17 @export(&__multi3, .{ .name = "__multi3", .linkage = common.linkage, .visibility = common.visibility });18 symbol(&__multi3, "__multi3");
18 }19 }
19}20}
2021
...@@ -41,7 +42,7 @@ fn __aeabi_lmul(a: i64, b: i64) callconv(.{ .arm_aapcs = .{} }) i64 {...@@ -41,7 +42,7 @@ fn __aeabi_lmul(a: i64, b: i64) callconv(.{ .arm_aapcs = .{} }) i64 {
41}42}
4243
43inline fn mulX(comptime T: type, a: T, b: T) T {44inline fn mulX(comptime T: type, a: T, b: T) T {
44 const word_t = common.HalveInt(T, false);45 const word_t = compiler_rt.HalveInt(T, false);
45 const x = word_t{ .all = a };46 const x = word_t{ .all = a };
46 const y = word_t{ .all = b };47 const y = word_t{ .all = b };
47 var r = switch (T) {48 var r = switch (T) {
...@@ -64,7 +65,7 @@ fn DoubleInt(comptime T: type) type {...@@ -64,7 +65,7 @@ fn DoubleInt(comptime T: type) type {
6465
65fn muldXi(comptime T: type, a: T, b: T) DoubleInt(T) {66fn muldXi(comptime T: type, a: T, b: T) DoubleInt(T) {
66 const DT = DoubleInt(T);67 const DT = DoubleInt(T);
67 const word_t = common.HalveInt(DT, false);68 const word_t = compiler_rt.HalveInt(DT, false);
68 const bits_in_word_2 = @sizeOf(T) * 8 / 2;69 const bits_in_word_2 = @sizeOf(T) * 8 / 2;
69 const lower_mask = (~@as(T, 0)) >> bits_in_word_2;70 const lower_mask = (~@as(T, 0)) >> bits_in_word_2;
7071
lib/compiler_rt/muldf3.zig+2-2
...@@ -1,9 +1,9 @@...@@ -1,9 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = @import("../compiler_rt.zig").symbol;2const symbol = @import("../compiler_rt.zig").symbol;
3const mulf3 = @import("./mulf3.zig").mulf3;3const mulf3 = @import("./mulf3.zig").mulf3;
44
5comptime {5comptime {
6 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
7 symbol(&__aeabi_dmul, "__aeabi_dmul");7 symbol(&__aeabi_dmul, "__aeabi_dmul");
8 } else {8 } else {
9 symbol(&__muldf3, "__muldf3");9 symbol(&__muldf3, "__muldf3");
lib/compiler_rt/mulf3.zig+4-4
...@@ -1,12 +1,12 @@...@@ -1,12 +1,12 @@
1const std = @import("std");1const std = @import("std");
2const math = std.math;2const math = std.math;
3const builtin = @import("builtin");3const builtin = @import("builtin");
4const common = @import("./common.zig");4const compiler_rt = @import("../compiler_rt.zig");
55
6/// Ported from:6/// Ported from:
7/// https://github.com/llvm/llvm-project/blob/2ffb1b0413efa9a24eb3c49e710e36f92e2cb50b/compiler-rt/lib/builtins/fp_mul_impl.inc7/// https://github.com/llvm/llvm-project/blob/2ffb1b0413efa9a24eb3c49e710e36f92e2cb50b/compiler-rt/lib/builtins/fp_mul_impl.inc
8pub inline fn mulf3(comptime T: type, a: T, b: T) T {8pub inline fn mulf3(comptime T: type, a: T, b: T) T {
9 @setRuntimeSafety(common.test_safety);9 @setRuntimeSafety(compiler_rt.test_safety);
10 const typeWidth = @typeInfo(T).float.bits;10 const typeWidth = @typeInfo(T).float.bits;
11 const significandBits = math.floatMantissaBits(T);11 const significandBits = math.floatMantissaBits(T);
12 const fractionalBits = math.floatFractionalBits(T);12 const fractionalBits = math.floatFractionalBits(T);
...@@ -97,7 +97,7 @@ pub inline fn mulf3(comptime T: type, a: T, b: T) T {...@@ -97,7 +97,7 @@ pub inline fn mulf3(comptime T: type, a: T, b: T) T {
97 var productHi: ZSignificand = undefined;97 var productHi: ZSignificand = undefined;
98 var productLo: ZSignificand = undefined;98 var productLo: ZSignificand = undefined;
99 const left_align_shift = ZSignificandBits - fractionalBits - 1;99 const left_align_shift = ZSignificandBits - fractionalBits - 1;
100 common.wideMultiply(ZSignificand, aSignificand, bSignificand << left_align_shift, &productHi, &productLo);100 compiler_rt.wideMultiply(ZSignificand, aSignificand, bSignificand << left_align_shift, &productHi, &productLo);
101101
102 var productExponent: i32 = @as(i32, @intCast(aExponent + bExponent)) - exponentBias + scale;102 var productExponent: i32 = @as(i32, @intCast(aExponent + bExponent)) - exponentBias + scale;
103103
...@@ -163,7 +163,7 @@ pub inline fn mulf3(comptime T: type, a: T, b: T) T {...@@ -163,7 +163,7 @@ pub inline fn mulf3(comptime T: type, a: T, b: T) T {
163///163///
164/// This is analogous to an shr version of `@shlWithOverflow`164/// This is analogous to an shr version of `@shlWithOverflow`
165fn wideShrWithTruncation(comptime Z: type, hi: *Z, lo: *Z, count: u32) bool {165fn wideShrWithTruncation(comptime Z: type, hi: *Z, lo: *Z, count: u32) bool {
166 @setRuntimeSafety(common.test_safety);166 @setRuntimeSafety(compiler_rt.test_safety);
167 const typeWidth = @typeInfo(Z).int.bits;167 const typeWidth = @typeInfo(Z).int.bits;
168 var inexact = false;168 var inexact = false;
169 if (count < typeWidth) {169 if (count < typeWidth) {
lib/compiler_rt/mulhc3.zig+3-2
...@@ -1,9 +1,10 @@...@@ -1,9 +1,10 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const mulc3 = @import("./mulc3.zig");3const mulc3 = @import("./mulc3.zig");
34
4comptime {5comptime {
5 if (@import("builtin").zig_backend != .stage2_c) {6 if (@import("builtin").zig_backend != .stage2_c) {
6 @export(&__mulhc3, .{ .name = "__mulhc3", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__mulhc3, "__mulhc3");
7 }8 }
8}9}
910
lib/compiler_rt/mulhf3.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const mulf3 = @import("./mulf3.zig").mulf3;3const mulf3 = @import("./mulf3.zig").mulf3;
34
4comptime {5comptime {
5 @export(&__mulhf3, .{ .name = "__mulhf3", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__mulhf3, "__mulhf3");
6}7}
78
8pub fn __mulhf3(a: f16, b: f16) callconv(.c) f16 {9pub fn __mulhf3(a: f16, b: f16) callconv(.c) f16 {
lib/compiler_rt/mulo.zig+5-4
...@@ -1,12 +1,13 @@...@@ -1,12 +1,13 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const math = std.math;3const math = std.math;
4const common = @import("common.zig");4const compiler_rt = @import("../compiler_rt.zig");
5const symbol = compiler_rt.symbol;
56
6comptime {7comptime {
7 @export(&__mulosi4, .{ .name = "__mulosi4", .linkage = common.linkage, .visibility = common.visibility });8 symbol(&__mulosi4, "__mulosi4");
8 @export(&__mulodi4, .{ .name = "__mulodi4", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__mulodi4, "__mulodi4");
9 @export(&__muloti4, .{ .name = "__muloti4", .linkage = common.linkage, .visibility = common.visibility });10 symbol(&__muloti4, "__muloti4");
10}11}
1112
12// mulo - multiplication overflow13// mulo - multiplication overflow
lib/compiler_rt/mulsf3.zig+5-4
...@@ -1,11 +1,12 @@...@@ -1,11 +1,12 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const mulf3 = @import("./mulf3.zig").mulf3;3const mulf3 = @import("./mulf3.zig").mulf3;
34
4comptime {5comptime {
5 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
6 @export(&__aeabi_fmul, .{ .name = "__aeabi_fmul", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__aeabi_fmul, "__aeabi_fmul");
7 } else {8 } else {
8 @export(&__mulsf3, .{ .name = "__mulsf3", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__mulsf3, "__mulsf3");
9 }10 }
10}11}
1112
lib/compiler_rt/multc3.zig+2-2
...@@ -1,10 +1,10 @@...@@ -1,10 +1,10 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = @import("../compiler_rt.zig").symbol;2const symbol = @import("../compiler_rt.zig").symbol;
3const mulc3 = @import("./mulc3.zig");3const mulc3 = @import("./mulc3.zig");
44
5comptime {5comptime {
6 if (@import("builtin").zig_backend != .stage2_c) {6 if (@import("builtin").zig_backend != .stage2_c) {
7 if (common.want_ppc_abi)7 if (compiler_rt.want_ppc_abi)
8 symbol(&__multc3, "__mulkc3");8 symbol(&__multc3, "__mulkc3");
9 symbol(&__multc3, "__multc3");9 symbol(&__multc3, "__multc3");
10 }10 }
lib/compiler_rt/multf3.zig+7-6
...@@ -1,13 +1,14 @@...@@ -1,13 +1,14 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const mulf3 = @import("./mulf3.zig").mulf3;3const mulf3 = @import("./mulf3.zig").mulf3;
34
4comptime {5comptime {
5 if (common.want_ppc_abi) {6 if (compiler_rt.want_ppc_abi) {
6 @export(&__multf3, .{ .name = "__mulkf3", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__multf3, "__mulkf3");
7 } else if (common.want_sparc_abi) {8 } else if (compiler_rt.want_sparc_abi) {
8 @export(&_Qp_mul, .{ .name = "_Qp_mul", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&_Qp_mul, "_Qp_mul");
9 }10 }
10 @export(&__multf3, .{ .name = "__multf3", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__multf3, "__multf3");
11}12}
1213
13pub fn __multf3(a: f128, b: f128) callconv(.c) f128 {14pub fn __multf3(a: f128, b: f128) callconv(.c) f128 {
lib/compiler_rt/mulxc3.zig+3-2
...@@ -1,9 +1,10 @@...@@ -1,9 +1,10 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const mulc3 = @import("./mulc3.zig");3const mulc3 = @import("./mulc3.zig");
34
4comptime {5comptime {
5 if (@import("builtin").zig_backend != .stage2_c) {6 if (@import("builtin").zig_backend != .stage2_c) {
6 @export(&__mulxc3, .{ .name = "__mulxc3", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__mulxc3, "__mulxc3");
7 }8 }
8}9}
910
lib/compiler_rt/mulxf3.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const mulf3 = @import("./mulf3.zig").mulf3;3const mulf3 = @import("./mulf3.zig").mulf3;
34
4comptime {5comptime {
5 @export(&__mulxf3, .{ .name = "__mulxf3", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__mulxf3, "__mulxf3");
6}7}
78
8pub fn __mulxf3(a: f80, b: f80) callconv(.c) f80 {9pub fn __mulxf3(a: f80, b: f80) callconv(.c) f80 {
lib/compiler_rt/negXi2.zig deleted-39
...@@ -1,39 +0,0 @@
1//! neg - negate (the number)
2//! - negXi2 for unoptimized little and big endian
3//! sfffffff = 2^31-1
4//! two's complement inverting bits and add 1 would result in -INT_MIN == 0
5//! => -INT_MIN = -2^31 forbidden
6//! * size optimized builds
7//! * machines that dont support carry operations
8
9const std = @import("std");
10const builtin = @import("builtin");
11const common = @import("common.zig");
12
13comptime {
14 @export(&__negsi2, .{ .name = "__negsi2", .linkage = common.linkage, .visibility = common.visibility });
15 @export(&__negdi2, .{ .name = "__negdi2", .linkage = common.linkage, .visibility = common.visibility });
16 @export(&__negti2, .{ .name = "__negti2", .linkage = common.linkage, .visibility = common.visibility });
17}
18
19pub fn __negsi2(a: i32) callconv(.c) i32 {
20 return negXi2(i32, a);
21}
22
23pub fn __negdi2(a: i64) callconv(.c) i64 {
24 return negXi2(i64, a);
25}
26
27pub fn __negti2(a: i128) callconv(.c) i128 {
28 return negXi2(i128, a);
29}
30
31inline fn negXi2(comptime T: type, a: T) T {
32 return -a;
33}
34
35test {
36 _ = @import("negsi2_test.zig");
37 _ = @import("negdi2_test.zig");
38 _ = @import("negti2_test.zig");
39}
lib/compiler_rt/negdf2.zig deleted-17
...@@ -1,17 +0,0 @@
1const common = @import("./common.zig");
2
3comptime {
4 if (common.want_aeabi) {
5 @export(&__aeabi_dneg, .{ .name = "__aeabi_dneg", .linkage = common.linkage, .visibility = common.visibility });
6 } else {
7 @export(&__negdf2, .{ .name = "__negdf2", .linkage = common.linkage, .visibility = common.visibility });
8 }
9}
10
11fn __negdf2(a: f64) callconv(.c) f64 {
12 return common.fneg(a);
13}
14
15fn __aeabi_dneg(a: f64) callconv(.{ .arm_aapcs = .{} }) f64 {
16 return common.fneg(a);
17}
lib/compiler_rt/negdi2_test.zig+5-3
...@@ -1,8 +1,10 @@...@@ -1,8 +1,10 @@
1const neg = @import("negXi2.zig");1const std = @import("std");
2const testing = @import("std").testing;2const testing = std.testing;
3
4const compiler_rt = @import("../compiler_rt.zig");
35
4fn test__negdi2(a: i64, expected: i64) !void {6fn test__negdi2(a: i64, expected: i64) !void {
5 const result = neg.__negdi2(a);7 const result = compiler_rt.__negdi2(a);
6 try testing.expectEqual(expected, result);8 try testing.expectEqual(expected, result);
7}9}
810
lib/compiler_rt/neghf2.zig deleted-9
...@@ -1,9 +0,0 @@
1const common = @import("./common.zig");
2
3comptime {
4 @export(&__neghf2, .{ .name = "__neghf2", .linkage = common.linkage, .visibility = common.visibility });
5}
6
7fn __neghf2(a: f16) callconv(.c) f16 {
8 return common.fneg(a);
9}
lib/compiler_rt/negsf2.zig deleted-17
...@@ -1,17 +0,0 @@
1const common = @import("./common.zig");
2
3comptime {
4 if (common.want_aeabi) {
5 @export(&__aeabi_fneg, .{ .name = "__aeabi_fneg", .linkage = common.linkage, .visibility = common.visibility });
6 } else {
7 @export(&__negsf2, .{ .name = "__negsf2", .linkage = common.linkage, .visibility = common.visibility });
8 }
9}
10
11fn __negsf2(a: f32) callconv(.c) f32 {
12 return common.fneg(a);
13}
14
15fn __aeabi_fneg(a: f32) callconv(.{ .arm_aapcs = .{} }) f32 {
16 return common.fneg(a);
17}
lib/compiler_rt/negsi2_test.zig+3-2
...@@ -1,11 +1,12 @@...@@ -1,11 +1,12 @@
1const std = @import("std");1const std = @import("std");
2const neg = @import("negXi2.zig");
3const testing = std.testing;2const testing = std.testing;
43
4const compiler_rt = @import("../compiler_rt.zig");
5
5const print = std.debug.print;6const print = std.debug.print;
67
7fn test__negsi2(a: i32, expected: i32) !void {8fn test__negsi2(a: i32, expected: i32) !void {
8 const result = neg.__negsi2(a);9 const result = compiler_rt.__negsi2(a);
9 try testing.expectEqual(expected, result);10 try testing.expectEqual(expected, result);
10}11}
1112
lib/compiler_rt/negtf2.zig deleted-12
...@@ -1,12 +0,0 @@
1const common = @import("./common.zig");
2const symbol = @import("../compiler_rt.zig").symbol;
3
4comptime {
5 if (common.want_ppc_abi)
6 symbol(&__negtf2, "__negkf2");
7 symbol(&__negtf2, "__negtf2");
8}
9
10fn __negtf2(a: f128) callconv(.c) f128 {
11 return common.fneg(a);
12}
lib/compiler_rt/negti2_test.zig+5-3
...@@ -1,8 +1,10 @@...@@ -1,8 +1,10 @@
1const neg = @import("negXi2.zig");1const std = @import("std");
2const testing = @import("std").testing;2const testing = std.testing;
3
4const compiler_rt = @import("../compiler_rt.zig");
35
4fn test__negti2(a: i128, expected: i128) !void {6fn test__negti2(a: i128, expected: i128) !void {
5 const result = neg.__negti2(a);7 const result = compiler_rt.__negti2(a);
6 try testing.expectEqual(expected, result);8 try testing.expectEqual(expected, result);
7}9}
810
lib/compiler_rt/negv.zig+5-4
...@@ -3,12 +3,13 @@...@@ -3,12 +3,13 @@
3//! - negvXi4_generic for unoptimized version3//! - negvXi4_generic for unoptimized version
4const std = @import("std");4const std = @import("std");
5const builtin = @import("builtin");5const builtin = @import("builtin");
6const common = @import("common.zig");6const compiler_rt = @import("../compiler_rt.zig");
7const symbol = compiler_rt.symbol;
78
8comptime {9comptime {
9 @export(&__negvsi2, .{ .name = "__negvsi2", .linkage = common.linkage, .visibility = common.visibility });10 symbol(&__negvsi2, "__negvsi2");
10 @export(&__negvdi2, .{ .name = "__negvdi2", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__negvdi2, "__negvdi2");
11 @export(&__negvti2, .{ .name = "__negvti2", .linkage = common.linkage, .visibility = common.visibility });12 symbol(&__negvti2, "__negvti2");
12}13}
1314
14pub fn __negvsi2(a: i32) callconv(.c) i32 {15pub fn __negvsi2(a: i32) callconv(.c) i32 {
lib/compiler_rt/negxf2.zig deleted-9
...@@ -1,9 +0,0 @@
1const common = @import("./common.zig");
2
3comptime {
4 @export(&__negxf2, .{ .name = "__negxf2", .linkage = common.linkage, .visibility = common.visibility });
5}
6
7fn __negxf2(a: f80) callconv(.c) f80 {
8 return common.fneg(a);
9}
lib/compiler_rt/os_version_check.zig+4-3
...@@ -1,15 +1,16 @@...@@ -1,15 +1,16 @@
1const std = @import("std");1const std = @import("std");
2const testing = std.testing;2const testing = std.testing;
3const builtin = @import("builtin");3const builtin = @import("builtin");
4const common = @import("common.zig");4const compiler_rt = @import("../compiler_rt.zig");
5const panic = @import("common.zig").panic;5const symbol = compiler_rt.symbol;
6const panic = @import("../compiler_rt.zig").panic;
67
7const have_availability_version_check = builtin.os.tag.isDarwin() and8const have_availability_version_check = builtin.os.tag.isDarwin() and
8 builtin.os.version_range.semver.min.order(.{ .major = 10, .minor = 15, .patch = 0 }).compare(.gte);9 builtin.os.version_range.semver.min.order(.{ .major = 10, .minor = 15, .patch = 0 }).compare(.gte);
910
10comptime {11comptime {
11 if (have_availability_version_check) {12 if (have_availability_version_check) {
12 @export(&__isPlatformVersionAtLeast, .{ .name = "__isPlatformVersionAtLeast", .linkage = common.linkage, .visibility = common.visibility });13 symbol(&__isPlatformVersionAtLeast, "__isPlatformVersionAtLeast");
13 }14 }
14}15}
1516
lib/compiler_rt/powiXf2.zig+2-2
...@@ -3,14 +3,14 @@...@@ -3,14 +3,14 @@
3//! Multiplication order (left-to-right or right-to-left) does not matter for3//! Multiplication order (left-to-right or right-to-left) does not matter for
4//! error propagation and this method is optimized for performance, not accuracy.4//! error propagation and this method is optimized for performance, not accuracy.
55
6const common = @import("common.zig");6const compiler_rt = @import("../compiler_rt.zig");
7const symbol = @import("../compiler_rt.zig").symbol;7const symbol = @import("../compiler_rt.zig").symbol;
88
9comptime {9comptime {
10 symbol(&__powihf2, "__powihf2");10 symbol(&__powihf2, "__powihf2");
11 symbol(&__powisf2, "__powisf2");11 symbol(&__powisf2, "__powisf2");
12 symbol(&__powidf2, "__powidf2");12 symbol(&__powidf2, "__powidf2");
13 if (common.want_ppc_abi)13 if (compiler_rt.want_ppc_abi)
14 symbol(&__powitf2, "__powikf2");14 symbol(&__powitf2, "__powikf2");
15 symbol(&__powitf2, "__powitf2");15 symbol(&__powitf2, "__powitf2");
16 symbol(&__powixf2, "__powixf2");16 symbol(&__powixf2, "__powixf2");
lib/compiler_rt/round.zig+14-13
...@@ -10,18 +10,19 @@ const math = std.math;...@@ -10,18 +10,19 @@ const math = std.math;
10const mem = std.mem;10const mem = std.mem;
11const expect = std.testing.expect;11const expect = std.testing.expect;
12const arch = builtin.cpu.arch;12const arch = builtin.cpu.arch;
13const common = @import("common.zig");13const compiler_rt = @import("../compiler_rt.zig");
14const symbol = compiler_rt.symbol;
1415
15comptime {16comptime {
16 @export(&__roundh, .{ .name = "__roundh", .linkage = common.linkage, .visibility = common.visibility });17 symbol(&__roundh, "__roundh");
17 @export(&roundf, .{ .name = "roundf", .linkage = common.linkage, .visibility = common.visibility });18 symbol(&roundf, "roundf");
18 @export(&round, .{ .name = "round", .linkage = common.linkage, .visibility = common.visibility });19 symbol(&round, "round");
19 @export(&__roundx, .{ .name = "__roundx", .linkage = common.linkage, .visibility = common.visibility });20 symbol(&__roundx, "__roundx");
20 if (common.want_ppc_abi) {21 if (compiler_rt.want_ppc_abi) {
21 @export(&roundq, .{ .name = "roundf128", .linkage = common.linkage, .visibility = common.visibility });22 symbol(&roundq, "roundf128");
22 }23 }
23 @export(&roundq, .{ .name = "roundq", .linkage = common.linkage, .visibility = common.visibility });24 symbol(&roundq, "roundq");
24 @export(&roundl, .{ .name = "roundl", .linkage = common.linkage, .visibility = common.visibility });25 symbol(&roundl, "roundl");
25}26}
2627
27pub fn __roundh(x: f16) callconv(.c) f16 {28pub fn __roundh(x: f16) callconv(.c) f16 {
...@@ -44,7 +45,7 @@ pub fn roundf(x_: f32) callconv(.c) f32 {...@@ -44,7 +45,7 @@ pub fn roundf(x_: f32) callconv(.c) f32 {
44 x = -x;45 x = -x;
45 }46 }
46 if (e < 0x7F - 1) {47 if (e < 0x7F - 1) {
47 if (common.want_float_exceptions) mem.doNotOptimizeAway(x + f32_toint);48 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + f32_toint);
48 return 0 * @as(f32, @bitCast(u));49 return 0 * @as(f32, @bitCast(u));
49 }50 }
5051
...@@ -79,7 +80,7 @@ pub fn round(x_: f64) callconv(.c) f64 {...@@ -79,7 +80,7 @@ pub fn round(x_: f64) callconv(.c) f64 {
79 x = -x;80 x = -x;
80 }81 }
81 if (e < 0x3ff - 1) {82 if (e < 0x3ff - 1) {
82 if (common.want_float_exceptions) mem.doNotOptimizeAway(x + f64_toint);83 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + f64_toint);
83 return 0 * @as(f64, @bitCast(u));84 return 0 * @as(f64, @bitCast(u));
84 }85 }
8586
...@@ -119,7 +120,7 @@ pub fn roundq(x_: f128) callconv(.c) f128 {...@@ -119,7 +120,7 @@ pub fn roundq(x_: f128) callconv(.c) f128 {
119 x = -x;120 x = -x;
120 }121 }
121 if (e < 0x3FFF - 1) {122 if (e < 0x3FFF - 1) {
122 if (common.want_float_exceptions) mem.doNotOptimizeAway(x + f128_toint);123 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + f128_toint);
123 return 0 * @as(f128, @bitCast(u));124 return 0 * @as(f128, @bitCast(u));
124 }125 }
125126
lib/compiler_rt/shift.zig+20-19
...@@ -1,33 +1,34 @@...@@ -1,33 +1,34 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const Log2Int = std.math.Log2Int;3const Log2Int = std.math.Log2Int;
4const common = @import("common.zig");4const compiler_rt = @import("../compiler_rt.zig");
5const symbol = compiler_rt.symbol;
56
6comptime {7comptime {
7 // symbol compatibility with libgcc8 // symbol compatibility with libgcc
8 @export(&__ashlsi3, .{ .name = "__ashlsi3", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__ashlsi3, "__ashlsi3");
9 @export(&__ashrsi3, .{ .name = "__ashrsi3", .linkage = common.linkage, .visibility = common.visibility });10 symbol(&__ashrsi3, "__ashrsi3");
10 @export(&__lshrsi3, .{ .name = "__lshrsi3", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__lshrsi3, "__lshrsi3");
1112
12 @export(&__ashlti3, .{ .name = "__ashlti3", .linkage = common.linkage, .visibility = common.visibility });13 symbol(&__ashlti3, "__ashlti3");
13 @export(&__ashrti3, .{ .name = "__ashrti3", .linkage = common.linkage, .visibility = common.visibility });14 symbol(&__ashrti3, "__ashrti3");
14 @export(&__lshrti3, .{ .name = "__lshrti3", .linkage = common.linkage, .visibility = common.visibility });15 symbol(&__lshrti3, "__lshrti3");
1516
16 if (common.want_aeabi) {17 if (compiler_rt.want_aeabi) {
17 @export(&__aeabi_llsl, .{ .name = "__aeabi_llsl", .linkage = common.linkage, .visibility = common.visibility });18 symbol(&__aeabi_llsl, "__aeabi_llsl");
18 @export(&__aeabi_lasr, .{ .name = "__aeabi_lasr", .linkage = common.linkage, .visibility = common.visibility });19 symbol(&__aeabi_lasr, "__aeabi_lasr");
19 @export(&__aeabi_llsr, .{ .name = "__aeabi_llsr", .linkage = common.linkage, .visibility = common.visibility });20 symbol(&__aeabi_llsr, "__aeabi_llsr");
20 } else {21 } else {
21 @export(&__ashldi3, .{ .name = "__ashldi3", .linkage = common.linkage, .visibility = common.visibility });22 symbol(&__ashldi3, "__ashldi3");
22 @export(&__ashrdi3, .{ .name = "__ashrdi3", .linkage = common.linkage, .visibility = common.visibility });23 symbol(&__ashrdi3, "__ashrdi3");
23 @export(&__lshrdi3, .{ .name = "__lshrdi3", .linkage = common.linkage, .visibility = common.visibility });24 symbol(&__lshrdi3, "__lshrdi3");
24 }25 }
25}26}
2627
27// Arithmetic shift left: shift in 0 from right to left28// Arithmetic shift left: shift in 0 from right to left
28// Precondition: 0 <= b < bits_in_dword29// Precondition: 0 <= b < bits_in_dword
29inline fn ashlXi3(comptime T: type, a: T, b: i32) T {30inline fn ashlXi3(comptime T: type, a: T, b: i32) T {
30 const word_t = common.HalveInt(T, false);31 const word_t = compiler_rt.HalveInt(T, false);
3132
32 const input = word_t{ .all = a };33 const input = word_t{ .all = a };
33 var output: word_t = undefined;34 var output: word_t = undefined;
...@@ -49,7 +50,7 @@ inline fn ashlXi3(comptime T: type, a: T, b: i32) T {...@@ -49,7 +50,7 @@ inline fn ashlXi3(comptime T: type, a: T, b: i32) T {
49// Arithmetic shift right: shift in 1 from left to right50// Arithmetic shift right: shift in 1 from left to right
50// Precondition: 0 <= b < T.bit_count51// Precondition: 0 <= b < T.bit_count
51inline fn ashrXi3(comptime T: type, a: T, b: i32) T {52inline fn ashrXi3(comptime T: type, a: T, b: i32) T {
52 const word_t = common.HalveInt(T, true);53 const word_t = compiler_rt.HalveInt(T, true);
5354
54 const input = word_t{ .all = a };55 const input = word_t{ .all = a };
55 var output: word_t = undefined;56 var output: word_t = undefined;
...@@ -72,7 +73,7 @@ inline fn ashrXi3(comptime T: type, a: T, b: i32) T {...@@ -72,7 +73,7 @@ inline fn ashrXi3(comptime T: type, a: T, b: i32) T {
72// Logical shift right: shift in 0 from left to right73// Logical shift right: shift in 0 from left to right
73// Precondition: 0 <= b < T.bit_count74// Precondition: 0 <= b < T.bit_count
74inline fn lshrXi3(comptime T: type, a: T, b: i32) T {75inline fn lshrXi3(comptime T: type, a: T, b: i32) T {
75 const word_t = common.HalveInt(T, false);76 const word_t = compiler_rt.HalveInt(T, false);
7677
77 const input = word_t{ .all = a };78 const input = word_t{ .all = a };
78 var output: word_t = undefined;79 var output: word_t = undefined;
lib/compiler_rt/sin.zig+4-4
...@@ -9,7 +9,7 @@ const math = std.math;...@@ -9,7 +9,7 @@ const math = std.math;
9const mem = std.mem;9const mem = std.mem;
10const expect = std.testing.expect;10const expect = std.testing.expect;
1111
12const common = @import("common.zig");12const compiler_rt = @import("../compiler_rt.zig");
13const symbol = @import("../compiler_rt.zig").symbol;13const symbol = @import("../compiler_rt.zig").symbol;
14const trig = @import("trig.zig");14const trig = @import("trig.zig");
15const rem_pio2 = @import("rem_pio2.zig").rem_pio2;15const rem_pio2 = @import("rem_pio2.zig").rem_pio2;
...@@ -20,7 +20,7 @@ comptime {...@@ -20,7 +20,7 @@ comptime {
20 symbol(&sinf, "sinf");20 symbol(&sinf, "sinf");
21 symbol(&sin, "sin");21 symbol(&sin, "sin");
22 symbol(&__sinx, "__sinx");22 symbol(&__sinx, "__sinx");
23 if (common.want_ppc_abi) {23 if (compiler_rt.want_ppc_abi) {
24 symbol(&sinq, "sinf128");24 symbol(&sinq, "sinf128");
25 }25 }
26 symbol(&sinq, "sinq");26 symbol(&sinq, "sinq");
...@@ -46,7 +46,7 @@ pub fn sinf(x: f32) callconv(.c) f32 {...@@ -46,7 +46,7 @@ pub fn sinf(x: f32) callconv(.c) f32 {
46 if (ix <= 0x3f490fda) { // |x| ~<= pi/446 if (ix <= 0x3f490fda) { // |x| ~<= pi/4
47 if (ix < 0x39800000) { // |x| < 2**-1247 if (ix < 0x39800000) { // |x| < 2**-12
48 // raise inexact if x!=0 and underflow if subnormal48 // raise inexact if x!=0 and underflow if subnormal
49 if (common.want_float_exceptions) {49 if (compiler_rt.want_float_exceptions) {
50 if (ix < 0x00800000) {50 if (ix < 0x00800000) {
51 mem.doNotOptimizeAway(x / 0x1p120);51 mem.doNotOptimizeAway(x / 0x1p120);
52 } else {52 } else {
...@@ -101,7 +101,7 @@ pub fn sin(x: f64) callconv(.c) f64 {...@@ -101,7 +101,7 @@ pub fn sin(x: f64) callconv(.c) f64 {
101 if (ix <= 0x3fe921fb) {101 if (ix <= 0x3fe921fb) {
102 if (ix < 0x3e500000) { // |x| < 2**-26102 if (ix < 0x3e500000) { // |x| < 2**-26
103 // raise inexact if x != 0 and underflow if subnormal103 // raise inexact if x != 0 and underflow if subnormal
104 if (common.want_float_exceptions) {104 if (compiler_rt.want_float_exceptions) {
105 if (ix < 0x00100000) {105 if (ix < 0x00100000) {
106 mem.doNotOptimizeAway(x / 0x1p120);106 mem.doNotOptimizeAway(x / 0x1p120);
107 } else {107 } else {
lib/compiler_rt/sincos.zig+13-12
...@@ -6,18 +6,19 @@ const mem = std.mem;...@@ -6,18 +6,19 @@ const mem = std.mem;
6const trig = @import("trig.zig");6const trig = @import("trig.zig");
7const rem_pio2 = @import("rem_pio2.zig").rem_pio2;7const rem_pio2 = @import("rem_pio2.zig").rem_pio2;
8const rem_pio2f = @import("rem_pio2f.zig").rem_pio2f;8const rem_pio2f = @import("rem_pio2f.zig").rem_pio2f;
9const common = @import("common.zig");9const compiler_rt = @import("../compiler_rt.zig");
10const symbol = compiler_rt.symbol;
1011
11comptime {12comptime {
12 @export(&__sincosh, .{ .name = "__sincosh", .linkage = common.linkage, .visibility = common.visibility });13 symbol(&__sincosh, "__sincosh");
13 @export(&sincosf, .{ .name = "sincosf", .linkage = common.linkage, .visibility = common.visibility });14 symbol(&sincosf, "sincosf");
14 @export(&sincos, .{ .name = "sincos", .linkage = common.linkage, .visibility = common.visibility });15 symbol(&sincos, "sincos");
15 @export(&__sincosx, .{ .name = "__sincosx", .linkage = common.linkage, .visibility = common.visibility });16 symbol(&__sincosx, "__sincosx");
16 if (common.want_ppc_abi) {17 if (compiler_rt.want_ppc_abi) {
17 @export(&sincosq, .{ .name = "sincosf128", .linkage = common.linkage, .visibility = common.visibility });18 symbol(&sincosq, "sincosf128");
18 }19 }
19 @export(&sincosq, .{ .name = "sincosq", .linkage = common.linkage, .visibility = common.visibility });20 symbol(&sincosq, "sincosq");
20 @export(&sincosl, .{ .name = "sincosl", .linkage = common.linkage, .visibility = common.visibility });21 symbol(&sincosl, "sincosl");
21}22}
2223
23pub fn __sincosh(x: f16, r_sin: *f16, r_cos: *f16) callconv(.c) void {24pub fn __sincosh(x: f16, r_sin: *f16, r_cos: *f16) callconv(.c) void {
...@@ -44,7 +45,7 @@ pub fn sincosf(x: f32, r_sin: *f32, r_cos: *f32) callconv(.c) void {...@@ -44,7 +45,7 @@ pub fn sincosf(x: f32, r_sin: *f32, r_cos: *f32) callconv(.c) void {
44 // |x| < 2**-1245 // |x| < 2**-12
45 if (ix < 0x39800000) {46 if (ix < 0x39800000) {
46 // raise inexact if x!=0 and underflow if subnormal47 // raise inexact if x!=0 and underflow if subnormal
47 if (common.want_float_exceptions) {48 if (compiler_rt.want_float_exceptions) {
48 if (ix < 0x00100000) {49 if (ix < 0x00100000) {
49 mem.doNotOptimizeAway(x / 0x1p120);50 mem.doNotOptimizeAway(x / 0x1p120);
50 } else {51 } else {
...@@ -138,7 +139,7 @@ pub fn sincos(x: f64, r_sin: *f64, r_cos: *f64) callconv(.c) void {...@@ -138,7 +139,7 @@ pub fn sincos(x: f64, r_sin: *f64, r_cos: *f64) callconv(.c) void {
138 // if |x| < 2**-27 * sqrt(2)139 // if |x| < 2**-27 * sqrt(2)
139 if (ix < 0x3e46a09e) {140 if (ix < 0x3e46a09e) {
140 // raise inexact if x != 0 and underflow if subnormal141 // raise inexact if x != 0 and underflow if subnormal
141 if (common.want_float_exceptions) {142 if (compiler_rt.want_float_exceptions) {
142 if (ix < 0x00100000) {143 if (ix < 0x00100000) {
143 mem.doNotOptimizeAway(x / 0x1p120);144 mem.doNotOptimizeAway(x / 0x1p120);
144 } else {145 } else {
...@@ -242,7 +243,7 @@ inline fn sincos_generic(comptime F: type, x: F, r_sin: *F, r_cos: *F) void {...@@ -242,7 +243,7 @@ inline fn sincos_generic(comptime F: type, x: F, r_sin: *F, r_cos: *F) void {
242 if (se < 0x3fff - math.floatFractionalBits(F) - 1) {243 if (se < 0x3fff - math.floatFractionalBits(F) - 1) {
243 // raise underflow if subnormal244 // raise underflow if subnormal
244 if (se == 0) {245 if (se == 0) {
245 if (common.want_float_exceptions) mem.doNotOptimizeAway(x * 0x1p-120);246 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x * 0x1p-120);
246 }247 }
247 r_sin.* = x;248 r_sin.* = x;
248 // raise inexact if x!=0249 // raise inexact if x!=0
lib/compiler_rt/sqrt.zig+15-14
...@@ -9,20 +9,21 @@ const std = @import("std");...@@ -9,20 +9,21 @@ const std = @import("std");
9const builtin = @import("builtin");9const builtin = @import("builtin");
10const arch = builtin.cpu.arch;10const arch = builtin.cpu.arch;
11const math = std.math;11const math = std.math;
12const common = @import("common.zig");12const compiler_rt = @import("../compiler_rt.zig");
13const symbol = compiler_rt.symbol;
1314
14comptime {15comptime {
15 @export(&__sqrth, .{ .name = "__sqrth", .linkage = common.linkage, .visibility = common.visibility });16 symbol(&__sqrth, "__sqrth");
16 @export(&sqrtf, .{ .name = "sqrtf", .linkage = common.linkage, .visibility = common.visibility });17 symbol(&sqrtf, "sqrtf");
17 @export(&sqrt, .{ .name = "sqrt", .linkage = common.linkage, .visibility = common.visibility });18 symbol(&sqrt, "sqrt");
18 @export(&__sqrtx, .{ .name = "__sqrtx", .linkage = common.linkage, .visibility = common.visibility });19 symbol(&__sqrtx, "__sqrtx");
19 if (common.want_ppc_abi) {20 if (compiler_rt.want_ppc_abi) {
20 @export(&sqrtq, .{ .name = "sqrtf128", .linkage = common.linkage, .visibility = common.visibility });21 symbol(&sqrtq, "sqrtf128");
21 } else if (common.want_sparc_abi) {22 } else if (compiler_rt.want_sparc_abi) {
22 @export(&_Qp_sqrt, .{ .name = "_Qp_sqrt", .linkage = common.linkage, .visibility = common.visibility });23 symbol(&_Qp_sqrt, "_Qp_sqrt");
23 }24 }
24 @export(&sqrtq, .{ .name = "sqrtq", .linkage = common.linkage, .visibility = common.visibility });25 symbol(&sqrtq, "sqrtq");
25 @export(&sqrtl, .{ .name = "sqrtl", .linkage = common.linkage, .visibility = common.visibility });26 symbol(&sqrtl, "sqrtl");
26}27}
2728
28pub fn __sqrth(x: f16) callconv(.c) f16 {29pub fn __sqrth(x: f16) callconv(.c) f16 {
...@@ -103,7 +104,7 @@ pub fn sqrtf(x: f32) callconv(.c) f32 {...@@ -103,7 +104,7 @@ pub fn sqrtf(x: f32) callconv(.c) f32 {
103 return x;104 return x;
104105
105 if (ix > @as(u32, @bitCast(std.math.inf(f32))))106 if (ix > @as(u32, @bitCast(std.math.inf(f32))))
106 return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f32);107 return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f32);
107108
108 ix = @as(u32, @bitCast(@as(i32, @bitCast(x * 0x1p23)) - (23 << 23)));109 ix = @as(u32, @bitCast(@as(i32, @bitCast(x * 0x1p23)) - (23 << 23)));
109 }110 }
...@@ -154,7 +155,7 @@ pub fn sqrt(x: f64) callconv(.c) f64 {...@@ -154,7 +155,7 @@ pub fn sqrt(x: f64) callconv(.c) f64 {
154 // x < 0x1p-1022 or inf or nan.155 // x < 0x1p-1022 or inf or nan.
155 if (ix & 0x7FFF_FFFF_FFFF_FFFF == 0) return x;156 if (ix & 0x7FFF_FFFF_FFFF_FFFF == 0) return x;
156 if (ix == 0x7FF0_0000_0000_0000) return x;157 if (ix == 0x7FF0_0000_0000_0000) return x;
157 if (ix > 0x7FF0_0000_0000_0000) return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f64);158 if (ix > 0x7FF0_0000_0000_0000) return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f64);
158 // x is subnormal, normalize it.159 // x is subnormal, normalize it.
159 ix = @bitCast(x * 0x1p52);160 ix = @bitCast(x * 0x1p52);
160 top = (ix >> 52) -% 52;161 top = (ix >> 52) -% 52;
...@@ -291,7 +292,7 @@ pub fn __sqrtx(x: f80) callconv(.c) f80 {...@@ -291,7 +292,7 @@ pub fn __sqrtx(x: f80) callconv(.c) f80 {
291 // x < 0x1p-16382 or inf or nan.292 // x < 0x1p-16382 or inf or nan.
292 if (ix & 0x7FFF_FFFF_FFFF_FFFF_FFFF == 0) return x;293 if (ix & 0x7FFF_FFFF_FFFF_FFFF_FFFF == 0) return x;
293 if (ix == 0x7FFF_8000_0000_0000_0000) return x;294 if (ix == 0x7FFF_8000_0000_0000_0000) return x;
294 if (ix > 0x7FFF_8000_0000_0000_0000) return if (common.want_float_exceptions) (x - x) / 0.0 else math.nan(f80);295 if (ix > 0x7FFF_8000_0000_0000_0000) return if (compiler_rt.want_float_exceptions) (x - x) / 0.0 else math.nan(f80);
295 // x is subnormal, normalize it.296 // x is subnormal, normalize it.
296 ix = @bitCast(x * 0x1p63);297 ix = @bitCast(x * 0x1p63);
297 top = (ix >> 64) -% 63;298 top = (ix >> 64) -% 63;
lib/compiler_rt/ssp.zig+12-11
...@@ -13,7 +13,8 @@...@@ -13,7 +13,8 @@
13//! - __vsprintf_chk13//! - __vsprintf_chk
1414
15const std = @import("std");15const std = @import("std");
16const common = @import("./common.zig");16const compiler_rt = @import("../compiler_rt.zig");
17const symbol = compiler_rt.symbol;
17const builtin = @import("builtin");18const builtin = @import("builtin");
1819
19extern fn memset(dest: ?[*]u8, c: u8, n: usize) callconv(.c) ?[*]u8;20extern fn memset(dest: ?[*]u8, c: u8, n: usize) callconv(.c) ?[*]u8;
...@@ -21,16 +22,16 @@ extern fn memcpy(noalias dest: ?[*]u8, noalias src: ?[*]const u8, n: usize) call...@@ -21,16 +22,16 @@ extern fn memcpy(noalias dest: ?[*]u8, noalias src: ?[*]const u8, n: usize) call
21extern fn memmove(dest: ?[*]u8, src: ?[*]const u8, n: usize) callconv(.c) ?[*]u8;22extern fn memmove(dest: ?[*]u8, src: ?[*]const u8, n: usize) callconv(.c) ?[*]u8;
2223
23comptime {24comptime {
24 @export(&__stack_chk_fail, .{ .name = if (builtin.os.tag == .openbsd) "__stack_smash_handler" else "__stack_chk_fail", .linkage = common.linkage, .visibility = common.visibility });25 @export(&__stack_chk_fail, .{ .name = if (builtin.os.tag == .openbsd) "__stack_smash_handler" else "__stack_chk_fail", .linkage = compiler_rt.linkage, .visibility = compiler_rt.visibility });
25 @export(&__chk_fail, .{ .name = "__chk_fail", .linkage = common.linkage, .visibility = common.visibility });26 symbol(&__chk_fail, "__chk_fail");
26 @export(&__stack_chk_guard, .{ .name = "__stack_chk_guard", .linkage = common.linkage, .visibility = common.visibility });27 symbol(&__stack_chk_guard, "__stack_chk_guard");
27 @export(&__strcpy_chk, .{ .name = "__strcpy_chk", .linkage = common.linkage, .visibility = common.visibility });28 symbol(&__strcpy_chk, "__strcpy_chk");
28 @export(&__strncpy_chk, .{ .name = "__strncpy_chk", .linkage = common.linkage, .visibility = common.visibility });29 symbol(&__strncpy_chk, "__strncpy_chk");
29 @export(&__strcat_chk, .{ .name = "__strcat_chk", .linkage = common.linkage, .visibility = common.visibility });30 symbol(&__strcat_chk, "__strcat_chk");
30 @export(&__strncat_chk, .{ .name = "__strncat_chk", .linkage = common.linkage, .visibility = common.visibility });31 symbol(&__strncat_chk, "__strncat_chk");
31 @export(&__memcpy_chk, .{ .name = "__memcpy_chk", .linkage = common.linkage, .visibility = common.visibility });32 symbol(&__memcpy_chk, "__memcpy_chk");
32 @export(&__memmove_chk, .{ .name = "__memmove_chk", .linkage = common.linkage, .visibility = common.visibility });33 symbol(&__memmove_chk, "__memmove_chk");
33 @export(&__memset_chk, .{ .name = "__memset_chk", .linkage = common.linkage, .visibility = common.visibility });34 symbol(&__memset_chk, "__memset_chk");
34}35}
3536
36fn __stack_chk_fail() callconv(.c) noreturn {37fn __stack_chk_fail() callconv(.c) noreturn {
lib/compiler_rt/stack_probe.zig+11-10
...@@ -1,6 +1,7 @@...@@ -1,6 +1,7 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const common = @import("common.zig");3const compiler_rt = @import("../compiler_rt.zig");
4const symbol = compiler_rt.symbol;
4const os_tag = builtin.os.tag;5const os_tag = builtin.os.tag;
5const arch = builtin.cpu.arch;6const arch = builtin.cpu.arch;
6const abi = builtin.abi;7const abi = builtin.abi;
...@@ -9,16 +10,16 @@ comptime {...@@ -9,16 +10,16 @@ comptime {
9 if (builtin.os.tag == .windows) {10 if (builtin.os.tag == .windows) {
10 // Default stack-probe functions emitted by LLVM11 // Default stack-probe functions emitted by LLVM
11 if (builtin.target.isMinGW()) {12 if (builtin.target.isMinGW()) {
12 @export(&_chkstk, .{ .name = "_alloca", .linkage = common.linkage, .visibility = common.visibility });13 symbol(&_chkstk, "_alloca");
13 @export(&__chkstk, .{ .name = "__chkstk", .linkage = common.linkage, .visibility = common.visibility });14 symbol(&__chkstk, "__chkstk");
14 @export(&___chkstk, .{ .name = "__alloca", .linkage = common.linkage, .visibility = common.visibility });15 symbol(&___chkstk, "__alloca");
15 @export(&___chkstk, .{ .name = "___chkstk", .linkage = common.linkage, .visibility = common.visibility });16 symbol(&___chkstk, "___chkstk");
16 @export(&__chkstk_ms, .{ .name = "__chkstk_ms", .linkage = common.linkage, .visibility = common.visibility });17 symbol(&__chkstk_ms, "__chkstk_ms");
17 @export(&___chkstk_ms, .{ .name = "___chkstk_ms", .linkage = common.linkage, .visibility = common.visibility });18 symbol(&___chkstk_ms, "___chkstk_ms");
18 } else if (!builtin.link_libc) {19 } else if (!builtin.link_libc) {
19 // This symbols are otherwise exported by MSVCRT.lib20 // This symbols are otherwise exported by MSVCRT.lib
20 @export(&_chkstk, .{ .name = "_chkstk", .linkage = common.linkage, .visibility = common.visibility });21 symbol(&_chkstk, "_chkstk");
21 @export(&__chkstk, .{ .name = "__chkstk", .linkage = common.linkage, .visibility = common.visibility });22 symbol(&__chkstk, "__chkstk");
22 }23 }
23 }24 }
2425
...@@ -26,7 +27,7 @@ comptime {...@@ -26,7 +27,7 @@ comptime {
26 .x86,27 .x86,
27 .x86_64,28 .x86_64,
28 => {29 => {
29 @export(&zig_probe_stack, .{ .name = "__zig_probe_stack", .linkage = common.linkage, .visibility = common.visibility });30 symbol(&zig_probe_stack, "__zig_probe_stack");
30 },31 },
31 else => {},32 else => {},
32 }33 }
lib/compiler_rt/subdf3.zig+2-2
...@@ -1,9 +1,9 @@...@@ -1,9 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const addf3 = @import("./addf3.zig").addf3;2const addf3 = @import("./addf3.zig").addf3;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
7 symbol(&__aeabi_dsub, "__aeabi_dsub");7 symbol(&__aeabi_dsub, "__aeabi_dsub");
8 } else {8 } else {
9 symbol(&__subdf3, "__subdf3");9 symbol(&__subdf3, "__subdf3");
lib/compiler_rt/subhf3.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const addf3 = @import("./addf3.zig").addf3;3const addf3 = @import("./addf3.zig").addf3;
34
4comptime {5comptime {
5 @export(&__subhf3, .{ .name = "__subhf3", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__subhf3, "__subhf3");
6}7}
78
8fn __subhf3(a: f16, b: f16) callconv(.c) f16 {9fn __subhf3(a: f16, b: f16) callconv(.c) f16 {
lib/compiler_rt/subsf3.zig+5-4
...@@ -1,11 +1,12 @@...@@ -1,11 +1,12 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const addf3 = @import("./addf3.zig").addf3;3const addf3 = @import("./addf3.zig").addf3;
34
4comptime {5comptime {
5 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
6 @export(&__aeabi_fsub, .{ .name = "__aeabi_fsub", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__aeabi_fsub, "__aeabi_fsub");
7 } else {8 } else {
8 @export(&__subsf3, .{ .name = "__subsf3", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__subsf3, "__subsf3");
9 }10 }
10}11}
1112
lib/compiler_rt/subtf3.zig+7-6
...@@ -1,13 +1,14 @@...@@ -1,13 +1,14 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const addf3 = @import("./addf3.zig").addf3;3const addf3 = @import("./addf3.zig").addf3;
34
4comptime {5comptime {
5 if (common.want_ppc_abi) {6 if (compiler_rt.want_ppc_abi) {
6 @export(&__subtf3, .{ .name = "__subkf3", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__subtf3, "__subkf3");
7 } else if (common.want_sparc_abi) {8 } else if (compiler_rt.want_sparc_abi) {
8 @export(&_Qp_sub, .{ .name = "_Qp_sub", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&_Qp_sub, "_Qp_sub");
9 }10 }
10 @export(&__subtf3, .{ .name = "__subtf3", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__subtf3, "__subtf3");
11}12}
1213
13pub fn __subtf3(a: f128, b: f128) callconv(.c) f128 {14pub fn __subtf3(a: f128, b: f128) callconv(.c) f128 {
lib/compiler_rt/subvsi3.zig+3-2
...@@ -1,8 +1,9 @@...@@ -1,8 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const testing = @import("std").testing;3const testing = @import("std").testing;
34
4comptime {5comptime {
5 @export(&__subvsi3, .{ .name = "__subvsi3", .linkage = common.linkage, .visibility = common.visibility });6 symbol(&__subvsi3, "__subvsi3");
6}7}
78
8pub fn __subvsi3(a: i32, b: i32) callconv(.c) i32 {9pub fn __subvsi3(a: i32, b: i32) callconv(.c) i32 {
lib/compiler_rt/tan.zig+4-4
...@@ -16,7 +16,7 @@ const rem_pio2 = @import("rem_pio2.zig").rem_pio2;...@@ -16,7 +16,7 @@ const rem_pio2 = @import("rem_pio2.zig").rem_pio2;
16const rem_pio2f = @import("rem_pio2f.zig").rem_pio2f;16const rem_pio2f = @import("rem_pio2f.zig").rem_pio2f;
1717
18const arch = builtin.cpu.arch;18const arch = builtin.cpu.arch;
19const common = @import("common.zig");19const compiler_rt = @import("../compiler_rt.zig");
20const symbol = @import("../compiler_rt.zig").symbol;20const symbol = @import("../compiler_rt.zig").symbol;
2121
22comptime {22comptime {
...@@ -24,7 +24,7 @@ comptime {...@@ -24,7 +24,7 @@ comptime {
24 symbol(&tanf, "tanf");24 symbol(&tanf, "tanf");
25 symbol(&tan, "tan");25 symbol(&tan, "tan");
26 symbol(&__tanx, "__tanx");26 symbol(&__tanx, "__tanx");
27 if (common.want_ppc_abi) {27 if (compiler_rt.want_ppc_abi) {
28 symbol(&tanq, "tanf128");28 symbol(&tanq, "tanf128");
29 }29 }
30 symbol(&tanq, "tanq");30 symbol(&tanq, "tanq");
...@@ -50,7 +50,7 @@ pub fn tanf(x: f32) callconv(.c) f32 {...@@ -50,7 +50,7 @@ pub fn tanf(x: f32) callconv(.c) f32 {
50 if (ix <= 0x3f490fda) { // |x| ~<= pi/450 if (ix <= 0x3f490fda) { // |x| ~<= pi/4
51 if (ix < 0x39800000) { // |x| < 2**-1251 if (ix < 0x39800000) { // |x| < 2**-12
52 // raise inexact if x!=0 and underflow if subnormal52 // raise inexact if x!=0 and underflow if subnormal
53 if (common.want_float_exceptions) {53 if (compiler_rt.want_float_exceptions) {
54 if (ix < 0x00800000) {54 if (ix < 0x00800000) {
55 mem.doNotOptimizeAway(x / 0x1p120);55 mem.doNotOptimizeAway(x / 0x1p120);
56 } else {56 } else {
...@@ -94,7 +94,7 @@ pub fn tan(x: f64) callconv(.c) f64 {...@@ -94,7 +94,7 @@ pub fn tan(x: f64) callconv(.c) f64 {
94 if (ix <= 0x3fe921fb) {94 if (ix <= 0x3fe921fb) {
95 if (ix < 0x3e400000) { // |x| < 2**-2795 if (ix < 0x3e400000) { // |x| < 2**-27
96 // raise inexact if x!=0 and underflow if subnormal96 // raise inexact if x!=0 and underflow if subnormal
97 if (common.want_float_exceptions) {97 if (compiler_rt.want_float_exceptions) {
98 if (ix < 0x00100000) {98 if (ix < 0x00100000) {
99 mem.doNotOptimizeAway(x / 0x1p120);99 mem.doNotOptimizeAway(x / 0x1p120);
100 } else {100 } else {
lib/compiler_rt/trunc.zig+6-9
...@@ -4,23 +4,20 @@...@@ -4,23 +4,20 @@
4//! https://git.musl-libc.org/cgit/musl/tree/src/math/truncf.c4//! https://git.musl-libc.org/cgit/musl/tree/src/math/truncf.c
5//! https://git.musl-libc.org/cgit/musl/tree/src/math/trunc.c5//! https://git.musl-libc.org/cgit/musl/tree/src/math/trunc.c
66
7const builtin = @import("builtin");
8const arch = builtin.cpu.arch;
9
10const std = @import("std");7const std = @import("std");
11const math = std.math;8const math = std.math;
12const mem = std.mem;9const mem = std.mem;
13const expect = std.testing.expect;10const expect = std.testing.expect;
1411
15const common = @import("common.zig");12const compiler_rt = @import("../compiler_rt.zig");
16const symbol = @import("../compiler_rt.zig").symbol;13const symbol = compiler_rt.symbol;
1714
18comptime {15comptime {
19 symbol(&__trunch, "__trunch");16 symbol(&__trunch, "__trunch");
20 symbol(&truncf, "truncf");17 symbol(&truncf, "truncf");
21 symbol(&trunc, "trunc");18 symbol(&trunc, "trunc");
22 symbol(&__truncx, "__truncx");19 symbol(&__truncx, "__truncx");
23 if (common.want_ppc_abi) {20 if (compiler_rt.want_ppc_abi) {
24 symbol(&truncq, "truncf128");21 symbol(&truncq, "truncf128");
25 }22 }
26 symbol(&truncq, "truncq");23 symbol(&truncq, "truncq");
...@@ -48,7 +45,7 @@ pub fn truncf(x: f32) callconv(.c) f32 {...@@ -48,7 +45,7 @@ pub fn truncf(x: f32) callconv(.c) f32 {
48 if (u & m == 0) {45 if (u & m == 0) {
49 return x;46 return x;
50 } else {47 } else {
51 if (common.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120);48 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120);
52 return @bitCast(u & ~m);49 return @bitCast(u & ~m);
53 }50 }
54}51}
...@@ -69,7 +66,7 @@ pub fn trunc(x: f64) callconv(.c) f64 {...@@ -69,7 +66,7 @@ pub fn trunc(x: f64) callconv(.c) f64 {
69 if (u & m == 0) {66 if (u & m == 0) {
70 return x;67 return x;
71 } else {68 } else {
72 if (common.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120);69 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120);
73 return @bitCast(u & ~m);70 return @bitCast(u & ~m);
74 }71 }
75}72}
...@@ -95,7 +92,7 @@ pub fn truncq(x: f128) callconv(.c) f128 {...@@ -95,7 +92,7 @@ pub fn truncq(x: f128) callconv(.c) f128 {
95 if (u & m == 0) {92 if (u & m == 0) {
96 return x;93 return x;
97 } else {94 } else {
98 if (common.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120);95 if (compiler_rt.want_float_exceptions) mem.doNotOptimizeAway(x + 0x1p120);
99 return @bitCast(u & ~m);96 return @bitCast(u & ~m);
100 }97 }
101}98}
lib/compiler_rt/truncdfhf2.zig+3-3
...@@ -1,15 +1,15 @@...@@ -1,15 +1,15 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const truncf = @import("./truncf.zig").truncf;2const truncf = @import("./truncf.zig").truncf;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
7 symbol(&__aeabi_d2h, "__aeabi_d2h");7 symbol(&__aeabi_d2h, "__aeabi_d2h");
8 }8 }
9 symbol(&__truncdfhf2, "__truncdfhf2");9 symbol(&__truncdfhf2, "__truncdfhf2");
10}10}
1111
12pub fn __truncdfhf2(a: f64) callconv(.c) common.F16T(f64) {12pub fn __truncdfhf2(a: f64) callconv(.c) compiler_rt.F16T(f64) {
13 return @bitCast(truncf(f16, f64, a));13 return @bitCast(truncf(f16, f64, a));
14}14}
1515
lib/compiler_rt/truncdfsf2.zig+5-4
...@@ -1,11 +1,12 @@...@@ -1,11 +1,12 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const truncf = @import("./truncf.zig").truncf;3const truncf = @import("./truncf.zig").truncf;
34
4comptime {5comptime {
5 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
6 @export(&__aeabi_d2f, .{ .name = "__aeabi_d2f", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__aeabi_d2f, "__aeabi_d2f");
7 } else {8 } else {
8 @export(&__truncdfsf2, .{ .name = "__truncdfsf2", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__truncdfsf2, "__truncdfsf2");
9 }10 }
10}11}
1112
lib/compiler_rt/truncsfhf2.zig+9-8
...@@ -1,20 +1,21 @@...@@ -1,20 +1,21 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const truncf = @import("./truncf.zig").truncf;3const truncf = @import("./truncf.zig").truncf;
34
4comptime {5comptime {
5 if (common.gnu_f16_abi) {6 if (compiler_rt.gnu_f16_abi) {
6 @export(&__gnu_f2h_ieee, .{ .name = "__gnu_f2h_ieee", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__gnu_f2h_ieee, "__gnu_f2h_ieee");
7 } else if (common.want_aeabi) {8 } else if (compiler_rt.want_aeabi) {
8 @export(&__aeabi_f2h, .{ .name = "__aeabi_f2h", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&__aeabi_f2h, "__aeabi_f2h");
9 }10 }
10 @export(&__truncsfhf2, .{ .name = "__truncsfhf2", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__truncsfhf2, "__truncsfhf2");
11}12}
1213
13pub fn __truncsfhf2(a: f32) callconv(.c) common.F16T(f32) {14pub fn __truncsfhf2(a: f32) callconv(.c) compiler_rt.F16T(f32) {
14 return @bitCast(truncf(f16, f32, a));15 return @bitCast(truncf(f16, f32, a));
15}16}
1617
17fn __gnu_f2h_ieee(a: f32) callconv(.c) common.F16T(f32) {18fn __gnu_f2h_ieee(a: f32) callconv(.c) compiler_rt.F16T(f32) {
18 return @bitCast(truncf(f16, f32, a));19 return @bitCast(truncf(f16, f32, a));
19}20}
2021
lib/compiler_rt/trunctfdf2.zig+7-6
...@@ -1,13 +1,14 @@...@@ -1,13 +1,14 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = compiler_rt.symbol;
2const truncf = @import("./truncf.zig").truncf;3const truncf = @import("./truncf.zig").truncf;
34
4comptime {5comptime {
5 if (common.want_ppc_abi) {6 if (compiler_rt.want_ppc_abi) {
6 @export(&__trunctfdf2, .{ .name = "__trunckfdf2", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__trunctfdf2, "__trunckfdf2");
7 } else if (common.want_sparc_abi) {8 } else if (compiler_rt.want_sparc_abi) {
8 @export(&_Qp_qtod, .{ .name = "_Qp_qtod", .linkage = common.linkage, .visibility = common.visibility });9 symbol(&_Qp_qtod, "_Qp_qtod");
9 }10 }
10 @export(&__trunctfdf2, .{ .name = "__trunctfdf2", .linkage = common.linkage, .visibility = common.visibility });11 symbol(&__trunctfdf2, "__trunctfdf2");
11}12}
1213
13pub fn __trunctfdf2(a: f128) callconv(.c) f64 {14pub fn __trunctfdf2(a: f128) callconv(.c) f64 {
lib/compiler_rt/trunctfhf2.zig+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = @import("../compiler_rt.zig").symbol;2const symbol = @import("../compiler_rt.zig").symbol;
3const truncf = @import("./truncf.zig").truncf;3const truncf = @import("./truncf.zig").truncf;
44
...@@ -6,6 +6,6 @@ comptime {...@@ -6,6 +6,6 @@ comptime {
6 symbol(&__trunctfhf2, "__trunctfhf2");6 symbol(&__trunctfhf2, "__trunctfhf2");
7}7}
88
9pub fn __trunctfhf2(a: f128) callconv(.c) common.F16T(f128) {9pub fn __trunctfhf2(a: f128) callconv(.c) compiler_rt.F16T(f128) {
10 return @bitCast(truncf(f16, f128, a));10 return @bitCast(truncf(f16, f128, a));
11}11}
lib/compiler_rt/trunctfsf2.zig+3-3
...@@ -1,11 +1,11 @@...@@ -1,11 +1,11 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const truncf = @import("./truncf.zig").truncf;2const truncf = @import("./truncf.zig").truncf;
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_ppc_abi) {6 if (compiler_rt.want_ppc_abi) {
7 symbol(&__trunctfsf2, "__trunckfsf2");7 symbol(&__trunctfsf2, "__trunckfsf2");
8 } else if (common.want_sparc_abi) {8 } else if (compiler_rt.want_sparc_abi) {
9 symbol(&_Qp_qtos, "_Qp_qtos");9 symbol(&_Qp_qtos, "_Qp_qtos");
10 }10 }
11 symbol(&__trunctfsf2, "__trunctfsf2");11 symbol(&__trunctfsf2, "__trunctfsf2");
lib/compiler_rt/trunctfxf2.zig+3-2
...@@ -1,9 +1,10 @@...@@ -1,9 +1,10 @@
1const math = @import("std").math;1const math = @import("std").math;
2const common = @import("./common.zig");2const compiler_rt = @import("../compiler_rt.zig");
3const symbol = compiler_rt.symbol;
3const trunc_f80 = @import("./truncf.zig").trunc_f80;4const trunc_f80 = @import("./truncf.zig").trunc_f80;
45
5comptime {6comptime {
6 @export(&__trunctfxf2, .{ .name = "__trunctfxf2", .linkage = common.linkage, .visibility = common.visibility });7 symbol(&__trunctfxf2, "__trunctfxf2");
7}8}
89
9pub fn __trunctfxf2(a: f128) callconv(.c) f80 {10pub fn __trunctfxf2(a: f128) callconv(.c) f80 {
lib/compiler_rt/truncxfhf2.zig+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const symbol = @import("../compiler_rt.zig").symbol;2const symbol = @import("../compiler_rt.zig").symbol;
3const trunc_f80 = @import("./truncf.zig").trunc_f80;3const trunc_f80 = @import("./truncf.zig").trunc_f80;
44
...@@ -6,6 +6,6 @@ comptime {...@@ -6,6 +6,6 @@ comptime {
6 symbol(&__truncxfhf2, "__truncxfhf2");6 symbol(&__truncxfhf2, "__truncxfhf2");
7}7}
88
9fn __truncxfhf2(a: f80) callconv(.c) common.F16T(f80) {9fn __truncxfhf2(a: f80) callconv(.c) compiler_rt.F16T(f80) {
10 return @bitCast(trunc_f80(f16, a));10 return @bitCast(trunc_f80(f16, a));
11}11}
lib/compiler_rt/udivmod.zig+102-6
...@@ -1,8 +1,98 @@...@@ -1,8 +1,98 @@
1const std = @import("std");
2const builtin = @import("builtin");1const builtin = @import("builtin");
2
3const std = @import("std");
3const Log2Int = std.math.Log2Int;4const Log2Int = std.math.Log2Int;
4const common = @import("common.zig");5
5const HalveInt = common.HalveInt;6const compiler_rt = @import("../compiler_rt.zig");
7const symbol = compiler_rt.symbol;
8const HalveInt = compiler_rt.HalveInt;
9
10comptime {
11 if (compiler_rt.want_windows_v2u64_abi) {
12 symbol(&__umodti3_windows_x86_64, "__umodti3");
13 symbol(&__modti3_windows_x86_64, "__modti3");
14 symbol(&__udivti3_windows_x86_64, "__udivti3");
15 symbol(&__divti3_windows_x86_64, "__divti3");
16 symbol(&__udivmodti4_windows_x86_64, "__udivmodti4");
17 } else {
18 symbol(&__umodti3, "__umodti3");
19 symbol(&__modti3, "__modti3");
20 symbol(&__udivti3, "__udivti3");
21 symbol(&__divti3, "__divti3");
22 symbol(&__udivmodti4, "__udivmodti4");
23 }
24}
25
26const v128 = @Vector(2, u64);
27const v2u64 = @Vector(2, u64);
28
29pub fn __udivmodti4(a: u128, b: u128, maybe_rem: ?*u128) callconv(.c) u128 {
30 return udivmod(u128, a, b, maybe_rem);
31}
32
33fn __udivmodti4_windows_x86_64(a: v2u64, b: v2u64, maybe_rem: ?*u128) callconv(.c) v2u64 {
34 return @bitCast(udivmod(u128, @bitCast(a), @bitCast(b), maybe_rem));
35}
36
37pub fn __divti3(a: i128, b: i128) callconv(.c) i128 {
38 return div(a, b);
39}
40
41fn __divti3_windows_x86_64(a: v128, b: v128) callconv(.c) v128 {
42 return @bitCast(div(@bitCast(a), @bitCast(b)));
43}
44
45inline fn div(a: i128, b: i128) i128 {
46 const s_a = a >> (128 - 1);
47 const s_b = b >> (128 - 1);
48
49 const an = (a ^ s_a) -% s_a;
50 const bn = (b ^ s_b) -% s_b;
51
52 const r = udivmod(u128, @bitCast(an), @bitCast(bn), null);
53 const s = s_a ^ s_b;
54 return (@as(i128, @bitCast(r)) ^ s) -% s;
55}
56
57pub fn __udivti3(a: u128, b: u128) callconv(.c) u128 {
58 return udivmod(u128, a, b, null);
59}
60
61fn __udivti3_windows_x86_64(a: v2u64, b: v2u64) callconv(.c) v2u64 {
62 return @bitCast(udivmod(u128, @bitCast(a), @bitCast(b), null));
63}
64
65pub fn __modti3(a: i128, b: i128) callconv(.c) i128 {
66 return mod(a, b);
67}
68
69fn __modti3_windows_x86_64(a: v2u64, b: v2u64) callconv(.c) v2u64 {
70 return @bitCast(mod(@as(i128, @bitCast(a)), @as(i128, @bitCast(b))));
71}
72
73inline fn mod(a: i128, b: i128) i128 {
74 const s_a = a >> (128 - 1); // s = a < 0 ? -1 : 0
75 const s_b = b >> (128 - 1); // s = b < 0 ? -1 : 0
76
77 const an = (a ^ s_a) -% s_a; // negate if s == -1
78 const bn = (b ^ s_b) -% s_b; // negate if s == -1
79
80 var r: u128 = undefined;
81 _ = udivmod(u128, @as(u128, @bitCast(an)), @as(u128, @bitCast(bn)), &r);
82 return (@as(i128, @bitCast(r)) ^ s_a) -% s_a; // negate if s == -1
83}
84
85pub fn __umodti3(a: u128, b: u128) callconv(.c) u128 {
86 var r: u128 = undefined;
87 _ = udivmod(u128, a, b, &r);
88 return r;
89}
90
91fn __umodti3_windows_x86_64(a: v2u64, b: v2u64) callconv(.c) v2u64 {
92 var r: u128 = undefined;
93 _ = udivmod(u128, @bitCast(a), @bitCast(b), &r);
94 return @bitCast(r);
95}
696
7const lo = switch (builtin.cpu.arch.endian()) {97const lo = switch (builtin.cpu.arch.endian()) {
8 .big => 1,98 .big => 1,
...@@ -14,7 +104,7 @@ const hi = 1 - lo;...@@ -14,7 +104,7 @@ const hi = 1 - lo;
14// Returns U / v_ and sets r = U % v_.104// Returns U / v_ and sets r = U % v_.
15fn divwide_generic(comptime T: type, _u1: T, _u0: T, v_: T, r: *T) T {105fn divwide_generic(comptime T: type, _u1: T, _u0: T, v_: T, r: *T) T {
16 const HalfT = HalveInt(T, false).HalfT;106 const HalfT = HalveInt(T, false).HalfT;
17 @setRuntimeSafety(common.test_safety);107 @setRuntimeSafety(compiler_rt.test_safety);
18 var v = v_;108 var v = v_;
19109
20 const b = @as(T, 1) << (@bitSizeOf(T) / 2);110 const b = @as(T, 1) << (@bitSizeOf(T) / 2);
...@@ -70,7 +160,7 @@ fn divwide_generic(comptime T: type, _u1: T, _u0: T, v_: T, r: *T) T {...@@ -70,7 +160,7 @@ fn divwide_generic(comptime T: type, _u1: T, _u0: T, v_: T, r: *T) T {
70}160}
71161
72fn divwide(comptime T: type, _u1: T, _u0: T, v: T, r: *T) T {162fn divwide(comptime T: type, _u1: T, _u0: T, v: T, r: *T) T {
73 @setRuntimeSafety(common.test_safety);163 @setRuntimeSafety(compiler_rt.test_safety);
74 if (T == u64 and builtin.target.cpu.arch == .x86_64 and builtin.target.os.tag != .windows) {164 if (T == u64 and builtin.target.cpu.arch == .x86_64 and builtin.target.os.tag != .windows) {
75 var rem: T = undefined;165 var rem: T = undefined;
76 const quo = asm (166 const quo = asm (
...@@ -90,7 +180,7 @@ fn divwide(comptime T: type, _u1: T, _u0: T, v: T, r: *T) T {...@@ -90,7 +180,7 @@ fn divwide(comptime T: type, _u1: T, _u0: T, v: T, r: *T) T {
90180
91// Returns a_ / b_ and sets maybe_rem = a_ % b.181// Returns a_ / b_ and sets maybe_rem = a_ % b.
92pub fn udivmod(comptime T: type, a_: T, b_: T, maybe_rem: ?*T) T {182pub fn udivmod(comptime T: type, a_: T, b_: T, maybe_rem: ?*T) T {
93 @setRuntimeSafety(common.test_safety);183 @setRuntimeSafety(compiler_rt.test_safety);
94 const HalfT = HalveInt(T, false).HalfT;184 const HalfT = HalveInt(T, false).HalfT;
95 const SignedT = std.meta.Int(.signed, @bitSizeOf(T));185 const SignedT = std.meta.Int(.signed, @bitSizeOf(T));
96186
...@@ -147,3 +237,9 @@ pub fn udivmod(comptime T: type, a_: T, b_: T, maybe_rem: ?*T) T {...@@ -147,3 +237,9 @@ pub fn udivmod(comptime T: type, a_: T, b_: T, maybe_rem: ?*T) T {
147 }237 }
148 return @bitCast(q);238 return @bitCast(q);
149}239}
240
241test {
242 _ = @import("modti3_test.zig");
243 _ = @import("divti3_test.zig");
244 _ = @import("udivmodti4_test.zig");
245}
lib/compiler_rt/udivmodei4.zig+3-3
...@@ -5,7 +5,7 @@ const std = @import("std");...@@ -5,7 +5,7 @@ const std = @import("std");
5const shr = std.math.shr;5const shr = std.math.shr;
6const shl = std.math.shl;6const shl = std.math.shl;
77
8const common = @import("common.zig");8const compiler_rt = @import("../compiler_rt.zig");
9const symbol = @import("../compiler_rt.zig").symbol;9const symbol = @import("../compiler_rt.zig").symbol;
1010
11const max_limbs = std.math.divCeil(usize, 65535, 32) catch unreachable; // max supported type is u6553511const max_limbs = std.math.divCeil(usize, 65535, 32) catch unreachable; // max supported type is u65535
...@@ -115,7 +115,7 @@ pub fn divmod(q: ?[]u32, r: ?[]u32, u: []const u32, v: []const u32) !void {...@@ -115,7 +115,7 @@ pub fn divmod(q: ?[]u32, r: ?[]u32, u: []const u32, v: []const u32) !void {
115}115}
116116
117pub fn __udivei4(q_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) callconv(.c) void {117pub fn __udivei4(q_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) callconv(.c) void {
118 @setRuntimeSafety(common.test_safety);118 @setRuntimeSafety(compiler_rt.test_safety);
119 const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits));119 const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits));
120 const q: []u32 = @ptrCast(@alignCast(q_p[0..byte_size]));120 const q: []u32 = @ptrCast(@alignCast(q_p[0..byte_size]));
121 const u: []const u32 = @ptrCast(@alignCast(u_p[0..byte_size]));121 const u: []const u32 = @ptrCast(@alignCast(u_p[0..byte_size]));
...@@ -124,7 +124,7 @@ pub fn __udivei4(q_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) ca...@@ -124,7 +124,7 @@ pub fn __udivei4(q_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) ca
124}124}
125125
126pub fn __umodei4(r_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) callconv(.c) void {126pub fn __umodei4(r_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) callconv(.c) void {
127 @setRuntimeSafety(common.test_safety);127 @setRuntimeSafety(compiler_rt.test_safety);
128 const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits));128 const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits));
129 const r: []u32 = @ptrCast(@alignCast(r_p[0..byte_size]));129 const r: []u32 = @ptrCast(@alignCast(r_p[0..byte_size]));
130 const u: []const u32 = @ptrCast(@alignCast(u_p[0..byte_size]));130 const u: []const u32 = @ptrCast(@alignCast(u_p[0..byte_size]));
lib/compiler_rt/udivmodti4.zig deleted-26
...@@ -1,26 +0,0 @@
1const std = @import("std");
2const builtin = @import("builtin");
3const udivmod = @import("udivmod.zig").udivmod;
4const common = @import("common.zig");
5
6comptime {
7 if (common.want_windows_v2u64_abi) {
8 @export(&__udivmodti4_windows_x86_64, .{ .name = "__udivmodti4", .linkage = common.linkage, .visibility = common.visibility });
9 } else {
10 @export(&__udivmodti4, .{ .name = "__udivmodti4", .linkage = common.linkage, .visibility = common.visibility });
11 }
12}
13
14pub fn __udivmodti4(a: u128, b: u128, maybe_rem: ?*u128) callconv(.c) u128 {
15 return udivmod(u128, a, b, maybe_rem);
16}
17
18const v2u64 = @Vector(2, u64);
19
20fn __udivmodti4_windows_x86_64(a: v2u64, b: v2u64, maybe_rem: ?*u128) callconv(.c) v2u64 {
21 return @bitCast(udivmod(u128, @bitCast(a), @bitCast(b), maybe_rem));
22}
23
24test {
25 _ = @import("udivmodti4_test.zig");
26}
lib/compiler_rt/udivmodti4_test.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1// Disable formatting to avoid unnecessary source repository bloat.1// Disable formatting to avoid unnecessary source repository bloat.
2// zig fmt: off2// zig fmt: off
3const __udivmodti4 = @import("udivmodti4.zig").__udivmodti4;3const __udivmodti4 = @import("udivmod.zig").__udivmodti4;
4const testing = @import("std").testing;4const testing = @import("std").testing;
55
6fn test__udivmodti4(a: u128, b: u128, expected_q: u128, expected_r: u128) !void {6fn test__udivmodti4(a: u128, b: u128, expected_q: u128, expected_r: u128) !void {
lib/compiler_rt/udivti3.zig deleted-22
...@@ -1,22 +0,0 @@
1const std = @import("std");
2const builtin = @import("builtin");
3const udivmod = @import("udivmod.zig").udivmod;
4const common = @import("common.zig");
5
6comptime {
7 if (common.want_windows_v2u64_abi) {
8 @export(&__udivti3_windows_x86_64, .{ .name = "__udivti3", .linkage = common.linkage, .visibility = common.visibility });
9 } else {
10 @export(&__udivti3, .{ .name = "__udivti3", .linkage = common.linkage, .visibility = common.visibility });
11 }
12}
13
14pub fn __udivti3(a: u128, b: u128) callconv(.c) u128 {
15 return udivmod(u128, a, b, null);
16}
17
18const v2u64 = @Vector(2, u64);
19
20fn __udivti3_windows_x86_64(a: v2u64, b: v2u64) callconv(.c) v2u64 {
21 return @bitCast(udivmod(u128, @bitCast(a), @bitCast(b), null));
22}
lib/compiler_rt/umodti3.zig deleted-26
...@@ -1,26 +0,0 @@
1const std = @import("std");
2const builtin = @import("builtin");
3const udivmod = @import("udivmod.zig").udivmod;
4const common = @import("common.zig");
5
6comptime {
7 if (common.want_windows_v2u64_abi) {
8 @export(&__umodti3_windows_x86_64, .{ .name = "__umodti3", .linkage = common.linkage, .visibility = common.visibility });
9 } else {
10 @export(&__umodti3, .{ .name = "__umodti3", .linkage = common.linkage, .visibility = common.visibility });
11 }
12}
13
14pub fn __umodti3(a: u128, b: u128) callconv(.c) u128 {
15 var r: u128 = undefined;
16 _ = udivmod(u128, a, b, &r);
17 return r;
18}
19
20const v2u64 = @Vector(2, u64);
21
22fn __umodti3_windows_x86_64(a: v2u64, b: v2u64) callconv(.c) v2u64 {
23 var r: u128 = undefined;
24 _ = udivmod(u128, @bitCast(a), @bitCast(b), &r);
25 return @bitCast(r);
26}
lib/compiler_rt/unorddf2.zig+2-2
...@@ -1,9 +1,9 @@...@@ -1,9 +1,9 @@
1const common = @import("./common.zig");1const compiler_rt = @import("../compiler_rt.zig");
2const comparef = @import("./comparef.zig");2const comparef = @import("./comparef.zig");
3const symbol = @import("../compiler_rt.zig").symbol;3const symbol = @import("../compiler_rt.zig").symbol;
44
5comptime {5comptime {
6 if (common.want_aeabi) {6 if (compiler_rt.want_aeabi) {
7 symbol(&__aeabi_dcmpun, "__aeabi_dcmpun");7 symbol(&__aeabi_dcmpun, "__aeabi_dcmpun");
8 } else {8 } else {
9 symbol(&__unorddf2, "__unorddf2");9 symbol(&__unorddf2, "__unorddf2");
lib/compiler_rt/unordhf2.zig deleted-10
...@@ -1,10 +0,0 @@
1const common = @import("./common.zig");
2const comparef = @import("./comparef.zig");
3
4comptime {
5 @export(&__unordhf2, .{ .name = "__unordhf2", .linkage = common.linkage, .visibility = common.visibility });
6}
7
8pub fn __unordhf2(a: f16, b: f16) callconv(.c) i32 {
9 return comparef.unordcmp(f16, a, b);
10}
lib/compiler_rt/unordsf2.zig deleted-18
...@@ -1,18 +0,0 @@
1const common = @import("./common.zig");
2const comparef = @import("./comparef.zig");
3
4comptime {
5 if (common.want_aeabi) {
6 @export(&__aeabi_fcmpun, .{ .name = "__aeabi_fcmpun", .linkage = common.linkage, .visibility = common.visibility });
7 } else {
8 @export(&__unordsf2, .{ .name = "__unordsf2", .linkage = common.linkage, .visibility = common.visibility });
9 }
10}
11
12pub fn __unordsf2(a: f32, b: f32) callconv(.c) i32 {
13 return comparef.unordcmp(f32, a, b);
14}
15
16fn __aeabi_fcmpun(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 {
17 return comparef.unordcmp(f32, a, b);
18}
lib/compiler_rt/unordtf2.zig deleted-16
...@@ -1,16 +0,0 @@
1const common = @import("./common.zig");
2const comparef = @import("./comparef.zig");
3
4comptime {
5 if (common.want_ppc_abi) {
6 @export(&__unordtf2, .{ .name = "__unordkf2", .linkage = common.linkage, .visibility = common.visibility });
7 } else if (common.want_sparc_abi) {
8 // These exports are handled in cmptf2.zig because unordered comparisons
9 // are based on calling _Qp_cmp.
10 }
11 @export(&__unordtf2, .{ .name = "__unordtf2", .linkage = common.linkage, .visibility = common.visibility });
12}
13
14fn __unordtf2(a: f128, b: f128) callconv(.c) i32 {
15 return comparef.unordcmp(f128, a, b);
16}
lib/compiler_rt/unordxf2.zig deleted-10
...@@ -1,10 +0,0 @@
1const common = @import("./common.zig");
2const comparef = @import("./comparef.zig");
3
4comptime {
5 @export(&__unordxf2, .{ .name = "__unordxf2", .linkage = common.linkage, .visibility = common.visibility });
6}
7
8pub fn __unordxf2(a: f80, b: f80) callconv(.c) i32 {
9 return comparef.unordcmp(f80, a, b);
10}