1
Fork 0

use indirect return for i128 and f128 on wasm32

This commit is contained in:
Folkert de Vries 2025-01-15 15:15:52 +01:00
parent 93ba568ab9
commit 702134a930
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 110 additions and 0 deletions

View file

@ -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>)