blob: 9034d267ffeea8b8fe2f874fd3b5edbb51bcc9d6 (
plain) (
tree)
|
|
Upstream: https://github.com/rust-lang/rust/issues/128579
diff --git a/compiler/rustc_target/src/abi/call/powerpc64.rs b/compiler/rustc_target/src/abi/call/powerpc64.rs
index 11a6cb52bab..4212871389c 100644
--- a/compiler/rustc_target/src/abi/call/powerpc64.rs
+++ b/compiler/rustc_target/src/abi/call/powerpc64.rs
@@ -69,19 +69,15 @@ fn classify_ret<'a, Ty, C>(cx: &C, ret: &mut ArgAbi<'a, Ty>, abi: ABI)
let size = ret.layout.size;
let bits = size.bits();
if bits <= 128 {
- let unit = if cx.data_layout().endian == Endian::Big {
- Reg { kind: RegKind::Integer, size }
- } else if bits <= 8 {
- Reg::i8()
- } else if bits <= 16 {
- Reg::i16()
- } else if bits <= 32 {
- Reg::i32()
+ if bits <= 64 {
+ ret.cast_to(Uniform::new(Reg { kind: RegKind::Integer, size }, size))
} else {
- Reg::i64()
+ let reg = if ret.layout.align.abi.bytes() > 8 { Reg::i128() } else { Reg::i64() };
+ ret.cast_to(Uniform::consecutive(
+ reg,
+ size.align_to(Align::from_bytes(reg.size.bytes()).unwrap()),
+ ))
};
-
- ret.cast_to(Uniform::new(unit, size));
return;
}
|