122 Commits

Author SHA1 Message Date
Matthew Lugg fdac89d6cd remove uses of array multiplication
In preparation for its removal as accepted in
https://github.com/ziglang/zig/issues/24738.
2026-04-30 08:57:51 +01:00
Matthew Lugg c9fc921abd tests: update for accepted language change
Pointers to comptime-only types (e.g. `*type`) are no longer themselves
comptime-only types. This means explicit `comptime` annotations are
required in a few more places. However, it also introduces the ability
to access pointers to (including slices of) comptime-only types at
runtime, provided only runtime fields are being accessed.
2026-03-10 10:26:10 +00:00
Jacob Young ac64c75876 Dwarf: implement pointers to more comptime values
Closes #30600
Closes #30602
2026-01-05 11:24:48 +01:00
Ali Cheraghi 64563e2fff test: skip tests that were not meant to pass for spirv 2025-08-09 13:27:45 +03:30
Ali Cheraghi 31de2c873f spirv: refactor 2025-08-02 04:16:01 +03:30
dweiller 19fc5f4fb2 Sema: disallow slicing many-item pointer with different sentinel
This change prevents adding or changing the sentinel in the type of a
many-item pointer via the slicing syntax `ptr[a.. :S]`.
2025-07-31 12:02:19 +01:00
Jacob Young c334956a54 aarch64: workaround some optional/union issues 2025-07-28 09:03:17 -07:00
Jacob Young 5060ab99c9 aarch64: add new from scratch self-hosted backend 2025-07-22 19:43:47 -07:00
Jacob Young c71bb0f2b6 x86_64: fix pair live-out tracking
Closes #24226
2025-06-23 05:58:14 +02:00
Ali Cheraghi 872f68c9cb rename spirv backend name
`stage2_spirv64` -> `stage2_spirv`
2025-06-16 13:22:19 +03:30
Jacob Young 1f6f8b0ffe x86_64: implement integer @reduce(.Add) 2025-05-28 15:10:22 -04:00
Ali Cheraghi aec0f9b3e7 test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
mlugg 0f38558435 compiler: provide result type to sentinel expression in slice operation
Resolves: #21867
2025-02-05 19:36:14 +00:00
Techatrix 5b6326ec65 fix slice of slice with sentinel on the lhs slice
example:
```zig
test {
    var foo: [2:0]u8 = .{ 1, 2 };
    _ = foo[0.. :1][0..2];
}
```

A `.slice_open` ast node will not have a end index nor sentinel.
2024-12-29 07:00:39 +01:00
Techatrix 5d51d4474a fix slice of slice with sentinel but no end index
example:
```zig
test {
	var foo = "";
	_ = foo[0..][0.. :0];
}
```

A `.slice_sentinel` ast node may not have an end index.
2024-12-29 07:00:35 +01:00
Jacob Young a8ec306b49 Sema: fix peer resolution alignment between slice and empty struct
An empty struct that coerces to an empty array should not force
`align(1)` on the resulting slice type.
2024-11-16 21:22:57 -05:00
mlugg 0fe3fd01dd std: update std.builtin.Type fields to follow naming conventions
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-08-28 08:39:59 +01:00
David Rubin 8da212c11b riscv: update tests and fix reuse bug 2024-07-26 04:19:58 -07:00
David Rubin 81ca3a1d59 riscv: fix logic bug in ptr_elem_ptr
I was doing duplicate work with `elemOffset` multiplying by the abi size and then the `ptr_add` `genBinOp` also multiplying.

This led to having writes happening in the wrong place.
2024-07-26 04:05:41 -07:00
David Rubin 4fd8900337 riscv: rewrite "binOp"
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-13 02:24:39 -07:00
David Rubin a270c6f8c8 riscv: implement optional logic 2024-06-13 02:22:33 -07:00
David Rubin b67995689d riscv: add airAggregateInit for arrays 2024-06-13 02:22:04 -07:00
David Rubin 031d8248e0 riscv: first sign of floats! 2024-06-13 02:21:38 -07:00
David Rubin 05de6c279b riscv: std.fmt.format running
- 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-13 02:20:47 -07:00
Robin Voetter b9d738a5cf spirv: disable tests that fail on pocl
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-06-10 20:32:34 +02:00
David Rubin 2fd83d8c0a riscv: by-value structs + @min 2024-05-11 02:17:24 -07:00
David Rubin a30af172e8 riscv: math progress 2024-05-11 02:17:24 -07:00
David Rubin d9e0cafe64 riscv: add stage2_riscv to test matrix and bypass failing tests 2024-05-11 02:17:24 -07:00
dweiller a219c9faaa test/behavior: fix test type check for multi-ptr slice
The original test was checking the types of irrelevant slices, the test
is for slicing of multi-pointers _without_ an end value, but the types
of slices with an end value were being checked.
2024-01-15 20:55:01 +11:00
dweiller 8108c9f4d2 test/behavior: replace all 'comptime expect' with 'comptime assert' 2024-01-15 20:55:01 +11:00
dweiller 8afafa717f sema: allow slicing *T with comptime known [0..1] 2024-01-14 17:26:45 -08:00
Veikka Tuominen 804cee3b93 categorize behavior/bugs/<issueno>.zig tests 2024-01-06 16:49:41 -08:00
Robin Voetter 28e1d82857 spirv: disable failing tests 2023-11-24 01:11:12 +01:00
mlugg 9c16b2370d test: update behavior to silence 'var is never mutated' errors 2023-11-19 09:57:03 +00:00
dweiller 81219586bc sema: allow slicing [*]T without end 2023-11-07 17:01:32 +02:00
Robin Voetter faad97edff spirv: update failing / passing tests
Some tests are now failing due to debug info changes, some tests
now pass due to improved compiler functionality.
2023-10-15 20:08:18 +02:00
Robin Voetter 2d52fc762d spirv: handle zero-sized arrays 2023-10-15 14:00:05 +02:00
Robin Voetter 08ea9a9ff6 spirv: cast result of .elem pointers to right type if needed 2023-10-15 13:59:23 +02:00
Robin Voetter a7c3d5e4ec spirv: constant elem ptr fix 2023-10-15 13:59:22 +02:00
Robin Voetter 075584a4d7 spirv: enable passing tests 2023-09-23 12:36:56 -07:00
Robin Voetter d9a8c779d8 spirv: constant elem ptr 2023-09-23 12:36:56 -07:00
Robin Voetter 8d49b2ef4e spirv: air array_to_slice 2023-09-23 12:36:56 -07:00
mlugg f26dda2117 all: migrate code to new cast builtin syntax
Most of this migration was performed automatically with `zig fmt`. There
were a few exceptions which I had to manually fix:

* `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten
* `@truncate`'s fixup is incorrect for vectors
* Test cases are not formatted, and their error locations change
2023-06-24 16:56:39 -07:00
Eric Joldasov 50339f595a all: zig fmt and rename "@XToY" to "@YFromX"
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19 12:34:42 -07:00
mlugg 57f6e6729f Sema: allow empty end index in zirSliceSentinel
This fixes a regression, and enables some related behavior tests which
were accidentally disabled.
2023-06-15 01:23:58 +01:00
mlugg 45e9617720 Sema: don't assume slice value is interned when loading from comptime pointer
Resolves: #16030
2023-06-15 01:23:52 +01:00
Eric Joldasov d884d7050e all: replace comptime try with try comptime
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-13 23:46:58 +06:00
Andrew Kelley 7621e56938 Merge pull request #15753 from Snektron/spirv-more-tests
spirv: make more tests pass
2023-05-20 13:54:01 -07:00
Robin Voetter 65157d30ab spirv: ptr_elem_val
Implements the ptr_elem_val air tag. Implementation is unified
with ptr_elem_ptr.
2023-05-20 17:30:23 +02:00
Robin Voetter 37aa343079 spirv: more passing tests 2023-05-20 17:30:22 +02:00