Fix returning (u128, u128)
This commit is contained in:
parent
63646b1956
commit
49b21f2730
2 changed files with 20 additions and 4 deletions
|
@ -117,6 +117,14 @@ impl<T: ?Sized, U: ?Sized> CoerceUnsized<Unique<U>> for Unique<T> where T: Unsiz
|
|||
fn take_f32(_f: f32) {}
|
||||
fn take_unique(_u: Unique<()>) {}
|
||||
|
||||
fn return_u128_pair() -> (u128, u128) {
|
||||
(0, 0)
|
||||
}
|
||||
|
||||
fn call_return_u128_pair() {
|
||||
return_u128_pair();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
take_unique(Unique {
|
||||
pointer: 0 as *const (),
|
||||
|
@ -124,6 +132,8 @@ fn main() {
|
|||
});
|
||||
take_f32(0.1);
|
||||
|
||||
call_return_u128_pair();
|
||||
|
||||
//return;
|
||||
|
||||
unsafe {
|
||||
|
|
14
src/abi.rs
14
src/abi.rs
|
@ -113,10 +113,16 @@ fn get_pass_mode<'tcx>(
|
|||
PassMode::ByVal(scalar_to_clif_type(tcx, scalar.clone()))
|
||||
}
|
||||
layout::Abi::ScalarPair(a, b) => {
|
||||
PassMode::ByValPair(
|
||||
scalar_to_clif_type(tcx, a.clone()),
|
||||
scalar_to_clif_type(tcx, b.clone()),
|
||||
)
|
||||
let a = scalar_to_clif_type(tcx, a.clone());
|
||||
let b = scalar_to_clif_type(tcx, b.clone());
|
||||
if a == types::I128 && b == types::I128 {
|
||||
// Returning (i128, i128) by-val-pair would take 4 regs, while only 3 are
|
||||
// available on x86_64. Cranelift gets confused when too many return params
|
||||
// are used.
|
||||
PassMode::ByRef
|
||||
} else {
|
||||
PassMode::ByValPair(a, b)
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME implement Vector Abi in a cg_llvm compatible way
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue