Commit Graph

2518 Commits

Author SHA1 Message Date
kcbanner f07d33f54b cbe: fixes for compiling zig2.c under msvc
- add zig_mul_i128
- render slice structs in static initializers without casts / c99 style init
- add negative numbers and u128 to 128-bit multiply test
2023-01-01 16:44:29 -05:00
kcbanner 5d59799641 cbe: add msvc flt atomics, re-enable test 2023-01-01 16:44:29 -05:00
kcbanner 6ed049fe36 cbe: all behaviour tests now pass on msvc
- Fix zig_clz_u128 not respecting the bits argument. This was crashing the compile-rt addxf3 tests with the cbe
- Instead of redering a negation for negative 128 bit int literals, render the literal as twos complement. This allows
rendering int representations of floats correctly (specifically f80).
2023-01-01 16:44:29 -05:00
kcbanner 6445196fab tests: disable function alignment test for cbe, add 128-bit atomicrmw tests 2023-01-01 16:44:29 -05:00
kcbanner 5470708a89 cbe: implement 128 bit atomic operations with cmpxchg loops
- Enable 128 bit atomic int tests for the cbe only
2023-01-01 16:44:29 -05:00
kcbanner 5b8245d35a tests: update "atomicrmw with ints" to test u8 through u64 2023-01-01 16:44:29 -05:00
kcbanner 2d34477dbb cbe: msvc atomics
- Implement most atomic operations for msvc
- Disable "atomicrmw with floats" test for cbe
2023-01-01 16:44:28 -05:00
kcbanner 4fe71977e0 temporarily disable asm tests 2023-01-01 16:44:28 -05: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
Andrew Kelley 9b665a59f2 Merge pull request #14101 from Vexu/stage1
add tests for fixed stage1 bugs
2022-12-29 15:33:45 -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 1caf56c5fb stage2 AArch64: implement errUnion{Err,Payload} for registers 2022-12-29 11:12:08 +01:00
Andrew Kelley a1d82352d2 disable failing C var arg behavior tests
See tracking issue #14096
2022-12-27 23:13:03 -07:00
Andrew Kelley 5ca1753ff1 Revert "aarch64: reenable tests that are no longer regressed"
This reverts commit 3370d58956.

This commit was done with an LLVM build that did not have assertions
enabled. There are LLVM assertions being triggered due to this commit.

Reopens #10627
Reopens #12013
Reopens #12027
2022-12-27 20:54:27 -07:00
Andrew Kelley 357235d9de add behavior test for ptrcasted function pointers
See #2626. The runtime case is solved but comptime is not.
2022-12-27 15:19:00 -07:00
Andrew Kelley 6e9fbc83ca add behavior test for comptime pointer casting
comptime `@ptrCast` a subset of an array, then write through it

closes #2444
2022-12-27 14:44:04 -07:00
Andrew Kelley f4b067743f add behavior test for optional error union return type
closes #1814
2022-12-27 13:46:57 -07:00
Andrew Kelley 19056cb682 Merge pull request #14024 from Vexu/overflow-arithmetic
Make overflow arithmetic builtins return tuples
2022-12-27 13:57:49 -05:00
Jakub Konka aea3460cf5 Merge pull request #14084 from joachimschmidt557/stage2-aarch64
stage2 AArch64: small improvements
2022-12-27 18:59:59 +01:00
Veikka Tuominen a777373bb8 enable test on more targets
This was fixed by 8a0a6b7387 for targets
without avx512
2022-12-27 15:34:19 +02:00
Veikka Tuominen 9c0f3163a8 value: fix bitcasting packed structs with u0 fields
Closes #13942
2022-12-27 15:33:27 +02:00
joachimschmidt557 485082064a stage2 AArch64: implement field_parent_ptr 2022-12-27 21:26:18 +08: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
Veikka Tuominen 622311fb9a update uses of overflow arithmetic builtins 2022-12-27 15:13:14 +02:00
Jacob Young 81318e8704 llvm: add asserts and behavior tests for #14063
Closes #14063
2022-12-27 00:12:56 -05:00
Andrew Kelley 1b86a628ac Merge pull request #14015 from Vexu/recursive-inline
Sema: add error for recursive inline call
2022-12-26 20:34:22 -05:00
Veikka Tuominen 81443fcde8 Sema: add error for recursive inline call
Closes #12973
2022-12-26 16:36:30 +02:00
Veikka Tuominen 3535c4b3b6 Sema: fix elem ptr type of vector in slice
Closes #14071
2022-12-26 15:26:27 +02: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
Andrew Kelley a193ec432d Merge pull request #14058 from jacobly0/concat 2022-12-24 13:55:42 -05:00
Jacob Young 6f288051c1 behavior: disable tests on failing backends 2022-12-24 02:54:21 -05:00
Jacob Young 6cd8004213 Sema: relax undefined checks for concat
Closes #14037
2022-12-24 02:40:33 -05:00
Jacob Young 0559cdb554 Sema: support concat of tuple and array
Closes #14041
2022-12-24 02:40:33 -05:00
Jacob Young fc0789f8e7 behavior: disable tests that trigger an llvm 15 bug and assertion
```
LLVM Emit Object... zig: llvm/include/llvm/ADT/APInt.h:840: void llvm::APInt::lshrInPlace(unsigned int): Assertion `ShiftAmt <= BitWidth && "Invalid shift amount"' failed.
Aborted
```

Tracked by #13782
2022-12-24 02:23:05 -05:00
travisstaloch 581d292381 fix overflow found while fuzzing
* allow file level `union {}` to parse as tuple field

this was found while fuzzing zls.

* before this patch the input `union {}` crashed the parser.  after
  this, it parses correctly just like `struct {}`.
* adds behavior tests for both inputs `struct {}` and `union {}`,
  checking that each becomes a file level tuple field.
2022-12-23 23:10:04 +02:00
Andrew Kelley f211c1559a Merge pull request #13960 from r00ster91/stage1cruft
Close more old stage1 issues
2022-12-22 16:36:55 -05:00
r00ster91 5ecc2b99af behavior: more test coverage
Closes #12450
Closes #13113
Closes #12051
Closes #12092
Closes #12119
Closes #12142
Closes #12450
Closes #13113
Closes #11995
Closes #12000
2022-12-21 23:34:22 +01:00
Jacob Young a52dcdd3c5 CBE: fix bitwise not
Closes #13911
2022-12-21 03:04:59 -05:00
Veikka Tuominen e1345fd0a0 Merge pull request #14004 from Vexu/packed-struct-vector
llvm: handle vectors in packed structs
2022-12-20 23:13:36 +02:00
Veikka Tuominen 6da070c5ac Sema: fix crash with generic function with generic function parameter
Closes #12810
2022-12-20 17:32:04 +02:00
Andrew Kelley 0fb53bd245 Merge pull request #14000 from jacobly0/zero-bit-fields
codegen: fix taking the address of a field in a zero-bit struct
2022-12-19 15:47:31 -05:00
Veikka Tuominen 6511afcfe0 Sema: fix coercion from [:0]T to [*c]T 2022-12-19 20:45:53 +02:00
Veikka Tuominen 22d46e1d77 value: use int tag type when querying for tag value
Closes #13757
2022-12-19 15:08:49 +02:00
Jacob Young 0768115b01 behavior: disable failing test
Also add an assert to catch this issue earlier.  For future reference,
the decl without a type and value is the string literal "GET".
2022-12-19 05:59:45 -05:00
Veikka Tuominen 2926d95e6a llvm: handle vectors in packed structs
Closes #13201
2022-12-19 12:19:52 +02: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 6018a3ad39 add behavior test for empty error set inference
closes #1386
closes #7541
2022-12-18 18:37:12 -07:00
Andrew Kelley 09ee887e9f add behavior test for comptime pointer casting
closes #1150
closes #1292
closes #4093
2022-12-18 18:37:12 -07:00