Commit Graph

54 Commits

Author SHA1 Message Date
Andrew Kelley
1d68045919
Merge pull request #13101 from alichraghi/o4 2022-11-05 02:34:24 -04:00
Ali Chraghi
f5f1f8c666 all: rename i386 to x86 2022-11-04 00:09:27 +03:30
Jakub Konka
480c3c4d0a compiler_rt: fix duplicate symbol error when linking libc on arm64 Windows 2022-11-03 14:41:28 +01:00
Andrew Kelley
3e126102b7 compiler_rt: fix gnu_f16_abi for i386-windows
closes #13333
2022-10-30 18:42:59 -07:00
Andrew Kelley
1f4f8d34a1 compiler_rt: fix memcmp wrong for some inputs
See the new test case - this fails in the previous implementation.

See #13303
2022-10-27 22:11:20 -04:00
Andrew Kelley
1d1c7ae5de
Merge pull request #13257 from topolarity/ctype-fixes
stage 2: Update `CType` size/alignment
2022-10-27 21:15:22 -04:00
Cody Tapscott
c50f33b111 compiler_rt: Always export "standard" symbol names
The Zig LLVM backend emits calls to softfloat methods with the "standard
compiler-rt" names. Rather than add complexity to the backend and
have to synchronize the naming scheme across all targets, the simplest
fix is just to export these symbols under both the "standard" and the
platform-specific naming convention.
2022-10-22 17:19:33 -07:00
Jan Philipp Hafer
776f7de967 update compiler_rt README and prettify it
This documents status of routines and adds the next work item
"Decimal float library routines", which are only recommended for
binary data. Complete absence of tests is also documented.
This does not document the various aliases, e.g. those for ARM.

Missing Integer library routines:
- __addvsi3
- __addvdi3
- __addvti3
- __addvdi3
- __addvti3
- __subvsi3
- __subvdi3
- __subvti3
- __subvdi3
- __subvti3
- __mulvsi3
- __mulvdi3
- __mulvti3
- __mulvdi3
- __mulvti3

Missing floating library routines:
- __powisf2
- __powidf2
- __powitf2
- __powixf2

Missing routines for symbol-level compatibility to gcc:
- __ashlsi3
- __ashrsi3
- __lshrsi3
2022-10-22 09:23:50 -07:00
Louis Pearson
8d4778b4f9
Support compiling for the android NDK (#13245) 2022-10-21 18:32:56 -04:00
Ali Chraghi
ca27055cda all: rename @maximum to @max and @minimum to @min 2022-10-18 14:15:16 +03: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
Jacob Young
1e0f74a9e6 emutls: add const to default_value field
Commit f14cc75 accidentally added a const when grepping for assignments
to `std.builtin.Type.StructField.default_value`, however when looking
into it further, I noticed that even though this default_value field is
emitted into the .data section, the value it points to is actually
emitted into the .rodata section, so it seems correct to use const here.
2022-10-17 07:50:01 -04:00
Andrew Kelley
66d6183001 Merge branch 'amdgpu-improvements' of https://github.com/Snektron/zig into Snektron-amdgpu-improvements 2022-10-15 10:36:10 -07: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
Robin Voetter
aa20295d24
compiler_rt: apply protty suggestions 2022-10-12 20:36:15 +02:00
Robin Voetter
9006cd9d09
compiler_rt: cmpxchg-based atomic fetch/exchange for small types
Some architectures (AMDGPU) do not support atomic exchange/fetch for
small types (for AMDGPU: 8- and 16-bit ints). For these types
atomic fetch and atomic exchange needs to be implemeted using atomic
operations on a wider type using cmpxchg.
2022-10-12 20:36:14 +02:00
Cody Tapscott
c9ecf7b920 compiler_rt: Fix extendf_f80 bug
Zig should probably perform this cast automatically (w/ safety).
Integer shifts are a real pain otherwise.

Adds some test coverage, too.
2022-10-09 13:42:39 -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
Jacob Young
e915b905e0 use @ptrCast to assigned generic type to default_value
If the type happens to be a pointer, then the double pointer will not
coerce implicitly.
2022-09-27 13:21:01 +03:00
Veikka Tuominen
694fab4848 std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
Andrew Kelley
de7270028d Merge remote-tracking branch 'origin/master' into llvm15 2022-08-29 14:10:59 -07:00
Andrew Kelley
2a96209c40
Merge pull request #12574 from Vexu/remove-bit-op-type-param
stage2+stage1: remove type parameter from bit builtins
2022-08-24 15:57:44 -04:00
Jakub Konka
d852894dcf skip failing compiler-rt divxf3 tests on Windows 2022-08-23 22:59:11 +02:00
Veikka Tuominen
62ff8871ed stage2+stage1: remove type parameter from bit builtins
Closes #12529
Closes #12511
Closes #6835
2022-08-22 11:19:20 +03:00
Andrew Kelley
169ad1aac7 compiler_rt: update ABI for x86 float16 functions
See https://github.com/llvm/llvm-project/issues/56854 for more details.
2022-08-04 14:55:35 -07:00
Andrew Kelley
affe52b590 compiler_rt: use standard f16 function names on x86
LLVM 15 started generating calls to the standard name now.
2022-08-02 17:22:23 -07:00
Veikka Tuominen
d75fa86d70 stage2: implement @setFloatMode 2022-07-23 15:40:12 +03:00
Andrew Kelley
35e7011124 LLVM: implement signext/zeroext attributes
For calling convention ABI purposes, integer attributes and return
values need to have an LLVM attribute signext or zeroext added
sometimes. This commit implements that logic.

It also implements a proof-of-concept of moving the F16T type from
being a compiler_rt hack to being how the compiler lowers f16 in
functions that need to match certain calling conventions.

Closes #12054
2022-07-13 11:14:46 -07:00
Veikka Tuominen
122c76a167 Sema: allow void as an extern union field & fix invalid extern unions 2022-07-11 20:30:16 +03:00
Cody Tapscott
bb8971150c compiler_rt: Slightly re-factor exports for Windows x86-64
This is just a cosmetic change. The goal is to keep the export logic
relatively flat and centralized.
2022-07-10 20:51:34 -07:00
Cody Tapscott
680419c407 compiler_rt: Update Windows ABI for float<->int conversion routines
Starting with LLVM 14, the Libcalls to these functions are now lowered
using a Vec(2, u64) instead of the standard ABI for i128 integers, so
our compiler-rt implementation needs to be updated to expose the same
ABI on Windows.
2022-07-10 20:51:34 -07:00
Andrew Kelley
8e492f7d47 compiler_rt: enable __clear_cache for stage2 2022-07-07 20:47:43 -07:00
Andrew Kelley
38e3063296 compiler_rt: RISC-V does not want gnu_f16_abi 2022-07-06 02:29:54 -07:00
Andrew Kelley
d8fc8d0118 compiler_rt: work around LLVM optimizing __muloti4 to call itself
This is a workaround for
https://github.com/llvm/llvm-project/issues/56403
2022-07-05 21:28:39 -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
Jakub Konka
b4f2c0dcb9 compiler-rt: fix logic for choosing __gnu_{f2h,h2f}_ieee
Similar to wasm32-wasi-musl, Apple targets also want standard
symbol names.
2022-06-19 15:12:08 +02:00
Andrew Kelley
30ef033693 compiler-rt: fix logic for choosing __gnu_{f2h,h2f}_ieee
wasm32-wasi-musl wants the standard symbol names however Linux requires
the `__gnu_*` flavors. I did not find any authoritative source on what
decides which symbol flavors to use. If we run into more trouble in the
future we can go back to having both.
2022-06-17 20:25:17 -07:00
Andrew Kelley
ebab5288c3 compiler-rt: fix aeabi logic
Before, compiler-rt would have the wrong symbols for ARM targets.
2022-06-17 18:22:35 -07:00
Andrew Kelley
0556a2ba53 compiler-rt: finish cleanups
Finishes cleanups that I started in other commits in this branch.

 * Use common.linkage for all exports instead of redoing the logic in
   each file.
 * Remove pointless `@setRuntimeSafety` calls.
 * Avoid redundantly exporting multiple versions of functions. For
   example, if PPC wants `ceilf128` then don't also export `ceilq`;
   similarly if ARM wants `__aeabi_ddiv` then don't also export
   `__divdf3`.
 * Use `inline` for helper functions instead of making inline calls at
   callsites.
2022-06-17 18:10:00 -07:00
Andrew Kelley
3efc229bbf compiler-rt: musl ABI also needs __gnu_f2h_ieee etc 2022-06-17 16:42:50 -07:00
Andrew Kelley
bcf3a7d600 compiler-rt: gedf2 and gesf2 2022-06-17 16:40:25 -07:00
Andrew Kelley
bbc6103398 compiler-rt: fix tests 2022-06-17 16:38:59 -07:00
Andrew Kelley
a8a7f15106 compiler-rt: use callconv(.AAPCS) on all __aeabi_ functions 2022-06-17 16:38:59 -07: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
57c530155f compiler_rt: correctly export allrem and aullrem for i386-windows-msvc 2022-06-17 16:38:59 -07:00
Jakub Konka
2259d629d3 compiler_rt: use single cache for libcompiler_rt.a static lib 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
9aae4d57cb compiler_rt: fix infinite loop 2022-06-03 14:27:45 +03:00