138 Commits

Author SHA1 Message Date
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
3a30b82741 x86_64: implement fieldParentPtr 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
Andrew Kelley
a5c910adb6 change semantics of @memcpy and @memset
Now they use slices or array pointers with any element type instead of
requiring byte pointers.

This is a breaking enhancement to the language.

The safety check for overlapping pointers will be implemented in a
future commit.

closes #14040
2023-04-25 11:23:40 -07:00
Jacob Young
c1a2da6b78 x86_64: implement packed load and store 2023-04-16 17:05:35 -04:00
Jacob Young
5900dc0580 x86_64: fix typos 2023-04-03 18:02:55 +02:00
Jacob Young
83a208c355 x86_64: implement large cmp 2023-04-02 04:49:53 -04:00
Jacob Young
ac68d72d24 x86_64: implement aggregate init of a packed struct 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
8f385e77ca x86_64: implement struct_field_val for packed containers 2023-03-25 16:23:55 -04:00
Jacob Young
0cfc0d0d13 x86_64: implement struct_field_ptr for packed containers 2023-03-25 16:23:55 -04: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
434c6f42ca behavior: enable passing CBE tests 2023-02-21 09:43:23 -05:00
Andrew Kelley
ffdce5f98c add test coverage for fixed bug. closes #5497 2023-02-19 21:18:27 -07:00
Veikka Tuominen
5259d11e3b Sema: resolve fields before checking tuple len
Closes #14400
2023-01-22 00:12:37 +02:00
Veikka Tuominen
342bae02d8 Sema: automatically optimize order of struct fields
This is a simple starting version of the optimization described in #168
where the fields are just sorted by order of descending alignment.
2023-01-16 19:46:41 +02: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
Jakub Konka
aea3460cf5
Merge pull request #14084 from joachimschmidt557/stage2-aarch64
stage2 AArch64: small improvements
2022-12-27 18:59:59 +01: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
Jacob Young
81318e8704 llvm: add asserts and behavior tests for #14063
Closes #14063
2022-12-27 00:12:56 -05:00
Jacob Young
64865679cf Sema: add missing resolveLazyValue cases
Closes #14032
2022-12-26 04:39:32 -05:00
Jacob Young
f5b6019646 Sema: fix missing struct layout for llvm backend
Closes #14063
2022-12-25 20:18:15 -05:00
Jacob Young
0e3feebb04 codegen: fix taking the address of a zero-bit field in a zero-bit struct
Normally when we want a pointer to the end of a struct we just add 1 to
the struct pointer.  However, when it is a zero-bit struct, the pointer
type being used during lowering is often a dummy pointer type that
actually points to a non-zero-bit type, so we actually want to add 0
instead, since a zero-bit struct begins and ends at the same address.
2022-12-18 22:11:26 -05:00
Jacob Young
e96f65db77 llvm: fix lowering pointer to final zero-width field of a comptime value
* Handle a `null` return from `llvmFieldIndex`.
 * Add a behavior test to test this code path.
 * Reword this test name, which incorrectly described how pointers to
   zero-bit fields behave, and instead describe the actual test.
2022-12-18 22:11:26 -05:00
Andrew Kelley
6ed0910d6d Revert "llvm: fix lowering pointer to final zero-width field of a comptime value"
This reverts commit e0bc5f65b98d154b4318027d56f780b55605e33c.

Caused an assertion failure when running the behavior tests:

```
zig: llvm/lib/IR/Type.cpp:729: static llvm::PointerType* llvm::PointerType::get(llvm::Type*, unsigned int): Assertion `isValidElementType(EltTy) && "Invalid type for pointer element!"' failed.
Aborted (core dumped)
```
2022-12-18 13:51:15 -07:00
Jacob Young
e0bc5f65b9 llvm: fix lowering pointer to final zero-width field of a comptime value
* Handle a `null` return from `llvmFieldIndex`.
 * Add a behavior test to test this code path.
 * Reword this test name, which incorrectly described how pointers to
   zero-bit fields behave, and instead describe the actual test.
2022-12-18 02:17:11 -05: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
Jacob Young
ec3116f573 cbe: fix zero-bit struct field pointer 2022-12-03 08:40:08 -05:00
Andrew Kelley
610d604f5b
Merge pull request #13748 from jacobly0/c-unaligned
cbe: use memcpy for underaligned loads and stores
2022-12-03 02:18:07 -05:00
Jacob Young
fdedd62365 cbe: use memcpy for underaligned loads and stores 2022-12-02 22:21:24 -05:00
Veikka Tuominen
7f9e841f74 Sema: do not forcibly canonicalize unresolved pointer element type
Closes #13308
2022-12-03 00:09:23 +02:00
Luuk de Gram
090deae41d
wasm: enable behavior tests for packed structs 2022-11-30 21:01:09 +01:00
Veikka Tuominen
d2cc55109a llvm: correct calculation of index of zero-bit field
If the field comes before any non-zero-bit field then the index of
the next field should be returned.

Closes #13363
2022-11-11 17:59:53 +02:00
Ali Chraghi
f5f1f8c666 all: rename i386 to x86 2022-11-04 00:09:27 +03:30
Jacob Young
ab468d57e3 cbe: implement packed structs
Sometimes you have to break a test to make progress :)
2022-10-25 05:11:29 -04:00
Jacob Young
4765294ca4 cbe: get enough things working to support basic programs
* Enable advanced start support.
 * Enable advanced test_runner support.
 * Zig Language Reference's Hello World now works.
2022-10-25 05:11:29 -04:00
Jacob Young
912b84bbad cbe: fix atomics 2022-10-25 05:11:29 -04:00
Jacob Young
87d432328e cbe: implement aggregate_init of struct 2022-10-25 05:11:29 -04:00
Jacob Young
5eafc10bf4 cbe: fix global access fix 2022-10-25 05:11:29 -04:00
Jacob Young
a12535f501 cbe: fix global access 2022-10-25 05:11:28 -04:00
Jacob Young
6a4266d62a cbe: fix infinite recursion on recursive types 2022-10-25 05:11:28 -04:00
Jacob Young
525dcaecba behavior: enable stage2_c tests that are currently passing
Also fix C warnings triggered by these tests.
2022-10-25 05:11:28 -04:00
r00ster91
51d9db8569 fix(text): hyphenate "comptime" adjectives 2022-10-05 21:19:30 +02:00
Veikka Tuominen
541b3e3a31 Sema: check pointer qualifiers before implicit cast
Closes #12881
2022-09-20 00:50:13 +03:00
Koakuma
0910cb6fcb stage2: sparc64: Skip compile-failing tests for now 2022-09-14 16:58:12 -07:00
joachimschmidt557
3794f2c493
stage2 ARM: implement struct_field_val for registers 2022-09-09 19:17:18 +02:00