273 Commits

Author SHA1 Message Date
Robin Voetter
79f7481575 spirv: disable failing tests 2023-09-23 12:36:44 -07:00
Andrew Kelley
8219711063 disable behavior tests regressed by LLVM 17
See #16844
See #16845
See #16846
See #16848
2023-09-19 09:37:50 -07:00
r00ster91
ee4ced9683 write function types consistently with a space before fn keyword
Currently, the compiler (like @typeName) writes it `fn(...) Type` but
zig fmt writes it `fn (...) Type` (notice the space after `fn`).
This inconsistency is now resolved and function types are consistently
written the zig fmt way. Before this there were more `fn (...) Type`
occurrences than `fn(...) Type` already.
2023-09-19 15:15:05 +03:00
Andrew Kelley
3e79315d19 x86 backend: don't read bogus safety flag
Safety is not a global flag that should be enabled or disabled for all
stores - it's lowered by the frontend directly into AIR instruction
semantics. The flag for this is communicated via the `store` vs
`store_safe` AIR instructions, and whether to write 0xaa bytes or not
should be decided in `airStore` and passed down via function parameters.

This commit is a step backwards since it removes functionality but it
aims our feet towards a better mountain to climb.
2023-09-19 00:43:21 -07:00
mlugg
cba7e8a4e9 AstGen: do not forward result pointers through @as
The `coerce_result_ptr` instruction is highly problematic and leads to
unintentional memory reinterpretation in some cases. It is more correct
to simply not forward result pointers through this builtin.

`coerce_result_ptr` is still used for struct and array initializations,
where it can still cause issues. Eliminating this usage will be a future
change.

Resolves: #16991
2023-09-15 01:05:02 -07:00
Techatrix
ab970094ab wasm: enable successful behavior tests 2023-09-10 15:59:02 +02:00
Jacob Young
e2ff486de5 Sema: cleanup coerceExtra
* remove unreachable code
 * remove already handled cases
 * avoid `InternPool.getCoerced`
 * add some undef checks
 * error when converting undef int to float

Closes #16987
2023-08-30 16:50:30 -04:00
mlugg
8d036d1d78 Sema: allow cast builtins on vectors
The following cast builtins did not previously work on vectors, and have
been made to:

* `@floatCast`
* `@ptrFromInt`
* `@intFromPtr`
* `@floatFromInt`
* `@intFromFloat`
* `@intFromBool`

Resolves: #16267
2023-08-28 12:32:02 -07:00
Stevie Hryciw
6bba5a39e4 Add behavior test for ptrCast on function pointer
Closes #6280. In the C++ implementation this triggered a
compiler assertion.
2023-08-06 18:09:41 -07:00
Jacob Young
228c956377 std: finish cleanup up asm
This also required implementing the necessary syntax in the x86_64 backend.
2023-07-31 03:49:21 -04:00
Jacob Young
9831f27238 cbe: get behavior tests running on arm
Specifically without linking libc.
2023-07-31 01:58:10 -04:00
antlilja
a0ec2266fe Update tests to new splat syntax 2023-07-12 15:35:57 -07:00
mlugg
fec7565da6
behavior: add tests for cast builtins coercing to optional and error union 2023-06-25 13:28:32 +01: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
Andrew Kelley
496320d935
Merge pull request #15726 from mlugg/feat/peer-type-resolution-but-better
Sema: rewrite peer type resolution
2023-06-14 07:18:28 -07:00
mlugg
c9531eb833
Sema: rewrite peer type resolution
The existing logic for peer type resolution was quite convoluted and
buggy. This rewrite makes it much more resilient, readable, and
extensible. The algorithm works by first iterating over the types to
select a "strategy", then applying that strategy, possibly applying peer
resolution recursively.

Several new tests have been added to cover cases which the old logic did
not correctly handle.

Resolves: #15138
Resolves: #15644
Resolves: #15693
Resolves: #15709
Resolves: #15752
2023-06-13 21:48:18 +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
Jacob Young
494d4f9b8e behavior: update for different inferred error set order
Error sets are no longer alphabetically sorted.
2023-06-10 20:47:57 -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
Andrew Kelley
958fba0eb7
Merge pull request #15713 from alichraghi/ali-spirv
spirv: get more behavior tests passing
2023-05-16 16:09:22 -07:00
Ali Chraghi
6fca3f8b72 spirv: lower ptrtoint & ignore dbg_inline instructions 2023-05-15 22:04:42 +03:30
Jacob Young
b6d6102850 x86_64: reimplement @floatToInt 2023-05-15 03:07:51 -04:00
Ali Chraghi
9c550721e4 spirv: lower float_to_int and int_to_float 2023-05-15 03:04:17 +03:30
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
f56f5af403 x86_64: fix global slices 2023-05-03 04:25:14 -04:00
Jacob Young
6de457211f behavior: update affected tests for the x86_64 backend 2023-05-01 19:22:52 -04:00
Luuk de Gram
27a41413f7
wasm: enable @intToError test 2023-04-22 21:16:23 +02:00
Jacob Young
6b23a7b61a behavior: enable a bunch of disabled tests 2023-04-21 16:36:31 -04:00
Andrew Kelley
e9d854743a disable more failing C backend tests 2023-04-15 10:33:08 -07:00
Andrew Kelley
a281d29881 disable not-yet-passing C backend tests 2023-04-15 10:33:08 -07:00
mlugg
ccf670c2b0 Zir: implement explicit block_comptime instruction
Resolves: #7056
2023-04-12 12:06:19 -04:00
Jacob Young
821eb595f4 x86_64: implement cmp_lt_errors_len 2023-04-03 15:19:07 -04:00
Jacob Young
83a208c355 x86_64: implement large cmp 2023-04-02 04:49:53 -04:00
Jacob Young
935ec9ec6a x86_64: canonicalize each br of a block 2023-03-24 17:57:58 -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
f95faac5ae x86_64: (re)implement optional ops
Note that this commit also changes the layout of optional for all
other backends using `src/codegen.zig` without updating them!
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
Jacob Young
c478c7609e CBE: implement vector operations
Also, bigint add and sub which is all I was actually trying to do.
2023-03-05 02:59:02 -05:00
Andrew Kelley
e778e47140 add test coverage for fixed bug. closes #5516 2023-02-19 21:18:27 -07:00
Veikka Tuominen
7199d7c777 split @qualCast into @constCast and @volatileCast 2023-02-15 01:43:57 +02:00
Veikka Tuominen
31ed8d293d Sema: add missing peer type resolution for error unions
Closes #14077
2023-02-11 14:36:54 +02:00
Techatrix
47ff57ed7d wasm: apply request change 2023-01-31 17:01:56 +01:00
Veikka Tuominen
58c1d98c14 add tests for fixed stage1 bugs
Closes #4144
Closes #4255
Closes #4372
Closes #4375
Closes #4380
Closes #4417
Closes #4423
Closes #4476
Closes #4528
Closes #4562
Closes #4572
Closes #4597
Closes #4639
Closes #4672
Closes #4782
Closes #4955
Closes #4984
Closes #4997
Closes #5010
Closes #5114
Closes #5166
Closes #5173
Closes #5276
2022-12-31 20:49:02 -05:00
Veikka Tuominen
9a0c593a54 add tests for fixed stage1 bugs
Closes #1957
Closes #1994
Closes #2140
Closes #2746
Closes #2802
Closes #2855
Closes #2895
Closes #2981
Closes #3054
Closes #3158
Closes #3234
Closes #3259
Closes #3371
Closes #3376
Closes #3387
Closes #3529
Closes #3653
Closes #3750
Closes #3778
Closes #3882
Closes #3915
Closes #3929
Closes #3961
Closes #3988
Closes #4123
Closes #7448
2022-12-29 12:42:44 +02:00
Veikka Tuominen
9c0f3163a8 value: fix bitcasting packed structs with u0 fields
Closes #13942
2022-12-27 15:33:27 +02:00
Veikka Tuominen
6511afcfe0 Sema: fix coercion from [:0]T to [*c]T 2022-12-19 20:45:53 +02:00