Commit Graph

28 Commits

Author SHA1 Message Date
Pavel Verigo
17f14e1d65 stage2-wasm: bit_reverse 2024-06-16 11:53:33 +02:00
Andrew Kelley
53f74d6a04 move libssp into libcompiler_rt
closes #7265
2023-11-10 13:12:10 -07:00
Eric Joldasov
50339f595a all: zig fmt and rename "@XToY" to "@YFromX"
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19 12:34:42 -07:00
matu3ba
97b9facb98
compiler_rt: declutter int.zig, add mulXi3 tests (#14623)
- Combine mulXi3 routines for follow-up cleanup.
- DRY up Dwords and Twords
- rename both to HalveInt and use instance
  * Justification: Not all processors have word size 32 bit.
* remove test file from CMakeLists
* DRY things.
2023-02-24 13:27:02 -05:00
Jan Philipp Hafer
476bdc8b0b compiler_rt: restructure compiler_rt.zig according to README.md
Justifications
- compiler_rt base routines are almost finished, so make 1:1
mapping of code and documentation.
- Make adjustments to code + documentation simpler to prevent technical or
  documentation debt.
2023-02-19 14:00:55 -05:00
Jan Philipp Hafer
e10c0eefde compiler_rt: add __powihf2, __powisf2, __powidf2, __powitf2, __powixf2
Implementation and tests ported from LLVM release 80.
Tests of __powihf2 created from __powisf2 tests with minor adjustments.
2023-02-12 00:10:27 +02:00
Frank Denis
8d66aacb64
compiler-rt: implement __udivei4 and __umodei4 (#14023)
Allows dividing and formatting arbitrary-large unsigned integers.
2022-12-22 16:29:19 -05:00
Jacob Young
2a3d9c321e compiler_rt: remove stack probe functions from c builds 2022-12-06 12:27:28 -07:00
Andrew Kelley
39fd77bc16 interpret the WASI blob to produce zig2.c and compiler_rt.c
* synchronize zig1.c from zig-wasi external project
 * change the way argv works to avoid absolute paths
 * autodetect isatty
 * compiler_rt: disable some functions when object format is C
 * add missing flag from config.zig.in

The next problem is that compiling compiler_rt.c with gcc gives
"conflicting types" errors for `__eqhf2` and friends.
2022-12-06 12:15:04 -07:00
Andrew Kelley
545c3117ff rename lse_atomics.zig to aarch64_outline_atomics.zig 2022-11-21 17:17:02 -07:00
Andrew Kelley
95ee8ab77d simplify outline atomics
* Rely on libSystem when targeting macOS.
 * Make tools/gen_outline_atomics.zig more idiomatic.
 * Remove the CPU detection / auxval checking from compiler_rt. This
   functionality belongs in a different component. Zig's compiler_rt
   must not rely on constructors. Instead it will export a symbol for
   setting the value, and start code can detect and activate it.
 * Remove the separate logic for inline assembly when the target does or
   does not have lse support. `.inst` works in both cases.
2022-11-21 17:17:02 -07:00
Devin Singh
a8f2d00ec4 compiler_rt: add outlined lse atomics for aarch64 2022-11-21 17:17:02 -07:00
Luuk de Gram
cdf7e7dba9 fix: correctly import memcmp.zig in compiler-rt
cmp.zig was accidently being referenced twice, rather than importing
memcmp.zig. This means that its symbols were also not included in
the generated compiler-rt output.
2022-10-22 16:56:33 +02:00
Andrew Kelley
ce3ffa5e1b
Merge pull request #11747 from Luukdegram/compiler-rt
compiler_rt: Move mem implementations from c.zig
2022-10-17 18:12:22 -04:00
Luuk de Gram
f5edaa96dd compiler_rt: Move mem implementations from c.zig
This moves functions that LLVM generates calls to,
to the compiler_rt implementation itself, rather than c.zig.
This is a prerequisite for native backends to link with compiler-rt.
This also allows native backends to generate calls to `memcpy` and the like.
2022-10-15 07:02:38 -07:00
Cody Tapscott
0d533433e2 compiler_rt: Add missing f16 functions
This change also exposes some of the existing functions under both the
PPC-style names symbols and the compiler-rt-style names, since Zig
currently lowers softfloat calls to the latter.
2022-10-13 12:53:20 -07:00
Cody Tapscott
05915b85dd compiler-rt: Implement mulXc3 and divXc3 functions
These are the standard complex multiplication/division functions
required by the C standard (Annex G).

Don't get me started on the standard's handling of complex-infinity...
2022-10-09 11:09:41 -07:00
Andrew Kelley
6bc6e47b15 stage2: lower float negation explicitly
Rather than lowering float negation as `0.0 - x`.

 * Add AIR instruction for float negation.
 * Add compiler-rt functions for f128, f80 negation

closes #11853
2022-06-30 00:02:00 -07:00
frmdstryr
6de0c622ff Add missing adddf3
```
LLD Link... ld.lld: error: undefined symbol: __aeabi_dadd
>>> referenced by errol.zig:366 (/home/usr/projects/zig/build/lib/zig/std/fmt/errol.zig:366)
```
2022-06-22 14:32:52 +02:00
Andrew Kelley
25671f5a97 compiler-rt: move SPARC functions into appropriate compilation units 2022-06-17 16:38:59 -07:00
Andrew Kelley
c99c085d70 compiler-rt: break up functions even more
The purpose of this branch is to switch to using an object file for each
independent function, in order to make linking simpler - instead of
relying on `-ffunction-sections` and `--gc-sections`, which involves the
linker doing the work of linking everything and then undoing work via
garbage collection, this will allow the linker to only include the
compilation units that are depended on in the first place.

This commit makes progress towards that goal.
2022-06-17 16:38:59 -07:00
Jakub Konka
f572e5a0c4 compiler_rt: shuffle order of imports to mark relevant symbols for export 2022-06-17 16:38:59 -07:00
Jakub Konka
57c530155f compiler_rt: correctly export allrem and aullrem for i386-windows-msvc 2022-06-17 16:38:59 -07:00
Jakub Konka
80790be309 compiler_rt: compile each unit separately for improved archiving 2022-06-17 16:38:59 -07:00
Veikka Tuominen
ab4ec35b8b stage2: add runtime safety for unwrapping error 2022-05-16 17:42:51 -07:00
Andrew Kelley
cd019ee502 compiler_rt: avoid weak aliases on Windows
When exporting math functions for Windows, we provide weak exports of
'l' variants rather than weak aliases. We still use aliases on other
operating systems so that the 'l' variants have one less jump
instruction in this case.
2022-05-08 13:06:21 -07:00
Andrew Kelley
663b67783e compiler-rt: avoid symbol collisions with Windows libc
closes #11600
2022-05-07 17:44:49 -07:00
Andrew Kelley
ec95e00e28 flatten lib/std/special and improve "pkg inside another" logic
stage2: change logic for detecting whether the main package is inside
the std package. Previously it relied on realpath() which is not portable.
This uses resolve() which is how imports already work.

 * stage2: fix cleanup bug when creating Module
 * flatten lib/std/special/* to lib/*
   - this was motivated by making main_pkg_is_inside_std false for
     compiler_rt & friends.
 * rename "mini libc" to "universal libc"
2022-05-06 22:41:00 -07:00