Skip to content

Commit

Permalink
Fixes sparc64 cabi fixes.
Browse files Browse the repository at this point in the history
Argument up to 16 bytes size is provided in registers.
Return value up to 32 bytes size is stored in registers.

Fixes: #46679
  • Loading branch information
psumbera committed Jan 18, 2018
1 parent 0f9c784 commit f4bcfc5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/librustc_trans/cabi_sparc64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn is_homogeneous_aggregate<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, arg: &mut ArgTyp
let valid_unit = match unit.kind {
RegKind::Integer => false,
RegKind::Float => true,
RegKind::Vector => arg.layout.size.bits() == 128
RegKind::Vector => arg.layout.size.bits() == 256
};

if valid_unit {
Expand All @@ -50,7 +50,7 @@ fn classify_ret_ty<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, ret: &mut ArgType<'tcx>)
}
let size = ret.layout.size;
let bits = size.bits();
if bits <= 128 {
if bits <= 256 {
let unit = if bits <= 8 {
Reg::i8()
} else if bits <= 16 {
Expand Down Expand Up @@ -84,6 +84,11 @@ fn classify_arg_ty<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, arg: &mut ArgType<'tcx>)
}

let total = arg.layout.size;
if total.bits() > 128 {
arg.make_indirect(cx);
return;
}

arg.cast_to(Uniform {
unit: Reg::i64(),
total
Expand Down

0 comments on commit f4bcfc5

Please sign in to comment.