Skip to content

Commit 77cf02d

Browse files
committed
Rollup merge of #49024 - draganmladjenovic:mips64_cabi_sret, r=sanxiyn
rustc_trans: fix small aggregate returns for big-endian mips64 FFI Current model of threating small aggregate returns as smallest encompassing integer works only for little-endian mips64. The patch forces small aggregate return values to be viewed as one or two i64 chunks leaving to the casting implementation to handle endianes differences.
2 parents 5a7aa6c + 19b5113 commit 77cf02d

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/librustc_trans/cabi_mips64.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,6 @@ fn extend_integer_width_mips(arg: &mut ArgType, bits: u64) {
2828
arg.extend_integer_width_to(bits);
2929
}
3030

31-
fn bits_to_int_reg(bits: u64) -> Reg {
32-
if bits <= 8 {
33-
Reg::i8()
34-
} else if bits <= 16 {
35-
Reg::i16()
36-
} else if bits <= 32 {
37-
Reg::i32()
38-
} else {
39-
Reg::i64()
40-
}
41-
}
42-
4331
fn float_reg<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, ret: &ArgType<'tcx>, i: usize) -> Option<Reg> {
4432
match ret.layout.field(cx, i).abi {
4533
layout::Abi::Scalar(ref scalar) => match scalar.value {
@@ -82,7 +70,7 @@ fn classify_ret_ty<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, ret: &mut ArgType<'tcx>)
8270

8371
// Cast to a uniform int structure
8472
ret.cast_to(Uniform {
85-
unit: bits_to_int_reg(bits),
73+
unit: Reg::i64(),
8674
total: size
8775
});
8876
} else {

0 commit comments

Comments
 (0)