28871 Commits

Author SHA1 Message Date
Robin Voetter
12350f53bf
spirv: clz, ctz for opencl
This instruction seems common in compiler_rt.
2024-03-30 19:47:55 +01:00
Robin Voetter
f5ab3c93c9
spirv: handle annotations in deduplication pass 2024-03-30 19:47:55 +01:00
Robin Voetter
b4960394ef
spirv: avoid copying operands in dedup pass 2024-03-30 19:47:52 +01:00
Robin Voetter
393a805741
spirv: deduplicate prototype 2024-03-30 10:16:18 +01:00
Marc Tiehuis
aff71c6132 implement ryu 64-bit backend
The 64-bit backend supports printing all floats up to 64-bits. The
128-bit continues to be used for larger values.

This backend is approximately ~3x faster. Code size is a little smaller
in the full table case and much smaller if using the samll tables.

The implementation uses the same code-paths, parameterized by a set of
tables and their pow5 implementations. We continue to use the same
rounding/formatting mechanisms. Initially I explored a separate
implementation, as upstream does this and has specific optimizations for
these paths but for simplicity we don't. The performance loss is small
enough at this point and keeping them combined keeps them in sync.

Closes #19264.
2024-03-29 22:15:17 -07:00
Jakub Konka
fb9673f208 lib/std/coff: add ImportNameType.NAME_EXPORTAS variant 2024-03-29 20:34:28 +01:00
Sean
a2df84d0ff
std.math: rework modf
- Changed `modf_result` to `Modf` to better fit naming conventions
- Reworked `modf` to be far simpler and support all floating point types (as well as vectors) (I have done benchmarks and can confirm that the performance is roughly equivalent to the old implementation)
- Added more descriptive tests for modf
- Deprecated `modf32_result` and `modf64_result` in favor of `Modf(f32)` and `Modf(f64)` respectively
2024-03-29 09:33:57 +00:00
Veikka Tuominen
2d443cdabf Sema: allow .ptr on pointer to array 2024-03-29 07:10:57 +02:00
Jakub Konka
fda9a32fef macho: fix double free 2024-03-28 20:17:36 -07:00
Andrew Kelley
3661133f98
Merge pull request #19399 from ypsvlq/mingw
mingw: support -municode
2024-03-28 14:16:30 -07:00
Andrew Kelley
c808e546a7
Merge pull request #19461 from Vexu/tests
add tests for stage1 bugs; remove cbe.zig
2024-03-28 11:53:37 -07:00
Veikka Tuominen
9106fdffaf Sema: check error union payload types in @errorCast 2024-03-28 15:39:47 +02:00
Veikka Tuominen
60614b2a85 add tests for fixed stage1 bugs
Closes #10357
Closes #11236
Closes #11615
Closes #12055
2024-03-28 15:24:01 +02:00
Veikka Tuominen
0588595128 std.PackedInt: remove workaround for stage1 bug
Closes #7635
2024-03-28 15:24:01 +02:00
Veikka Tuominen
2cdc48a632 remove test/cbe.zig
The C backend is far enough along for these tests to be redundant with all the other tests.
2024-03-28 15:24:01 +02:00
HydroH
7aa42f47b7
allow @errorcast to cast error sets to error unions 2024-03-28 10:23:32 +00:00
Andrew Kelley
17053887d0
Merge pull request #19458 from ianprime0509/all-module-docs
Autodoc: include all modules in output
2024-03-28 02:17:50 -07:00
Ian Johnson
3fb6bb1449 std-docs: include builtin module in sources.tar
Now that `-femit-docs` includes all modules, including the builtin
module, in the generated source tarball, it makes sense to apply the
same logic to the std-docs server. std-docs constructs its own tarball,
so a different approach is needed to achieve the same end result.
2024-03-28 00:30:42 -04:00
Ian Johnson
424dd17b6c Autodoc: add all modules to sources.tar
Closes #19403

This commit adds all modules in the compilation to the generated
`sources.tar` when using `-femit-docs` (including `std` and `builtin`).
Additionally, it considers the main module when doing so, rather than
the root module, so the behavior when running `zig test -femit-docs
test.zig` is now correct.
2024-03-28 00:30:29 -04:00
Jakub Konka
9dac8db2df
Merge pull request #19430 from ziglang/dwarf-ub
link: fix undefined memory being written out in dwarf and codegen
2024-03-27 17:29:30 +01:00
Ryan Liptak
bad9efbcc1 Add standalone test for all possible MinGW exe entry points 2024-03-27 10:06:06 +00:00
Ryan Liptak
4e428415e5 Build.Step.Compile: Add mingw_unicode_entry_point field
Corresponds to the `-municode` CLI flag
2024-03-27 10:06:06 +00:00
Elaine Gibson
add74427b9 mingw: support -municode 2024-03-27 10:05:57 +00:00
Jacob Young
71d878ba50 std.zig: remove extraneous newlines in log messages 2024-03-27 01:55:42 -04:00
Jacob Young
77ff6bc656 haiku: fix poll definitions 2024-03-27 01:55:42 -04:00
HydroH
7684423c08 translate-c: handle string concatenation of function calls 2024-03-26 21:16:53 -07:00
Andrew Kelley
5140f2726a
Merge pull request #19437 from mlugg/value-cleanups
Follow-up to #19414
2024-03-26 21:11:18 -07:00
mlugg
5132549565
Zcu: remove some unused functions 2024-03-26 21:35:21 +00:00
mlugg
845226a7c9
cases: necessary changes from branch 2024-03-26 17:06:14 +00:00
mlugg
bfc0c35689
Value: fix underflow reading large u64 values from packed memory 2024-03-26 17:06:14 +00:00
mlugg
951fc09a7e
print_value: improve value printing
Notably, this improves string printing from
`@as(*[5:0]u8, &@as([5:0]u8, "hello".*))` to `@as(*[5:0]u8, "hello")`,
omitting the pointless ref-deref pair.
2024-03-26 17:06:14 +00:00
mlugg
2a245e3b78
compiler: eliminate TypedValue
The only logic which remained in this file was the Value printing logic.
This has been moved into a new `print_value.zig`.
2024-03-26 13:48:07 +00:00
mlugg
a61def10c6
compiler: eliminate most usages of TypedValue 2024-03-26 13:48:07 +00:00
mlugg
b8d114a29e
Zcu: use Value instead of TypedValue when initializing legacy anon decls
Also removes some unnecessary uses of legacy anon decls for constructing
the array of test functions for the test runner.
2024-03-26 13:48:07 +00:00
mlugg
0d8c7ae007
Zcu.Decl: replace typedValue with valueOrFail
Now that the legacy `Value` representation is eliminated, we can begin
to phase out the redundant `TypedValue` type.
2024-03-26 13:48:07 +00:00
mlugg
920f2c7794
compiler: minor cleanups 2024-03-26 13:48:07 +00:00
mlugg
26a94e8481
Zcu: eliminate Decl.alive field
Legacy anon decls now have three uses:
* Type owner decls
* Function owner decls
* `@export` and `@extern`

Therefore, there are no longer any cases where we wish to explicitly
omit legacy anon decls from the binary. This means we can remove the
concept of an "alive" vs "dead" `Decl`, which also allows us to remove
the separate `anon_work_queue` in `Compilation`.
2024-03-26 13:48:06 +00:00
mlugg
152a2ceaf7
compiler: audit uses of ptr.addr in the frontend
This commit also performs some refactors to `TypedValue.print` in
preparation for improved comptime pointer access logic. Once that logic
exists, `TypedValue.print` can use Sema to access pointers for more
helpful printing.

This commit also implements proposal #19435, because the existing logic
there relied on some blatantly incorrect code in `Value.sliceLen`.

Resolves: #19435
2024-03-26 13:48:06 +00:00
mlugg
884d957b6c
compiler: eliminate legacy Value representation
Good riddance!

Most of these changes are trivial. There's a fix for a minor bug this
exposed in `Value.readFromPackedMemory`, but aside from that, it's all
just things like changing `intern` calls to `toIntern`.
2024-03-26 13:48:06 +00:00
mlugg
5ec6e3036b
Sema: introduce separate MutableValue representation for comptime-mutable memory
Perhaps someday, we will make Sema operate on mutable values more
generally. For now, it makes sense to split out this representation,
since it is only used in comptime pointer accesses.

There are some currently unused methods on `MutableValue` which will
be used once I rewrite the comptime pointer access logic to be less
terrible.

The commit following this one will - at long last - delete the legacy
Value representation
2024-03-26 13:48:06 +00:00
mlugg
c6f3e9d79c
Zcu.Decl: remove ty field
`Decl` can no longer store un-interned values, so this field is now
unnecessary. The type can instead be fetched with the new `typeOf`
helper method, which just gets the type of the Decl's `Value`.
2024-03-26 13:48:06 +00:00
David Rubin
341857e5cd make addCSourceFiles assert options.files are relative 2024-03-26 14:03:39 +02:00
Prokop Randáček
055023efb4
valgrind client request wrappers take const pointers (#19237)
* valgrind client request wrappers take const pointers

* require zero terminated strings in valgrind wrappers
2024-03-26 14:00:13 +02:00
Veikka Tuominen
59203cb4f2
Merge pull request #19385 from markus-oberhumer-forks/improve-old-glibc-versions
Improve old glibc versions
2024-03-26 13:56:07 +02:00
Luis Cáceres
29e41c6850 std.Build: dupe provided paths for Step.Fmt.create() 2024-03-26 13:54:24 +02:00
Andrew Kelley
405502286d
Merge pull request #19414 from mlugg/comptime-mutable-memory-yet-again
compiler: implement analysis-local comptime-mutable memory
2024-03-25 16:32:18 -07:00
Jakub Konka
ae1b2bfcad dwarf+codegen: use appendNTimes instead of writer().writeByteNTimes 2024-03-25 23:48:39 +01:00
Andrew Kelley
abadad4640
Merge pull request #19402 from ianprime0509/markdown-autolinks
Autodoc: hyperlink URLs in text
2024-03-25 15:36:37 -07:00
Andrew Kelley
32b4d85605
Merge pull request #19406 from jacobly0/haiku
haiku: get a cross-compiled compiler working
2024-03-25 15:33:51 -07:00
Jakub Konka
69e9fe4ede dwarf: actually write zeroed out unresolved relocs into emitted DWARF in initDeclState 2024-03-25 23:22:20 +01:00