3959 Commits

Author SHA1 Message Date
Andrew Kelley
63cbec1a96 stage2: add more functions to freestanding libc
The log functions are not passing behavior tests.
2022-02-17 13:11:58 -07:00
Veikka Tuominen
92f2767814 parser: add error for missing colon before continue expr
If a '(' is found where the continue expression was expected and it is
on the same line as the previous token issue an error about missing
colon before the continue expression.
2022-02-17 20:51:26 +02:00
Jakub Konka
d1c74ac42d
Merge pull request #10914 from ziglang/x64-more-codegen
stage2,x64: refactor stack mgmt mechanics, implement slice, fix ptr_add and ptr_sub
2022-02-17 18:05:30 +01:00
Veikka Tuominen
c9dde10f86 stage1: improve error message when casting tuples 2022-02-17 17:39:54 +02:00
Jakub Konka
3193cc1c1e x64: fix ptr_add and ptr_sub
Add standalone implementation of operand reuse for ptr related
arithmetic operations of add and sub.
2022-02-17 15:07:42 +01:00
Jonathan Marler
baead472d7 reduce build error noise
Address https://github.com/ziglang/zig/issues/3477
This provides a mechanism for builds to fully report an error to the user and prevent zig from piling on extra noise.
2022-02-17 14:48:22 +02:00
John Schmidt
e2ad95c088 stage2: implement vector floatops 2022-02-17 14:47:21 +02:00
Veikka Tuominen
9c36cf92f0 parser: make some errors point to end of previous token
For some errors if the found token is not on the same line as
the previous token, point to the end of the previous token.
This usually results in more helpful errors.
2022-02-17 14:23:35 +02:00
Cody Tapscott
1639fd4c45 Fix 2D array support for C backend
This updates the C backend to use proper array types.

In order to do that, this commit also:
 - fixes up elem_ptr and field_ptr handling
 - adds `renderTypecast` (renders in C typecast format, e.g. "int* [10]")
 - adds a bit special handling for undefined pointers, which is necessary
   to support slice/elem_ptr to undefined decls
2022-02-16 12:57:11 -07:00
Jakub Konka
78e6f9c44c x64: fix ptr_add
However, still missing is taking into account pointer alignment
when performing arithmetic.
2022-02-16 14:13:06 +01:00
Jakub Konka
c7775a9f62 x64: impl genBinMathOpMir for ptr_stack_off and PIE memory 2022-02-16 14:13:06 +01:00
Jakub Konka
9c82f3ae6f stage2: disable failing aarch64-macos behavior tests 2022-02-15 21:04:36 +01:00
Jan Philipp Hafer
c6cd919a18 stage1: fix comptime saturation subtraction
- also simplifies code
- adding a few more tests

closes #10870
2022-02-15 10:40:53 +02:00
joachimschmidt557
22895f5616
stage2 AArch64: Enable behavior testing 2022-02-14 22:33:01 +01:00
joachimschmidt557
783e216e7d
stage2 AArch64: Fix issue in binOp and add regression test 2022-02-14 22:09:44 +01:00
joachimschmidt557
3a33f31334
stage2 AArch64: implement cond_br for other MCValues 2022-02-14 22:09:44 +01:00
Andrew Kelley
f73044dae5
Merge pull request #10879 from Vexu/err
make some errors point to the end of the previous token
2022-02-13 16:15:00 -05:00
Cody Tapscott
45aed7171c Skip 8/16-bit @bitCast test for wasm 2022-02-13 13:28:08 -07:00
Cody Tapscott
c586e3ba1b Add additional tests for @bitCast 2022-02-13 13:28:08 -07:00
Mateusz Radomski
b5f8fb85e6
Implement f128 @rem 2022-02-13 15:37:38 +02:00
Jacob G-W
3bbe6a28e0 stage2: add decltests 2022-02-13 14:42:20 +02:00
Veikka Tuominen
8a432436ae update compile error tests 2022-02-13 13:48:20 +02:00
Andrew Kelley
0b7347fd18 move more behavior tests to the "passing" section 2022-02-12 21:35:29 -07:00
Andrew Kelley
c349191b75 organize behavior tests
moving towards disabling failing tests on an individual basis
2022-02-12 21:13:07 -07:00
Andrew Kelley
a005ac9d3c stage2: implement @popCount for SIMD vectors 2022-02-12 20:44:30 -07:00
Jakub Konka
d542a588c6 Skip @sqrt f80 test on freebsd 2022-02-12 21:24:18 +01:00
Andrew Kelley
16076964d6 disable NaN f80 behavior tests
Let's get all these other bug fixes in and figure out f80 NaN later.
Looks like it's not working at comptime in master branch anyway.
2022-02-12 11:18:23 +01:00
Andrew Kelley
774f9bdb79 LLVM backend: disable failing aarch64 behavior test 2022-02-12 11:18:23 +01:00
Andrew Kelley
a024aff932 make f80 less hacky; lower as u80 on non-x86
Get rid of `std.math.F80Repr`. Instead of trying to match the memory
layout of f80, we treat it as a value, same as the other floating point
types. The functions `make_f80` and `break_f80` are introduced to
compose an f80 value out of its parts, and the inverse operation.

stage2 LLVM backend: fix pointer to zero length array tripping LLVM
assertion. It now checks for when the element type is a zero-bit type
and lowers such thing the same way that pointers to other zero-bit types
are lowered.

Both stage1 and stage2 LLVM backends are adjusted so that f80 is lowered
as x86_fp80 on x86_64 and i386 architectures, and identical to a u80 on
others. LLVM constants are lowered in a less hacky way now that #10860
is fixed, by using the expression `(exp << 64) | fraction` using llvm
constants.

Sema is improved to handle c_longdouble by recursively handling it
correctly for whatever the float bit width is. In both stage1 and
stage2.
2022-02-12 11:18:23 +01:00
joachimschmidt557
2262640e8b stage2 ARM: lower const slices
Follow-up to e1a535360fb9ed08fc48018571b9702ab12a5876 for ARM

This also fixes some stack offset calculation bugs
2022-02-12 00:01:05 +01:00
Cody Tapscott
70d7f87be0 Fix up sign handling and add arbitrary-length integer support to @bitCast() 2022-02-11 08:49:19 -07:00
Jakub Konka
cad3e3e63a x64: enable more behavior tests 2022-02-11 12:49:06 +01:00
Luuk de Gram
9c6d416bec
Activate passing behavior tests
This moves the single bugs behavior tests to the outer branch and disables the test cases
for all non-passing backends.
For the larger files, we move it up a single branch and disable it for the c backend.
All test cases that do pass for the c backend however, are enabled.
2022-02-10 21:40:06 +01:00
Jakub Konka
e139c41fd8 stage2: handle truncate to signed non-pow-two integers 2022-02-10 15:05:12 +01:00
Andrew Kelley
c10fdde5a6 stage2: LLVM backend: make unnamed struct globals
LLVM union globals have to be lowered as unnamed structs if the
non-most-aligned field is the active tag. In this case it bubbles up so
that structs containing unions have the same restriction.

This fix needs to be applied to optionals and other callsites of
createNamedStruct.

The bug fixed in this commit was revealed in searching for
the cause of #10837.
2022-02-10 00:27:02 -07:00
Sebsatian Keller
f5471299d8
stage 1: improve error message if error union is cast to payload (#10770)
Also: Added special error message for for `?T` to `T` casting
2022-02-09 20:35:53 -05:00
Andrew Kelley
1e5a494603 Sema: implement comptime ptr store to optional payload
and error union payload
2022-02-09 18:29:51 -07:00
John Schmidt
7f0cf395aa stage2: implement all builtin floatops for f{16,32,64}
- Merge `floatop.zig` and `floatop_stage1.zig` since most tests now pass
  on stage2.
- Add more behavior tests for a bunch of functions.
2022-02-09 20:29:41 -05:00
Andrew Kelley
db56d74a3b
Merge pull request #10834 from ziglang/fix-x86-i128-c-abi
stage1: fix x86 i128 C ABI for extern structs
2022-02-09 13:23:20 -05:00
Jakub Konka
e5ce87f1b1 stage2: handle decl ref to void types
Fixes behavior test 1914
2022-02-09 10:28:48 +01:00
Jakub Konka
4d1e5ef730
Merge pull request #10846 from ziglang/x64-macho-bringup
stage2: handle direct and got load for stack args on x86_64-macos
2022-02-09 08:17:29 +01:00
Andrew Kelley
f4fa32a632 Sema: fix @typeInfo for pointers returning 0 alignment 2022-02-08 23:02:13 -07:00
Andrew Kelley
1678825c14 Sema: fix @ptrCast from slices
Also, fix allocations in comptime contexts with alignments.
2022-02-08 22:51:46 -07:00
Andrew Kelley
59418d1bf6 Sema: fix Value.intFitsInType for comptime int 2022-02-08 22:09:41 -07:00
Andrew Kelley
77a6031edb C ABI: these tests are not passing yet on Windows
I was too greedy
2022-02-08 21:15:00 -07:00
Andrew Kelley
08808701d2 C ABI tests: give a clue in addition to "test failure" 2022-02-08 21:12:50 -07:00
Andrew Kelley
a35eb9fe8a c_abi tests: allow passing standard target options 2022-02-08 21:12:32 -07:00
Andrew Kelley
61ed4fe07a stage1: fix x86 i128 C ABI for extern structs
closes #10445
2022-02-08 20:10:55 -07:00
Andrew Kelley
7c1061784b stage2: fix inferred comptime constant locals
`const` declarations inside comptime blocks were not getting properly
evaluated at compile-time. To accomplish this there is a new ZIR
instruction, `alloc_inferred_comptime`. Actually we already had one
named that, but it got renamed to `alloc_inferred_comptime_mut` to match
the naming convention with the other similar instructions.
2022-02-08 20:03:17 -07:00
Jakub Konka
c689df1215 stage2: disable some tests on x86_64-macos 2022-02-08 23:59:10 +01:00