Commit graph

177 commits

Author SHA1 Message Date
Robin Voetter
1deec09f03
spirv: improve union operations
This removes the strategy where union with different active
fields would be generated, and instead simply pointer casts
the active field type where required. This also allows removing
spv.ptrType and using self.ptrType instead, and allows caching
all union types (because there is only the canonical one).
2023-10-21 17:46:53 +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
Xavier Bouchoux
78fe3feedb tests: enable already passing behaviour tests for self-hosted wasm
1611 passed; 262 skipped; 0 failed.
(was: 1543 passed; 330 skipped; 0 failed.)
2023-10-14 12:50:39 +02:00
kcbanner
1b8a50ea5e union: skip failing tests on ppc 2023-10-02 20:39:02 -04:00
kcbanner
fb33bc99e1 sema: handle big-endian when bitcasting between different-sized union fields
Updated the tests to also run at runtime, and moved them to union.zig
2023-10-02 13:28:13 -04:00
Jacob Young
8470652f10 x86_64: implement float compare and cast builtins 2023-10-01 15:09:52 -04:00
Veikka Tuominen
ab3ac1e670 Value: fix assertion failure when mutating extern union
Closes #17292
2023-09-27 11:47:24 -07:00
Robin Voetter
075584a4d7 spirv: enable passing tests 2023-09-23 12:36:56 -07:00
Robin Voetter
749307dbb2 spirv: air union_init 2023-09-23 12:36:56 -07:00
Robin Voetter
98046b4c3c spirv: air set_union_tag + improve load()/store() 2023-09-23 12:36:56 -07:00
Robin Voetter
6f55a68964 spirv: air struct_field_ptr for unions 2023-09-23 12:36:56 -07:00
Robin Voetter
5dffbf32bf spirv: air struct_field_val for unions 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
ada0010471 compiler: move unions into InternPool
There are a couple concepts here worth understanding:

Key.UnionType - This type is available *before* resolving the union's
fields. The enum tag type, number of fields, and field names, field
types, and field alignments are not available with this.

InternPool.UnionType - This one can be obtained from the above type with
`InternPool.loadUnionType` which asserts that the union's enum tag type
has been resolved. This one has all the information available.

Additionally:

* ZIR: Turn an unused bit into `any_aligned_fields` flag to help
  semantic analysis know whether a union has explicit alignment on any
  fields (usually not).
* Sema: delete `resolveTypeRequiresComptime` which had the same type
  signature and near-duplicate logic to `typeRequiresComptime`.
  - Make opaque types not report comptime-only (this was inconsistent
    between the two implementations of this function).
* Implement accepted proposal #12556 which is a breaking change.
2023-08-22 13:54:14 -07:00
Andrew Kelley
2936602566 add behavior test for union with 128 bit integer
closes #9871
2023-07-26 19:02:02 -07:00
mlugg
5b594139d9 Sema: copy pointer alignment to union field pointers
This implements the semantics as discussed in today's compiler meeting,
where the alignment of pointers to fields of default-layout unions
cannot exceed the field's alignment.

Resolves: #15878
2023-06-30 23:23:01 -04: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
Luuk de Gram
1042deb86f
enable passing behavior tests 2023-05-31 18:04:33 +02:00
Ali Chraghi
fedc9a19e7 spirv: lower get_union_tag 2023-05-20 18:43:26 +03:30
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
f8de4db873 spirv: implement arithmeticTypeInfo for Enum (@intToEnum) 2023-05-15 14:22:40 +03:30
Jacob Young
1336619979 x86_64: fix field_ptr nonsense 2023-05-15 03:07:51 -04:00
Jacob Young
81664f17d5 codegen: implement global enum_numbered 2023-05-15 03:07:51 -04:00
Jacob Young
e36e9323f4 x86_64: implement union_init 2023-05-15 03:07:51 -04: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
f894ec264b codegen: fix global nested field_ptr 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
47a34d038d x86_64: implement tagName 2023-05-01 19:22:52 -04:00
Jacob Young
6de457211f behavior: update affected tests for the x86_64 backend 2023-05-01 19:22:52 -04:00
Koakuma
d339e86fb1 stage2: sparc64: Skip unimplemented tests 2023-04-28 16:45:37 -07:00
Jacob Young
894406b9d3 behavior: update passing cbe tests 2023-04-26 19:05:17 -04:00
Jacob Young
f4b411314c Sema: defer stores to inferred allocs
This lets us generate the store with knowledge of the type to be stored.
Therefore, we can avoid generating garbage Air with stores through
pointers to comptime-only types which backends cannot lower.

Closes #13410
Closes #15122
2023-04-02 18:05:44 +03:00
Jacob Young
0543def52f llvm: fix crashes when loading a struct field
The result of buildStructGEP is not always a GEP (sorry), so we can't
use getGEPResultElementType on it.

Closes #14641
2023-03-30 11:54:24 +03:00
Jacob Young
8f385e77ca x86_64: implement struct_field_val for packed containers 2023-03-25 16:23:55 -04:00
Jacob Young
dbe1b4a7e5 x86_64: fix value tracking bugs 2023-03-24 17:57:58 -04:00
Veikka Tuominen
f7204c7f37
Merge pull request #15028 from Vexu/compile-errors
Sema: improve error message of field access of wrapped type
2023-03-21 14:55:36 +02: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
Veikka Tuominen
e70a0b2a6b Value: implement reinterpreting enum field index as integer
Closes #15019
2023-03-21 03:31:03 +02:00
Veikka Tuominen
773b1c4c5c llvm: fix lowering packed union initiated to zero-bit value
Closes #14980
2023-03-21 00:34:12 +02:00
Jacob Young
05b12e6779 x86_64: handle duplicate prong deaths 2023-03-15 01:04:21 -04:00
Jacob Young
c51930b060 behavior: enable passing behavior tests on stage2_x86_64 2023-03-15 01:04:21 -04: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
joachimschmidt557
d6e6162081
stage2 AArch64: unify callee-preserved regs on all targets
also enables many passing behavior tests
2022-12-27 21:17:52 +08:00
r00ster91
aac2d6b56f std.builtin: rename Type.UnionField and Type.StructField's field_type to type 2022-12-17 14:11:33 +01:00
Veikka Tuominen
e6588857df Sema: fix memory management of union enum tag int tag
This likely went unnoticed due to all power of two integer types being special cased.

Closes #13812
2022-12-14 14:08:21 +02:00
Koakuma
f9e9ba784f stage2: sparc64: Skip unimplemented tests 2022-12-10 21:51:46 +07:00
Andrew Kelley
c8aba15c22 remove references to stage1 in behavior tests
Good riddance.
2022-12-06 19:06:48 -07:00