about summary refs log tree commit diff
path: root/compiler/rustc_target/src/callconv
AgeCommit message (Collapse)AuthorLines
2025-01-28Auto merge of #134290 - tgross35:windows-i128-callconv, r=bjorn3,wesleywiserbors-7/+13
Windows x86: Change i128 to return via the vector ABI Clang and GCC both return `i128` in xmm0 on windows-msvc and windows-gnu. Currently, Rust returns the type on the stack. Add a calling convention adjustment so we also return scalar `i128`s using the vector ABI, which makes our `i128` compatible with C. In the future, Clang may change to return `i128` on the stack for its `-msvc` targets (more at [1]). If this happens, the change here will need to be adjusted to only affect MinGW. Link: https://github.com/rust-lang/rust/issues/134288 (does not fix) [1] try-job: x86_64-msvc try-job: x86_64-msvc-ext1 try-job: x86_64-mingw-1 try-job: x86_64-mingw-2
2025-01-27Windows x86: Change `i128` to return via the vector ABITrevor Gross-7/+13
Clang and GCC both return `i128` in xmm0 on windows-msvc and windows-gnu. Currently, Rust returns the type on the stack. Add a calling convention adjustment so we also return scalar `i128`s using the vector ABI, which makes our `i128` compatible with C. In the future, Clang may change to return `i128` on the stack for its `-msvc` targets (more at [1]). If this happens, the change here will need to be adjusted to only affect MinGW. Link: https://github.com/rust-lang/rust/issues/134288
2025-01-25Rollup merge of #135785 - folkertdev:s390x-vector-passmode-direct, r=bjorn3Jacob Pratt-3/+11
use `PassMode::Direct` for vector types on `s390x` closes https://github.com/rust-lang/rust/issues/135744 tracking issue: https://github.com/rust-lang/rust/issues/130869 Previously, all vector types were type erased to `Ni8`, now we pass non-wrapped vector types directly. That skips emitting a bunch of casting logic in rustc, that LLVM then has to clean up. The initial LLVM IR is also a bit more readable. This calling convention is tested extensively in `tests/assembly/s390x-vector-abi.rs`, showing that this change has no impact on the ABI in practice. r? ````@taiki-e````
2025-01-22Rollup merge of #134396 - mustartt:byval-pointer-natural-alignment, ↵Matthias Krüger-1/+3
r=wesleywiser AIX: use align 8 for byval parameter On AIX, byval pointer arguments are aligned to 8 bytes based on the 64bit register size. For example, the C callee https://godbolt.org/z/5f4vnG6bh will expect the following argument. ``` ptr nocapture noundef readonly byval(%struct.TwoU64s) align 8 %0 ``` This case is captured by `run-make/extern-fn-explicit-align`
2025-01-20on s390x, use `PassMode::Direct` for vector typesFolkert de Vries-3/+11
2025-01-17Auto merge of #135534 - folkertdev:fix-wasm-i128-f128, r=tgross35bors-0/+12
use indirect return for `i128` and `f128` on wasm32 fixes #135532 Based on https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md we now use an indirect return for `i128`, `u128` and `f128`. That is what LLVM ended up doing anyway. r? `@bjorn3`
2025-01-17Auto merge of #135047 - Flakebi:amdgpu-kernel-cc, r=workingjubileebors-0/+3
Add gpu-kernel calling convention The amdgpu-kernel calling convention was reverted in commit f6b21e90d1ec01081bc2619efb68af6788a63d65 (#120495 and https://github.com/rust-lang/rust-analyzer/pull/16463) due to inactivity in the amdgpu target. Introduce a `gpu-kernel` calling convention that translates to `ptx_kernel` or `amdgpu_kernel`, depending on the target that rust compiles for. Tracking issue: #135467 amdgpu target tracking issue: #135024
2025-01-16use indirect return for `i128` and `f128` on wasm32Folkert de Vries-0/+12
2025-01-16Add gpu-kernel calling conventionFlakebi-0/+3
The amdgpu-kernel calling convention was reverted in commit f6b21e90d1ec01081bc2619efb68af6788a63d65 due to inactivity in the amdgpu target. Introduce a `gpu-kernel` calling convention that translates to `ptx_kernel` or `amdgpu_kernel`, depending on the target that rust compiles for.
2025-01-12on Windows, consistently pass ZST by-refRalf Jung-16/+10
2025-01-10fix ZST handling for Windows ABIs on MSVC targetRalf Jung-23/+30
2024-12-18make no-variant types a dedicated Variants variantRalf Jung-3/+3
2024-12-17byval parameter should have align 8 on aixHenry Jiang-1/+3
2024-12-13Fix powerpc64 big-endian FreeBSD ABITaiki Endo-1/+1
2024-12-02rust_for_linux: -Zreg-struct-return commandline flag for X86 (#116973)Andrew Zhogin-2/+5
2024-11-22Rollup merge of #133102 - RalfJung:aarch64-softfloat, r=davidtwco,wesleywiserMichael Goulet-5/+58
aarch64 softfloat target: always pass floats in int registers This is a part of https://github.com/rust-lang/rust/issues/131058: on softfloat aarch64 targets, the float registers may be unavailable. And yet, LLVM will happily use them to pass float types if the corresponding target features are enabled. That's a problem as it means enabling/disabling `neon` instructions can change the ABI. Other targets have a `soft-float` target feature that forces the use of the soft-float ABI no matter whether float registers are enabled or not; aarch64 has nothing like that. So we follow the aarch64 [softfloat ABI](https://github.com/rust-lang/rust/issues/131058#issuecomment-2385027423) and treat floats like integers for `extern "C"` functions. For the "Rust" ABI, we do the same for scalars, and then just do something reasonable for ScalarPair that avoids the pointer indirection. Cc ```@workingjubilee```
2024-11-20aarch64 softfloat target: always pass floats in int registersRalf Jung-5/+58
2024-11-14Support s390x z13 vector ABITaiki Endo-8/+18
2024-11-08pointee_info_at: fix logic for recursing into enumsRalf Jung-1/+2
2024-10-29compiler: `rustc_abi::Abi` => `BackendRepr`Jubilee Young-65/+81
The initial naming of "Abi" was an awful mistake, conveying wrong ideas about how psABIs worked and even more about what the enum meant. It was only meant to represent the way the value would be described to a codegen backend as it was lowered to that intermediate representation. It was never meant to mean anything about the actual psABI handling! The conflation is because LLVM typically will associate a certain form with a certain ABI, but even that does not hold when the special cases that actually exist arise, plus the IR annotations that modify the ABI. Reframe `rustc_abi::Abi` as the `BackendRepr` of the type, and rename `BackendRepr::Aggregate` as `BackendRepr::Memory`. Unfortunately, due to the persistent misunderstandings, this too is now incorrect: - Scattered ABI-relevant code is entangled with BackendRepr - We do not always pre-compute a correct BackendRepr that reflects how we "actually" want this value to be handled, so we leave the backend interface to also inject various special-cases here - In some cases `BackendRepr::Memory` is a "real" aggregate, but in others it is in fact using memory, and in some cases it is a scalar! Our rustc-to-backend lowering code handles this sort of thing right now. That will eventually be addressed by lifting duplicated lowering code to either rustc_codegen_ssa or rustc_target as appropriate.
2024-10-23Set `signext` or `zeroext` for integer arguments on LoongArch64Asuna-0/+29
2024-10-23Set `signext` or `zeroext` for integer arguments on RISC-VAsuna-0/+28
2024-10-23Introduce `adjust_for_rust_abi` in `rustc_target`Asuna-3/+151
2024-10-18compiler: Revert -Zregparm handling for extern RustJubilee Young-22/+0
2024-10-18rust_for_linux: -Zregparm=<N> commandline flag for X86 (#116972)Andrew Zhogin-49/+99
2024-10-11compiler: Wire `{TyAnd,}Layout` into `rustc_abi`Jubilee Young-247/+2
This finally unites TyAndLayout, Layout, and LayoutS into the same crate, as one might imagine they would be placed. No functional changes.
2024-10-11compiler: Empty out rustc_target::abiJubilee Young-0/+3807