aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
AgeCommit message (Collapse)Author
2025-10-19compiler: add support for arc_interrupt calling conventionAlex Rønne Petersen
Only for use with the C backend at the moment.
2025-10-19cbe: fix MIPS register names in inline assemblyBingwu Zhang
Zig uses "rN" for MIPS register clobbers which are more ergonomic and easier to write (.rN vs. .@"$N"). However, GCC and Clang uses "$N". Bug: #25613 Signed-off-by: Bingwu Zhang <xtex@xtexx.eu.org>
2025-10-16llvm-backend: fix uefi data layoutbnuuydev
the old logic caused the uefi case to fall through which caused an assertion assertion in llvm to fail, as the data layout was wrong.
2025-10-10Coff: implement threadlocal variablesJacob Young
2025-10-07llvm.Builder: allow `Metadata` to reference metadata stringsJacob Young
Closes #25486
2025-10-03Support generating import libraries from mingw .def files without LLVMRyan Liptak
For the supported COFF machine types of X64 (x86_64), I386 (x86), ARMNT (thumb), and ARM64 (aarch64), this new Zig implementation results in byte-for-byte identical .lib files when compared to the previous LLVM-backed implementation.
2025-10-03x86_64: fix bool vector init register clobberJacob Young
Closes #25439
2025-10-02Coff: deleteJacob Young
2025-10-02Coff2: create a new linker from scratchJacob Young
2025-10-02x86_64: fix windows calling convention abiJacob Young
2025-09-27x86_64: fix `@mulAdd` miscompJacob Young
2025-09-27x86_64: fix `~`/`!` miscompsJacob Young
2025-09-27x86_64: fix `@floatFromInt` miscompsJacob Young
2025-09-27x86_64: fix unencodable `rem` loweringsmlugg
The memory operand might use one of the extended GPRs R8 through R15 and hence require a REX prefix, but having a REX prefix makes the high-byte register AH unencodeable as the src operand. This latent bug was exposed by this branch, presumably because `select` now happens to be putting something in an extended GPR instead of a legacy GPR. In theory this could be fixed with minimal cost by introducing a way to communicate to `select` that neither the destination memory nor the other temporary can be in an extended GPR. However, I just went for the simple solution which comes at a cost of one trivial instruction: copy the remainder from AH to AL, and *then* copy AL to the destination.
2025-09-27x86_64: fix miscompilation of `mul` on vectors of large intsmlugg
2025-09-27x86_64: generate better constant memcpy codemlugg
`rep movsb` isn't usually a great idea here. This commit makes the logic which tentatively existed in `genInlineMemcpy` apply in more cases, and in particular applies it to the "new" backend logic. Put simply, all copies of 128 bytes or fewer will now attempt this path first, where---provided there is an SSE register and/or a general-purpose register available---we will lower the operation using a sequence of 32, 16, 8, 4, 2, and 1 byte copy operations. The feedback I got on this diff was "Push it to master and if it miscomps I'll revert it" so don't blame me when it explodes
2025-09-26compiler: move self-hosted backends from src/arch to src/codegenAlex Rønne Petersen
2025-09-21Elf2: create a new linker from scratchJacob Young
This iteration already has significantly better incremental support. Closes #24110
2025-09-21aarch64/zonCast: don't return a pointer to a stack elementFrank Denis
Elements are computed at comptime, so don't declare them as "var".
2025-09-20aarch64: fix behavior failuresJacob Young
2025-09-20aarch64: implement `ptr_slice_*_ptr`Jacob Young
2025-09-20llvm backend: remove canElideLoad mechanismAndrew Kelley
2025-09-16llvm: fix tagged union payload size in debug infomlugg
Resolves: #24415
2025-08-31std.fmt: delete deprecated APIsAndrew Kelley
std.fmt.Formatter -> std.fmt.Alt std.fmt.format -> std.Io.Writer.print
2025-08-30Merge pull request #25077 from ziglang/GenericReaderAndrew Kelley
std.Io: delete GenericReader, AnyReader, FixedBufferStream; and related API breakage
2025-08-30Revert "llvm: workaround crashes in llvm loop optimizations"Alex Rønne Petersen
This reverts commit b4fd57a9c114748afb9ba0a04bede61089a02ddf. https://github.com/llvm/llvm-project/pull/149743
2025-08-30llvm: switch to native f16 IR type for all hexagon targetsAlex Rønne Petersen
This was fixed in LLVM 21, in particular for targets older than v68.
2025-08-30llvm: remove f16 special case for soft float aarch64Alex Rønne Petersen
2025-08-30llvm: switch to native f128 IR type for nvptxAlex Rønne Petersen
LLVM 21 added support for this.
2025-08-30llvm: switch to native f16 IR type for s390xAlex Rønne Petersen
LLVM 21 added support for this.
2025-08-30llvm: update data layout strings for LLVM 21Alex Rønne Petersen
2025-08-30std.Target: add managarm OS tagAlex Rønne Petersen
2025-08-29std.Io: delete GenericReaderAndrew Kelley
and delete deprecated alias std.io
2025-08-29LLVM backend:fix align 1 sret parameter load returnedAndrew Kelley
closes #25067
2025-08-26std.Target: add vita osMaciej 'vesim' Kuliński
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-08-25start adding big endian RISC-V supportAlex Rønne Petersen
The big endian RISC-V effort is mostly driven by MIPS (the company) which is pivoting to RISC-V, and presumably needs a big endian variant to fill the niche that big endian MIPS (the ISA) did. GCC already supports these targets, but LLVM support will only appear in 22; this commit just adds the necessary target knowledge and checks on our end.
2025-08-22feat(std.Target): add 3ds osGasInfinity
2025-08-18spirv: do not decorate nav alignmentAli Cheraghi
they seem to be always `null` even when accessed through extern key so we have no way to tell whether they have natural alignment or not to decorate. And the reason we don't always decorate them is because some environments might be too dumb and crash for this.
2025-08-15aarch64: more assembler instructionsJacob Young
Closes #24848
2025-08-13Merge pull request #24816 from mlugg/small-fixesMatthew Lugg
two small fixes
2025-08-13Merge pull request #24674 from Justus2308/undef-shift-bitwiseMatthew Lugg
Sema: Improve comptime arithmetic undef handling
2025-08-13llvm: unions which are equivalent to enums are not by-refmlugg
The LLVM backend lowers unions where all fields are zero-bit as equivalent to their backing enum, and expects them to have the same by-ref-ness in at least one place in the backend, probably more. Resolves: #23577
2025-08-13llvm: support small error limitsmlugg
Resolves: #23533
2025-08-13std.io.Writer.Allocating: rename getWritten() to written()Isaac Freund
This "get" is useless noise and was copied from FixedBufferWriter. Since this API has not yet landed in a release, now is a good time to make the breaking change to fix this.
2025-08-13optimize `@intCast` in llvm backend (#24739)Rue
2025-08-12Sema: replace all remaining aggregate interns related to `@typeInfo`Justus Klausecker
2025-08-12Sema: Improve comptime arithmetic undef handlingJustus Klausecker
This commit expands on the foundations laid by https://github.com/ziglang/zig/pull/23177 and moves even more `Sema`-only functionality from `Value` to `Sema.arith`. Specifically all shift and bitwise operations, `@truncate`, `@bitReverse` and `@byteSwap` have been moved and adapted to the new rules around `undefined`. Especially the comptime shift operations have been basically rewritten, fixing many open issues in the process. New rules applied to operators: * `<<`, `@shlExact`, `@shlWithOverflow`, `>>`, `@shrExact`: compile error if any operand is undef * `<<|`, `~`, `^`, `@truncate`, `@bitReverse`, `@byteSwap`: return undef if any operand is undef * `&`, `|`: Return undef if both operands are undef, turn undef into actual `0xAA` bytes otherwise Additionally this commit canonicalizes the representation of aggregates with all-undefined members in the `InternPool` by disallowing them and enforcing the usage of a single typed `undef` value instead. This reduces the amount of edge cases and fixes a bunch of bugs related to partially undefined vecs. List of operations directly affected by this patch: * `<<`, `<<|`, `@shlExact`, `@shlWithOverflow` * `>>`, `@shrExact` * `&`, `|`, `~`, `^` and their atomic rmw + reduce pendants * `@truncate`, `@bitReverse`, `@byteSwap`
2025-08-11std.ArrayList: make unmanaged the defaultAndrew Kelley
2025-08-11aarch64: implement more assembler instructionsJacob Young
2025-08-11cbe: emit `nonstring` attributeJacob Young
Closes #24545