359 Commits
Author SHA1 Message Date
Lwazi Dube 6b685a440e Fix invalid bx instuction error when building for strongarm
The following command was used for building:
zig build -Dtarget=arm-freestanding -Dcpu=strongarm1110 --release=safe
2026-10-27 17:34:13 +01:00
Alex Rønne Petersen abcb478ff6 compiler_rt.atomics: sparc v9 has usize atomics too 2026-10-26 11:02:42 +01:00
Alex Rønne Petersen 2b073f92d3 compiler_rt.elf.tls: deal with the gap between ABI TCB and TLS blocks on or1k
https://git.musl-libc.org/cgit/musl/commit/?id=de5536d827114ebc6b6db7800216610385663ad2
2026-10-26 11:02:42 +01:00
David Rubin 7ef64ccf55 compiler-rt: fix f80 conversions for subnormal destination
The conversion was discarding f80's explicit leading significand bit
and using incorrect shift and sticky-bit calculations. Now we
preserve that bit and correct the rounding logic. Also ensures
f128 NaNs remain NaNs when converted to f80, even when their payload
is truncated away, rather than becoming infinity.
2026-10-24 13:42:01 +02:00
CMDRZero 64e4f9db8f Implement partially ordered operator precedence 2026-10-22 12:21:43 +02:00
Andrew Kelley ed136f8306 Merge pull request 'compiler_rt: support targets where c_longdouble is not a valid type' (#37324) from jacobly/invalid-c-longdouble into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37324
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-10-21 19:01:01 +02:00
Fateme HosseiniandSumanth Gundapaneni 3c08167cb7 compiler-rt: add hexagon v79 QFloat HVX runtime conversion funcs
Add four assembly files for half-float to integer conversions using
QFloat (qf16) on Hexagon V79.

Each function provides IEEE round-to-nearest-even or fast
round-half-away-from-zero conversion for signed and unsigned 8-bit and
16-bit integer destinations.

V79 lacks direct half-float to integer conversion. V75 and below have
native IEEE vcvt instructions,
while V81 and newer have dedicated hardware support.

Co-authored-by: Sumanth Gundapaneni <sgundapa@quicinc.com>
2026-10-21 06:08:50 +02:00
Jacob Young d85c0ba080 compiler_rt: support targets where c_longdouble is not a valid type 2026-10-20 15:45:44 -04:00
Alex Rønne Petersen 4bf2fe2ed8 compiler_rt.fmv: remove __aarch64_have_lse_atomics
Turns out this is not actually part of the FMV ABI.
2026-10-20 10:30:47 +02:00
Alex Rønne Petersen a0f9377690 compiler_rt.fmv: avoid depending on @import("aarch64_outline_atomics.zig").__aarch64_have_lse_atomics 2026-10-20 10:09:01 +02:00
Alex Rønne Petersen e771583d88 Merge pull request 'std.Target: more fixes' (#37334) from alexrp/zig:target-fixes into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37334
2026-10-20 09:52:48 +02:00
Alex Rønne Petersen 099361c146 compiler_rt: define a stub for the function multiversioning ABI
To make sure that we can link code that uses FMV, even if for now we just
conservatively use the slowest variant of a function.
2026-10-20 09:39:43 +02:00
Alex Rønne Petersen cfec358de1 compiler_rt.atomics: lanai does not support atomic instructions 2026-10-20 02:36:38 +02:00
John Benediktsson ea7667f5a5 compiler_rt: fix fma rounding and add regression tests 2026-10-14 09:24:42 +02:00
Alex Rønne Petersen 6c3be9e0e7 compiler_rt.elf.tls: fix a couple of bugs in __tls_get_addr() and __tls_get_offset()
* We need to add current_dtv_offset in __tls_get_addr() because we aren't
  reading the actual DTV entry (where that value would be baked in).
* In both __tls_get_addr() and __tls_get_offset(), we need to subtract
  area_info.abi_tcb.offset rather than area_info.block.size because we apply
  align_factor to the block size when computing the area layout.
2026-10-11 10:45:45 +02:00
Alex Rønne Petersen 19e06b06dd compiler_rt.elf.tls: add __m68k_read_tp() which is used by compilers 2026-10-11 10:45:45 +02:00
Alex Rønne Petersen dae7c7c466 compiler_rt.elf.tls: add ___tls_get_addr() which is used by 32-bit x86
As per usual, we have GNU to thank.
2026-10-11 10:10:15 +02:00
Alex Rønne Petersen c692aced23 compiler_rt.elf.tls: fix potential underflow if PT_TLS p_align is zero
Very unlikely with any sane linker, but technically allowed.
2026-10-11 10:10:04 +02:00
Alex Rønne Petersen 8b06537d92 compiler_rt.elf.tls: fix AbiTcb for arc and csky
Also simplify the logic since it turns out to really just depend on the variant.
2026-10-11 09:23:44 +02:00
Jacob Young 742474fb8c x86_64: llvm 23 changed the windows abi :( 2026-10-07 00:30:52 +02:00
Alex Rønne Petersen 265f3dd10f compiler-rt: disable __udivei4/__umodei4 test on sparc64 w/ llvm
https://codeberg.org/ziglang/zig/issues/37056
2026-10-07 00:30:52 +02:00
Alex Rønne Petersen f0d0412942 compiler-rt: move some checks up to elf.zig 2026-10-05 03:26:41 +02:00
Alex Rønne Petersen 736d37ad16 move std.os.linux.tls to compiler_rt as __zig_elf_static_tls_*
As with __zig_elf_auxv, we need a canonical location for __tls_get_addr (or
__tls_get_offset on s390x), and compiler-rt is the obvious place. But that also
means that moving all of std.os.linux.tls there just makes sense. I decided not
to namespace this under linux because it's expected that most of this code will
apply to the BSDs too.

The ABI that std now expects is:

    extern fn __zig_elf_static_tls_init(phdrs: [*]elf.ElfN.Phdr, phnum: usize) void;
    extern fn __zig_elf_static_tls_fill(area: [*]u8) usize;
    extern var __zig_elf_static_tls: extern struct {
        size: usize,
        alignment: usize,
        gdt_entry_number: usize,
    };

Users can override all three weak symbols with strong symbols if they want to
provide their own ELF TLS implementation, which may be useful to do when doing
manual dynamic loading from a static executable. Note that __tls_get_addr (or
__tls_get_offset on s390x) must also be provided, per the ELF TLS specification.
2026-10-05 03:26:41 +02:00
Alex Rønne Petersen 292edd2440 move std.os.linux.elf_aux_maybe to compiler_rt as __zig_elf_auxv
This gets rid of the super confusing and (as far as I can tell) incorrect
getauxval logic in std.os.linux, and clarifies exactly who owns this state.

The ABI that std now expects is:

    extern var __zig_elf_auxv: [*]std.elf.Auxv;

Users can technically override this weak symbol with a strong symbol if they
wish, although I see no particularly useful reason to do so.

It is now a compile error to use std.os.linux.getauxval if libc is linked,
whereas previously it would just give useless results in some cases. I consider
this to be strictly an improvement. Just use std.c.getauxval when linking libc,
which std already does correctly where it needs getauxval.

This code is expected to be further simplified once our baseline Linux version
allows implementing https://codeberg.org/ziglang/zig/issues/31290.

closes https://codeberg.org/ziglang/zig/issues/36203
2026-10-05 03:26:41 +02:00
Quinn X. J. fd0baa9834 Add __gnu_thumb1_case_{sqi,uqi,shi,uhi,si} to compiler_rt
Fixes ziglang/zig#24558
2026-09-27 11:05:23 +02:00
Alex Rønne Petersen 474e908224 compiler-rt: remove some @export usage in favor of symbol() 2026-09-26 19:12:24 +02:00
ilovapples 340e53a65e compiler_rt: downgrade ARMv6 Thumb instructions to ARMv4-valid variants 2026-08-07 15:44:32 +02:00
Jacob Young b425e68694 llvm: update for compiler_rt abi changes
Closes #12602
Closes #21234
Closes #35899
Closes #36127
2026-07-27 14:38:34 -04:00
Jacob Young 3e26b9e957 codegen: change libc f128 suffix to match llvm 2026-07-27 14:35:12 -04:00
Jacob Young a242b0be88 compiler_rt: change float abi so it can become compatible with cbe 2026-07-27 14:35:12 -04:00
rpkak 0e61c9aba3 compiler_rt: fix arg type of memset and __memset_chk 2026-07-21 09:06:26 +02:00
Andrew Kelley ae4e835a66 std.lang: rename OptimizeMode to Optimize
and remove "release" from the enum tag names.

no functional change, however, despite the addition of
backwards-compatibile declarations in this patch, it is breaking because
expressions that use `==` or `!=` operators will not able to use the
deprecated names.

I predict these names to survive until the 1.0 tag without any more
breakage.
2026-07-20 17:26:50 -07:00
Justus Klausecker 69a26976ed zig fmt
Converts usages of `@intFromEnum` and `@enumFromInt` to instead use the
new `@backingInt` and `@fromBackingInt` builtins.
2026-07-17 23:30:26 +02:00
Andrew Kelley de7fdfecd8 Merge pull request 'compiler: implement @divCeil builtin' (#36043) from pavelverigo/zig:div-ceil into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36043
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-07-08 21:15:24 +02:00
ndjenksandndjenks 160e1b229b add the missing compiler_rt routines for sparc32 (#35835)
Fixes #31067

Co-authored-by: ndjenks <ndjenkoua@gmail.com>
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35835
Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>
2026-07-07 00:34:25 +02:00
Pavel Verigo efcaf6a72d lib: use @divCeil 2026-07-06 20:49:09 +02:00
Matthew Lugg 2e05249544 compiler_rt: update for new @bitCast semantics 2026-06-24 10:20:56 +01:00
Alex Rønne Petersen 3d604248e6 compiler-rt: delete workarounds for __int128 ABI on x86_64-windows
LLVM requires frontends to lower i128 to <2 x i64> in IR to get the correct
__int128 ABI on x86_64-windows; this is what Clang does. I'm guessing our LLVM
backend didn't do this in the past, which made these hacks necessary. But it
does do so now, so just get rid of this stuff.
2026-06-19 04:25:42 +02:00
gero3 7a9f8dc939 fix division of subnormal float in softfloat targets (#32177)
Adds tests and a fix to make sure compiler_rt handles division correctly from now on.

Fixes #35283

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32177
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-06-07 04:43:39 +02:00
Christophe Delage 84aceda2d7 Remove stray frexp2 2026-05-29 14:01:12 +02:00
Christophe Delage 4cd396fc32 Finish the code sharing between logq, log2q and log10q 2026-05-29 13:53:34 +02:00
Christophe Delage 5e8a9ed9e8 Scaffolding for the code sharing between logq, log2q and log10q 2026-05-29 13:11:42 +02:00
Christophe Delage 9ed970090c Better comments 2026-05-29 12:40:58 +02:00
Christophe Delage cc71a1af48 testing near x = 1 and fixup accuracy claims 2026-05-28 21:39:43 +02:00
Christophe Delage 88fb44e1fe add f128 support for @log10() 2026-05-28 21:29:19 +02:00
Christophe Delage c8740e3b01 add f128 support for @log2() 2026-05-28 20:21:55 +02:00
Christophe Delage d40857c747 Fix article reference 2026-05-28 20:06:16 +02:00
Christophe Delage 8bf2f80cf1 Add f128 support for @log() 2026-05-28 17:01:16 +02:00
Linus Groh 83da6827fd std.mem: Remove native/foreign variants of {read,write}PackedInt() 2026-05-08 21:59:09 +01:00
Linus Groh 991f56fd6b std.meta: Remove Int in favor of @Int 2026-05-03 21:42:06 +01:00