Commit Graph

5123 Commits

Author SHA1 Message Date
Veikka Tuominen
71937f75d8 Sema: correctly detect union target in zirSwitchBlock
Closes #13655
2022-11-26 18:05:27 +02:00
Veikka Tuominen
fe38898246 Sema: pass c_import_buf to child block in more places
Closes  #13651
2022-11-26 18:05:27 +02:00
Veikka Tuominen
587ef60a28 Sema: resolve union fields before using getTagType
Closes #13649
2022-11-26 18:05:27 +02:00
Veikka Tuominen
bf62cb453b Sema: handle anytype parameter requiring comptime
Closes #13645
2022-11-26 18:05:27 +02:00
Veikka Tuominen
72fa8d4880 Sema: fix overflow arithmetic with runtime vectors
It should return a a vector of bools for compatibility with scalar
operands and stage1 until #10248 can be implemented.

Closes #13201
2022-11-26 18:05:27 +02:00
Andrew Kelley
4ec27a4e25 C backend: implement vector reduce and overflow intrinsics 2022-11-22 23:33:58 -07:00
Veikka Tuominen
fc5209c139 llvm: fix x86_64 sysV ABI of big vectors on avx512 enabled CPUs
Closes #13629
2022-11-23 00:05:07 +02:00
Andrew Kelley
5e42378227 disable failing C ABI test
see tracking issue #13629
2022-11-22 13:06:09 -07:00
Cody Tapscott
3fa226a80c AstGen: Pop error trace for continue
PR #12837 handled control flow for break and return, but I forgot
about `continue`. This is effectively another break, so we just
need another `.restore_err_ret_index` ZIR instruction.

Resolves #13618.
2022-11-22 14:00:41 +02:00
Andrew Kelley
7829c73ccf disable failing arm-linux non-llvm backend tests
See #13623
2022-11-21 22:56:05 -07:00
Veikka Tuominen
d968d9d103 llvm: add attributes to the arguments of function pointer calls
Closes #13605
2022-11-20 20:25:12 +02:00
Veikka Tuominen
9e276d32f3 Sema: fix memory management of missing field error
Closes #13590
2022-11-20 20:25:12 +02:00
Veikka Tuominen
9e7293619f llvm: aarch64 C ABI: pass byref params as mutable pointers
Closes  #13597
2022-11-20 20:25:12 +02:00
Veikka Tuominen
08a00f0d1c llvm: use alignment of ABI return type when it differs from raw return type
This would previously cause miscompilations when the ABI type had
bigger alignment than the raw type.
2022-11-20 20:25:12 +02:00
Veikka Tuominen
835a1f7f0c Sema: fix missing error on mismatched array init count
Closes #13582
2022-11-20 20:25:12 +02:00
Veikka Tuominen
034507ef7c Module: fix compile error for non-comptime-known global initializer 2022-11-20 20:25:12 +02:00
Veikka Tuominen
98b3734b67 Sema: prioritize Value.variable over OPV when resolving const value
Closes #12275
2022-11-20 20:25:12 +02:00
Veikka Tuominen
bc76873827 Sema: fix type check in zirIntToPtr
Simple fix: don't assume a ptr type before it has been checked.

Closes #13567
2022-11-20 20:25:11 +02:00
Veikka Tuominen
510b891d27 Sema: handle opt_payload in beginComptimePtrLoad 2022-11-20 20:25:11 +02:00
Veikka Tuominen
0616d2966a Sema: allow coercing typed undefined to int
Closes #13556
2022-11-20 20:25:11 +02:00
Veikka Tuominen
44f8714dfb translate-c: cast unsuffixed floats to f64 2022-11-20 16:10:54 +02:00
Guillaume Wenzek
476b946802
compute LLVMTypes in ParamTypeIterator (#13592)
follow up on #13376 - fixes a bug in the x86_64 C ABI. 

Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-11-20 01:14:02 -08:00
Andrew Kelley
0697883d01 extract C backend behavior tests with vectors
No functional change. Separates various float operations behavior tests
from the ones that test vectors.
2022-11-19 01:29:51 -05:00
kkHAIKE
ea590ece4b
Sema: optimize compare comptime float with int 2022-11-18 22:06:49 +02:00
Stevie Hryciw
04f3067a79 run zig fmt on everything checked by CI 2022-11-18 19:22:42 +00:00
Veikka Tuominen
8082323dfd
Merge pull request #13411 from dweiller/custom-test-runner
Custom test runner
2022-11-18 14:47:21 +02:00
Guillaume Wenzek
5221c90164
add C ABI tests with double
const DC = extern struct { v1: f64, v2: u8 };
const CFF = extern struct { v1: u8, v2: f32, v3: f32 };
const PD = extern struct { v1: ?*anyopaque, v2: f64 };

Signed-off-by: Guillaume Wenzek <gwenzek@users.noreply.github.com>
2022-11-18 14:05:25 +02:00
Veikka Tuominen
28cbe5e92a Sema+llvm: improve handling of namespace-like unions
Closes #13557
2022-11-16 01:13:35 +02:00
Veikka Tuominen
fe6249348f Sema: ensure comptime reference to function points to original decl
This prevents sema from creating new decls for the functions and
passing them to the backends as non-function decls.

Closes #12501
2022-11-16 01:12:54 +02:00
Veikka Tuominen
2cfa7165e7 Sema: do not re-evaluate type of non-generic inline call parameters
Closes #13491
2022-11-16 01:12:27 +02:00
mparadinha
c4f7663c92
Fix error reporting the wrong line for struct field inits (#13502)
* point to init part of field delc when that's where the error occurs

* update test to reflect fixed error message

* only lookup source location in case of error
2022-11-15 15:17:23 +02:00
Andrew Kelley
a50ad04e85 disable failing test on aarch64-macos 2022-11-14 16:07:52 -07:00
Veikka Tuominen
87cf2783eb llvm: check that tuple fields have runtime bits
Just checking that they aren't comptime isn't enough for `@Type` constructed tuples.

Closes #13531
2022-11-12 15:41:29 +02:00
Veikka Tuominen
a760ce598c Sema: ensure that !is_comptime and !is_typeof implies sema.func != null
Closes #13481
2022-11-12 15:41:29 +02:00
Veikka Tuominen
d42f4abb9d llvm: correctly lower references to generic functions
Closes #13522
2022-11-12 15:41:29 +02:00
Veikka Tuominen
40a2dfc12a Sema: coerce array operands to shuffle
Closes #13494
2022-11-11 18:00:05 +02:00
Veikka Tuominen
9b832e7f53 Sema: make check for namespace lookup of private declarations more strict
Previously sema only checked that the private declaration was in the same
file as the lookup but now it also checks that the namespace where
the decl was included from was also in the same file.

Closes #13077
2022-11-11 17:59:53 +02:00
Veikka Tuominen
0a188190b3 AstGen: make pointless discard error more strict
The error should only happen as a result of `_ = <expr>` not
for an operand of a break expression that is discarded.

Closes #13212
2022-11-11 17:59:53 +02: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
Veikka Tuominen
c4465556fd Type: check return_type for generic poison before comparing
Closes #13423
2022-11-11 17:59:53 +02:00
Veikka Tuominen
89e8bb409a AstGen: use condbr_inline if force_comptime is set
The `finishThenElseBlock` would correctly use `break_inline`
which would cause Sema to use `addRuntimeBreak` instead of
doing the branch at comptime.
2022-11-11 17:59:53 +02:00
Cody Tapscott
2897641fb9 stage2: Support modifiers in inline asm
These are supported using %[ident:mod] syntax. This allows requesting,
e.g., the "w" (32-bit) vs. "x" (64-bit) views of AArch64 registers.

See https://llvm.org/docs/LangRef.html#asm-template-argument-modifiers
2022-11-11 16:01:31 +02:00
Cody Tapscott
b1357091ae Add test case for #12043
This bug is already resolved, just want to make sure we don't lose
the test case. Closes #12043
2022-11-10 12:23:59 -07:00
Cody Tapscott
fbda15632d stage2 sema: Make vector constants when operating on vectors
Resolves https://github.com/ziglang/zig/issues/13058
2022-11-10 12:22:40 -07:00
Cody Tapscott
8f3880074f stage2: Be more strict about eliding loads
This change makes any of the `*_val` instructions check whether it's
safe to elide copies for by-ref types rather than performing this
elision blindly.

AIR instructions fixed:
 - .array_elem_val
 - .struct_field_val
 - .unwrap_errunion_payload
 - .try
 - .optional_payload

These now all respect value semantics, as expected.

P.S. Thanks to Andrew for the new way to approach this. Many of the
lines here are from his recommended change, which comes with the
significant advantage that loads are now as small as the intervening
memory access allows.

Co-authored by: Andrew Kelley <andrew@ziglang.org>
2022-11-10 12:22:40 -07:00
Cody Tapscott
ff699722da stage2: Fix comptime array initialization
This is a follow-up to 9dc98fba, which made comptime initialization
patterns for union/struct more robust, especially when storing to
comptime-known pointers (and globals).

Resolves #13063.
2022-11-10 12:22:37 -07:00
Jakub Konka
04b8ce5fd3 Merge branch 'jcmoyer-lld-explicit-pdb' 2022-11-10 16:52:43 +01:00
Jakub Konka
4b3637820d
Merge pull request #13495 from ziglang/macho-dsym
stage2: misc DWARF debug info fixes and additions for x86_64 and aarch64
2022-11-10 16:50:57 +01:00
Jakub Konka
1357790ec9 win: combine PDB fixes into one changeset 2022-11-10 14:03:11 +01:00
Jakub Konka
0914e0a4ec dwarf: do not assume unsigned 64bit integer for the enum value 2022-11-10 09:36:45 +01:00