Commit Graph

74 Commits

Author SHA1 Message Date
David Rubin d9e0cafe64 riscv: add stage2_riscv to test matrix and bypass failing tests 2024-05-11 02:17:24 -07:00
Robin Voetter ac16545895 spirv: enable passing tests 2024-04-06 13:52:48 +02:00
Ali Chraghi 0f75143c62 spirv: implement @divFloor, @floor and @mod 2024-04-06 08:50:02 +03:30
mlugg f3227598eb Sema: reset block error return trace index between cases
Resolves: #19210
2024-03-08 07:30:32 -08:00
Jacob Young aa688567f5 Air: replace .dbg_inline_* with .dbg_inline_block
This prevents the possibility of not emitting a `.dbg_inline_end`
instruction and reduces the allocation requirements of the backends.

Closes #19093
2024-03-02 21:19:34 -08:00
John Schmidt 7cb227ab67 Polish a few tests in switch.zig
- Return `error.TestFailed` instead of panicing
- Use `comptime assert` for type checks so that errors surface at
  compile time
2024-02-08 23:49:03 +01:00
John Schmidt 0d1baf0c61 Improvements after code review 2024-02-08 23:49:03 +01:00
John Schmidt dbcd53def0 Preserve field alignment in union pointer captures 2024-02-08 23:49:03 +01:00
dweiller 8108c9f4d2 test/behavior: replace all 'comptime expect' with 'comptime assert' 2024-01-15 20:55:01 +11:00
Veikka Tuominen 804cee3b93 categorize behavior/bugs/<issueno>.zig tests 2024-01-06 16:49:41 -08:00
mlugg 9c16b2370d test: update behavior to silence 'var is never mutated' errors 2023-11-19 09:57:03 +00:00
mlugg c1c9bc0c41 Sema: do not assume switch item indices align with union field indices
Resolves: #17754
2023-10-28 06:30:28 +01:00
Ali Chraghi e5d5c1d423 spirv: switch on bool 2023-10-18 02:31:16 +03:30
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 075584a4d7 spirv: enable passing tests 2023-09-23 12:36:56 -07:00
Robin Voetter 79f7481575 spirv: disable failing tests 2023-09-23 12:36:44 -07:00
Andrew Kelley 407d91f7a7 add behavior test for switch nested break
closes #10196
2023-07-26 19:02:02 -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
kcbanner 5fc5e4fbe0 sema: Fix overflow when analyzing an inline switch prong range that ends on the maximum value of the switched type 2023-06-23 18:28:33 -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
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
mlugg bcb673d94a Sema: resolve union payload switch captures with peer type resolution
This is a bit harder than it seems at first glance. Actually resolving
the type is the easy part: the interesting thing is actually getting the
capture value. We split this into three cases:

* If all payload types are the same (as is required in status quo), we
  can just do what we already do: get the first field value.
* If all payloads are in-memory coercible to the resolved type, we still
  fetch the first field, but we also emit a `bitcast` to convert to the
  resolved type.
* Otherwise, we need to handle each case separately. We emit a nested
  `switch_br` which, for each possible case, gets the corresponding
  union field, and coerces it to the resolved type. As an optimization,
  the inner switch's 'else' prong is used for any peer which is
  in-memory coercible to the target type, and the bitcast approach
  described above is used.

Pointer captures have the additional constraint that all payload types
must be in-memory coercible to the resolved type.

Resolves: #2812
2023-06-13 12:55:22 +01: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
Ali Chraghi ccc490ef68 setup spirv backend in behavior tests 2023-05-11 20:31:52 +02:00
Jacob Young 36a39267b8 x86_64: fix feature confusion 2023-05-03 04:25:14 -04:00
Jacob Young db88b41472 x86_64: fix switch multi-prongs and mul/div flags clobber 2023-05-01 19:22:53 -04:00
Jacob Young 6de457211f behavior: update affected tests for the x86_64 backend 2023-05-01 19:22:52 -04:00
Veikka Tuominen 82a6acca93 Sema: implement inline switch capture at comptime
Closes #15157
2023-04-05 14:45:56 +03:00
Jacob Young 677427bc3a x86_64: implement error name 2023-04-02 04:49:53 -04:00
Jacob Young 1e080e5056 x86_64: implement atomic loops 2023-03-25 16:23:55 -04:00
Jacob Young 12c07fcf20 x86_64: fix more value tracking bugs 2023-03-24 17:57:58 -04:00
Jacob Young f316cb29cc x86_64: implement atomic and fence ops 2023-03-21 08:49:54 +01:00
Jacob Young c51930b060 behavior: enable passing behavior tests on stage2_x86_64 2023-03-15 01:04:21 -04:00
Veikka Tuominen 8b35f09f4a Sema: resolve lazy values in switch prong items
Closes #14330
2023-01-17 20:28:43 +02:00
joachimschmidt557 1caf56c5fb stage2 AArch64: implement errUnion{Err,Payload} for registers 2022-12-29 11:12:08 +01:00
Koakuma f9e9ba784f stage2: sparc64: Skip unimplemented tests 2022-12-10 21:51:46 +07:00
Veikka Tuominen 6310186d52 cbe: cast pointer switch target to int 2022-11-30 15:14:33 +02:00
joachimschmidt557 3ecec50f0c stage2 AArch64: implement basic switch statements 2022-11-01 20:43:27 +01:00
Jacob Young 912b84bbad cbe: fix atomics 2022-10-25 05:11:29 -04:00
joachimschmidt557 3794f2c493 stage2 ARM: implement struct_field_val for registers 2022-09-09 19:17:18 +02:00
joachimschmidt557 261fec8036 stage2 ARM: amend implementation of various AIR instructions
- unwrap_errunion_err for registers
- unwrap_errunion_payload for registers
- ptr_slice_len_ptr for all MCValues
- ptr_slice_ptr_ptr for all MCValues
2022-09-09 19:17:17 +02:00
Veikka Tuominen eec2978fac Sema: better safety check on switch on corrupt value 2022-08-05 22:13:57 +03:00
joachimschmidt557 0fc79d602b stage2 ARM: more support for switch statements 2022-07-28 20:44:32 +00:00
Andrew Kelley 0efc6a35be Sema: fix enum value without tag name used as switch item
Previously stage2 would report a false positive compile error saying there
was no tag for this value.
2022-07-19 18:39:48 -07:00
joachimschmidt557 d5ee451177 stage2 ARM: introduce support for basic switch expressions 2022-06-04 19:58:34 +02:00
Andrew Kelley 95a87e88fa Sema: forward switch condition to captures 2022-04-04 22:46:05 -07:00
Veikka Tuominen 2f326f24dd Sema: implement zirSwitchCapture multi for unions 2022-03-25 22:32:15 +02:00
Veikka Tuominen 5ff518fbb9 Sema: implement zirSwitchCapture for error sets 2022-03-25 22:32:14 +02:00
Luuk de Gram 5cb16dfa59 wasm: Enable all passing tests
All tests have been manually verified which are now passing. This means that any remaining
TODO is an actual to-be-fixed or to-be-implemented test case.
2022-03-23 21:40:33 +01:00