diff options
| author | bors <bors@rust-lang.org> | 2025-01-17 15:07:28 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-01-17 15:07:28 +0000 |
| commit | bcd0683e5dce1945b5d940714742e7502883bb5c (patch) | |
| tree | e568849b86bdfc2862ddecd39be68f4c3f2995d9 /compiler | |
| parent | 73c0ae6aec8f3d07467dfb9339761fa2eec92a44 (diff) | |
| parent | 702134a9300dd36b8c49a044a06d4bc8e454cf87 (diff) | |
Auto merge of #135534 - folkertdev:fix-wasm-i128-f128, r=tgross35
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`
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_target/src/callconv/wasm.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/rustc_target/src/callconv/wasm.rs b/compiler/rustc_target/src/callconv/wasm.rs index 3c4cd76a754..d01b59cbb03 100644 --- a/compiler/rustc_target/src/callconv/wasm.rs +++ b/compiler/rustc_target/src/callconv/wasm.rs @@ -1,3 +1,5 @@ +use rustc_abi::{BackendRepr, Float, Integer, Primitive}; + use crate::abi::call::{ArgAbi, FnAbi}; use crate::abi::{HasDataLayout, TyAbiInterface}; @@ -27,6 +29,16 @@ where if ret.layout.is_aggregate() && !unwrap_trivial_aggregate(cx, ret) { ret.make_indirect(); } + + // `long double`, `__int128_t` and `__uint128_t` use an indirect return + if let BackendRepr::Scalar(scalar) = ret.layout.backend_repr { + match scalar.primitive() { + Primitive::Int(Integer::I128, _) | Primitive::Float(Float::F128) => { + ret.make_indirect(); + } + _ => {} + } + } } fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) |
