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`
This commit is contained in:
commit
bcd0683e5d
3 changed files with 110 additions and 0 deletions
|
@ -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>)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue