aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/packed-struct.zig
AgeCommit message (Collapse)Author
2025-09-20disable failing stage2_aarch64 behavior testsAndrew Kelley
2025-09-20frontend: packed struct field ptr no longer finds byte bordersAndrew Kelley
technically breaking, but I doubt anyone will notice.
2025-09-20aarch64: enable fixed behaviorJacob Young
2025-09-05behavior tests: update for new requirementAndrew Kelley
packed union fields must all have matching bit sizes
2025-08-28update GenericWriter usage found by test-casesAndrew Kelley
2025-07-29disable more failing testsmlugg
Wow, *lots* of backends were reliant on Sema doing the heavy lifting for them. CBE, Wasm, and SPIR-V have all regressed in places now that they actually need to, like, initialize unions and such.
2025-07-22aarch64: add new from scratch self-hosted backendJacob Young
2025-06-28riscv64: skip failing testsBingwu Zhang
2025-06-19x86_64: increase passing test coverage on windowsJacob Young
Now that codegen has no references to linker state this is much easier. Closes #24153
2025-06-16rename spirv backend nameAli Cheraghi
`stage2_spirv64` -> `stage2_spirv`
2025-06-01x86_64: fix packed struct equalityJacob Young
Closes #22990
2025-05-28x86_64: implement integer `@reduce(.Add)`Jacob Young
2025-03-24stage2-wasm: packed store/load 128 bitsPavel Verigo
2025-03-23Merge pull request #23256 from xtexx/fix-gh-20113Jacob Young
x86_64: fix packedStore miscomp by spilling EFLAGS
2025-03-23codegen: fix packed byte-aligned relocationsJacob Young
Closes #23131
2025-03-22x86_64: add behavior test for packed storeBingwu Zhang
2025-03-18spirv: packed struct init + field val accessAli Cheraghi
2025-02-24test: skip failing tests with spirv-vulkanAli Cheraghi
2025-01-16all: update to `std.builtin.Type.Pointer.Size` field renamesmlugg
This was done by regex substitution with `sed`. I then manually went over the entire diff and fixed any incorrect changes. This diff also changes a lot of `callconv(.C)` to `callconv(.c)`, since my regex happened to also trigger here. I opted to leave these changes in, since they *are* a correct migration, even if they're not the one I was trying to do!
2025-01-10cbe: fix miscomps of the compilerJacob Young
2025-01-08cbe: fix miscomps of x86_64 backendJacob Young
2024-10-12implement packed struct equality (#21679)David Rubin
2024-08-28std: update `std.builtin.Type` fields to follow naming conventionsmlugg
The compiler actually doesn't need any functional changes for this: Sema does reification based on the tag indices of `std.builtin.Type` already! So, no zig1.wasm update is necessary. This change is necessary to disallow name clashes between fields and decls on a type, which is a prerequisite of #9938.
2024-07-26riscv: enable passing testsDavid Rubin
2024-07-26riscv: implement sub-byte additionDavid Rubin
2024-07-26riscv: implement more operatorsDavid Rubin
we can run `std.debug.print` now, with both run-time strings and integers!
2024-07-14riscv: truncate `airStructFieldVal` resultDavid Rubin
2024-06-13riscv: rewrite "binOp"David Rubin
Reorganize how the binOp and genBinOp functions work. I've spent quite a while here reading exactly through the spec and so many tests are enabled because of several critical issues the old design had. There are some regressions that will take a long time to figure out individually so I will ignore them for now, and pray they get fixed by themselves. When we're closer to 100% passing is when I will start diving into them one-by-one.
2024-06-13riscv: zero registers when using register-wide operationsDavid Rubin
what was happening is that instructions like `lb` were only affecting the lower bytes of the register and leaving the top dirty. this would lead to situtations were `cmp_eq` for example was using `xor`, which was failing because of the left-over stuff in the top of the register. with this commit, we now zero out or truncate depending on the context, to ensure instructions like xor will provide proper results.
2024-06-13riscv: `std.fmt.format` runningDavid Rubin
- implements `airSlice`, `airBitAnd`, `airBitOr`, `airShr`. - got a basic design going for the `airErrorName` but for some reason it simply returns empty bytes. will investigate further. - only generating `.got.zig` entries when not compiling an object or shared library - reduced the total amount of ops a mnemonic can have to 3, simplifying the logic
2024-06-13riscv: arbitrary sized arraysDavid Rubin
2024-06-10spirv: disable tests that fail on poclRobin Voetter
Besides the Intel OpenCL CPU runtime, we can now run the behavior tests using the Portable Computing Language. This implementation is open-source, so it will be easier for us to patch in updated versions of spirv-llvm-translator that have bug fixes etc.
2024-05-21llvm: fix lowering of packed structs with optional pointersVeikka Tuominen
Closes #20022
2024-05-11riscv: finally fix bug + `airAggregateInit`David Rubin
i just hadn't realized that I placed the `riscv_start` branch in the non-simplified starts
2024-05-11riscv: math progressDavid Rubin
2024-05-11riscv: add stage2_riscv to test matrix and bypass failing testsDavid Rubin
2024-04-17compiler: rework comptime pointer representation and accessmlugg
We've got a big one here! This commit reworks how we represent pointers in the InternPool, and rewrites the logic for loading and storing from them at comptime. Firstly, the pointer representation. Previously, pointers were represented in a highly structured manner: pointers to fields, array elements, etc, were explicitly represented. This works well for simple cases, but is quite difficult to handle in the cases of unusual reinterpretations, pointer casts, offsets, etc. Therefore, pointers are now represented in a more "flat" manner. For types without well-defined layouts -- such as comptime-only types, automatic-layout aggregates, and so on -- we still use this "hierarchical" structure. However, for types with well-defined layouts, we use a byte offset associated with the pointer. This allows the comptime pointer access logic to deal with reinterpreted pointers far more gracefully, because the "base address" of a pointer -- for instance a `field` -- is a single value which pointer accesses cannot exceed since the parent has undefined layout. This strategy is also more useful to most backends -- see the updated logic in `codegen.zig` and `codegen/llvm.zig`. For backends which do prefer a chain of field and elements accesses for lowering pointer values, such as SPIR-V, there is a helpful function in `Value` which creates a strategy to derive a pointer value using ideally only field and element accesses. This is actually more correct than the previous logic, since it correctly handles pointer casts which, after the dust has settled, end up referring exactly to an aggregate field or array element. In terms of the pointer access code, it has been rewritten from the ground up. The old logic had become rather a mess of special cases being added whenever bugs were hit, and was still riddled with bugs. The new logic was written to handle the "difficult" cases correctly, the most notable of which is restructuring of a comptime-only array (for instance, converting a `[3][2]comptime_int` to a `[2][3]comptime_int`. Currently, the logic for loading and storing work somewhat differently, but a future change will likely improve the loading logic to bring it more in line with the store strategy. As far as I can tell, the rewrite has fixed all bugs exposed by #19414. As a part of this, the comptime bitcast logic has also been rewritten. Previously, bitcasts simply worked by serializing the entire value into an in-memory buffer, then deserializing it. This strategy has two key weaknesses: pointers, and undefined values. Representations of these values at comptime cannot be easily serialized/deserialized whilst preserving data, which means many bitcasts would become runtime-known if pointers were involved, or would turn `undefined` values into `0xAA`. The new logic works by "flattening" the datastructure to be cast into a sequence of bit-packed atomic values, and then "unflattening" it; using serialization when necessary, but with special handling for `undefined` values and for pointers which align in virtual memory. The resulting code is definitely slower -- more on this later -- but it is correct. The pointer access and bitcast logic required some helper functions and types which are not generally useful elsewhere, so I opted to split them into separate files `Sema/comptime_ptr_access.zig` and `Sema/bitcast.zig`, with simple re-exports in `Sema.zig` for their small public APIs. Whilst working on this branch, I caught various unrelated bugs with transitive Sema errors, and with the handling of `undefined` values. These bugs have been fixed, and corresponding behavior test added. In terms of performance, I do anticipate that this commit will regress performance somewhat, because the new pointer access and bitcast logic is necessarily more complex. I have not yet taken performance measurements, but will do shortly, and post the results in this PR. If the performance regression is severe, I will do work to to optimize the new logic before merge. Resolves: #19452 Resolves: #19460
2024-04-13cbe: fix optional codegenJacob Young
Also reduce ctype pool string memory usage, remove self assignments, and enable more warnings.
2024-02-12x86_64: fix packed loadJacob Young
2024-02-11add behavior test for recently fixed wasm backend bugAndrew Kelley
Adds the corresponding behavior test for the fix in 320c4d68f5f40794ae31d5535de9c3a8ff5cb471.
2024-02-06x86_64+macho: pass more behavior testsJakub Konka
2024-01-29Fix some comptime packed struct issuesSuperAuguste
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2024-01-06categorize `behavior/bugs/<issueno>.zig` testsVeikka Tuominen
2024-01-03Remove some `@as` coercions from assertionsCarl Åstholm
These are some spurious fixes to help illustrate the improved ergonomics of the `expectEqual` change. It is by no means complete.
2024-01-03Fix compile errors from the `expectEqual` changeCarl Åstholm
2023-12-04x86_64: fix packed struct field reuseJacob Young
2023-12-01test: test with `-fstrip` and fix failuresJacob Young
Closes #17513
2023-11-19test: update behavior to silence 'var is never mutated' errorsmlugg
2023-11-05behavior: enable test passing with x86_64 backendJacob Young
2023-10-31std.builtin.Endian: make the tags lower caseAndrew Kelley
Let's take this breaking change opportunity to fix the style of this enum.