69 Commits

Author SHA1 Message Date
Alex Rønne Petersen
7e54ee06d8
test: disable big simd vector C ABI test on s390x 2025-11-21 12:15:15 +01:00
Alex Rønne Petersen
692c798303
test: disable a bunch of failing C ABI tests on s390x 2025-11-19 01:42:45 +01:00
Alex Rønne Petersen
ae0cc8c065
test: disable C ABI tests using i128 on s390x due to an LLVM crash
https://github.com/llvm/llvm-project/issues/168460
2025-11-19 01:42:45 +01:00
Alex Rønne Petersen
9ab7eec23e represent Mac Catalyst as aarch64-maccatalyst-none rather than aarch64-ios-macabi
Apple's own headers and tbd files prefer to think of Mac Catalyst as a distinct
OS target. Earlier, when DriverKit support was added to LLVM, it was represented
a distinct OS. So why Apple decided to only represent Mac Catalyst as an ABI in
the target triple is beyond me. But this isn't the first time they've ignored
established target triple norms (see: armv7k and aarch64_32) and it probably
won't be the last.

While doing this, I also audited all Darwin OS prongs throughout the codebase
and made sure they cover all the tags.
2025-11-14 11:33:35 +01:00
Alex Rønne Petersen
f1c2ae271c
test: disable some SIMD ABI tests on LoongArch 2025-09-18 12:42:24 +02:00
Alex Rønne Petersen
f149112951
test: expand C ABI test coverage to hexagon-linux-musl 2025-08-30 06:36:41 +02:00
Linus Groh
eb37552536 Remove numerous things deprecated during the 0.14 release cycle
Basically everything that has a direct replacement or no uses left.

Notable omissions:

- std.ArrayHashMap: Too much fallout, needs a separate cleanup.
- std.debug.runtime_safety: Too much fallout.
- std.heap.GeneralPurposeAllocator: Lots of references to it remain, not
  a simple find and replace as "debug allocator" is not equivalent to
  "general purpose allocator".
- std.io.Reader: Is being reworked at the moment.
- std.unicode.utf8Decode(): No replacement, needs a new API first.
- Manifest backwards compat options: Removal would break test data used
  by TestFetchBuilder.
- panic handler needs to be a namespace: Many tests still rely on it
  being a function, needs a separate cleanup.
2025-07-11 08:17:43 +02:00
Alex Rønne Petersen
98cf81d51c test: Expand target coverage for C ABI tests. 2025-06-05 21:50:56 +02:00
Alex Rønne Petersen
9d534790eb std.Target: Introduce Cpu convenience functions for feature tests.
Before:

* std.Target.arm.featureSetHas(target.cpu.features, .has_v7)
* std.Target.x86.featureSetHasAny(target.cpu.features, .{ .sse, .avx, .cmov })
* std.Target.wasm.featureSetHasAll(target.cpu.features, .{ .atomics, .bulk_memory })

After:

* target.cpu.has(.arm, .has_v7)
* target.cpu.hasAny(.x86, &.{ .sse, .avx, .cmov })
* target.cpu.hasAll(.wasm, &.{ .atomics, .bulk_memory })
2025-06-05 06:12:00 +02:00
Pavel Verigo
a843be44a0 wasm-c-abi: llvm fix struct handling + reorganize
I changed to `wasm/abi.zig`, this design is certainly better than the previous one. Still there is some conflict of interest between llvm and self-hosted backend, better design will appear when abi tests will be tested with self-hosted.

Resolves: #23304
Resolves: #23305
2025-05-01 18:10:36 -04:00
Linus Groh
79460d4a3e Remove uses of deprecated callconv aliases 2025-03-05 03:01:43 +00:00
Alex Rønne Petersen
481b7bf3f0
std.Target: Remove functions that just wrap component functions.
Functions like isMinGW() and isGnuLibC() have a good reason to exist: They look
at multiple components of the target. But functions like isWasm(), isDarwin(),
isGnu(), etc only exist to save 4-8 characters. I don't think this is a good
enough reason to keep them, especially given that:

* It's not immediately obvious to a reader whether target.isDarwin() means the
  same thing as target.os.tag.isDarwin() precisely because isMinGW() and similar
  functions *do* look at multiple components.
* It's not clear where we would draw the line. The logical conclusion before
  this commit would be to also wrap Arch.isX86(), Os.Tag.isSolarish(),
  Abi.isOpenHarmony(), etc... this obviously quickly gets out of hand.
* It's nice to just have a single correct way of doing something.
2025-02-17 19:18:19 +01:00
Alex Rønne Petersen
c9e67e71c1
std.Target: Replace isARM() with isArmOrThumb() and rename it to isArm().
The old isARM() function was a portability trap. With the name it had, it seemed
like the obviously correct function to use, but it didn't include Thumb. In the
vast majority of cases where someone wants to ask "is the target Arm?", Thumb
*should* be included.

There are exactly 3 cases in the codebase where we do actually need to exclude
Thumb, although one of those is in Aro and mirrors a check in Clang that is
itself likely a bug. These rare cases can just add an extra isThumb() check.
2024-11-03 09:29:30 +01:00
Maciej 'vesim' Kuliński
fb0028a0d7 mips: fix C ABI compatibility 2024-09-07 23:46:30 -07:00
Alex Rønne Petersen
e5c75479c2
std.Target: Rework isPPC()/isPPC64() functions.
* Rename isPPC() -> isPowerPC32().
* Rename isPPC64() -> isPowerPC64().
* Add new isPowerPC() function which covers both.

There was confusion even in the standard library about what isPPC() meant. This
change makes these functions work how I think most people actually expect them
to work, and makes them consistent with isMIPS(), isSPARC(), etc.

I chose to rename from PPC to PowerPC because 1) it's more consistent with the
other functions, and 2) it'll cause loud rather than silent breakage for anyone
who might have been depending on isPPC() while misunderstanding it.
2024-08-01 20:58:05 +02:00
Jacob Young
08cecc1c7e x86_64: fix C abi of incomplete sse register 2024-05-08 19:37:29 -07:00
Jacob Young
5d745d94fb x86_64: fix C abi for unions
Closes #19721
2024-04-22 15:24:29 -07:00
Jacob Young
f668c8bfd6 x86_64: fix abi of nested structs 2024-04-06 13:02:55 -07:00
Luuk de Gram
27f589dea1
Merge pull request #18538 from Pangoraw/wasm_vector_abi
wasm: allow non-int vectors
2024-02-27 18:42:12 +01:00
Jacob Young
ec7293422d llvm: fix c abi for structs not passed in registers
Closes #18916
2024-02-20 23:36:47 +01:00
Paul Berg
885f40520e c_abi: add vector tests for floats 2024-02-15 13:17:46 +01:00
Paul Berg
42446e6bf9 wasm: enable bool vectors tests for stage2_llvm 2024-02-15 13:17:37 +01:00
Jacob Young
a9f738e56b x86_64: implement c abi for bool vectors 2024-02-12 05:25:07 +01:00
Carl Åstholm
85869f8225 Correct expected/actual parameter order of some assertions 2024-01-03 21:20:49 +01:00
Carl Åstholm
4c1da0912a Fix compile errors from the expectEqual change 2024-01-03 21:20:48 +01:00
mlugg
d82d327de2
test: update remaining code to fix 'var is never mutated' errors 2023-11-19 09:57:04 +00:00
Jacob Young
a440cf6d44 x86_64: fix c abi test failures 2023-10-27 23:31:20 -04:00
Jacob Young
48526c0eb6 test: enable c-abi-tests for the x86_64 backend
Add testing for `x86_64_v2` and `x86_64_v3` with the x86_64 backend.
2023-10-26 21:45:58 -04:00
Jacob Young
97ae2d2c29 c-abi: enable passing tests 2023-07-28 19:27:08 -04:00
Jacob Young
125b453c58 llvm: fix SysV C abi for structs smaller than two eightbytes
Closes #16038
Closes #16288
2023-07-28 19:27:08 -04:00
Andrew Kelley
0f21d3d4d1 LLVM: always add argument attributes to calls
These are needed for correctness. There's no reason to only add them for
function pointers.

closes #16290
2023-07-27 00:49:25 -07:00
Andrew Kelley
a707f380a5 llvm: disable LTO on C ABI tests
This required disabling some failing tests. See #14908
2023-07-26 11:07:11 -07:00
mlugg
f26dda2117 all: migrate code to new cast builtin syntax
Most of this migration was performed automatically with `zig fmt`. There
were a few exceptions which I had to manually fix:

* `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten
* `@truncate`'s fixup is incorrect for vectors
* Test cases are not formatted, and their error locations change
2023-06-24 16:56:39 -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
Veikka Tuominen
aa626deadd llvm: implement explicit Win64 and SysV calling conventions 2023-01-22 01:04:20 +02:00
Veikka Tuominen
fe6dcdba14
Merge pull request #14357 from kcbanner/llvm_byval_struct
llvm: implement Stdcall calling convention
2023-01-20 04:38:49 +02:00
Veikka Tuominen
2b7678bc42 llvm: implement Stdcall return types 2023-01-19 16:13:52 +02:00
kcbanner
5949851074 llvm: pass non-scalars as byref in .Stdcall
- add c_abi tests for .Stdcall
- enable (x86|x86_64)-windows-gnu in the c_abi tests
2023-01-19 00:37:56 -05:00
Veikka Tuominen
24646b8b5d windows x86_64 C ABI: pass byref structs as byref_mut 2023-01-17 20:28:43 +02:00
Veikka Tuominen
0013042cbd llvm: correctly handle C ABI structs with f32/f64 alignment differences
Closes #13830
2023-01-14 16:26:50 +02:00
Veikka Tuominen
5572c67e73 add C ABI tests for exotic float types 2023-01-14 16:26:50 +02:00
Veikka Tuominen
474848ac0b also run C ABI tests with -OReleaseFast 2023-01-14 16:26:50 +02:00
Veikka Tuominen
9f23702c21 llvm: fix C ABI for <=256 bit vectors
Closes #13918
2022-12-20 18:34:33 +02: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
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
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
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
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