machinst x64: correctly assign FP registers for incoming args;

Fixes #1943.

Thanks to @jlb6740 for noticing the issue and @bjorn3 for catching the
error!
This commit is contained in:
Benjamin Bouvier
2020-06-30 14:50:00 +02:00
parent f4b87f3102
commit de9fbfa095

View File

@@ -160,7 +160,7 @@ impl X64ABIBody {
let call_conv = f.signature.call_conv; let call_conv = f.signature.call_conv;
debug_assert!( debug_assert!(
call_conv == isa::CallConv::SystemV || call_conv.extends_baldrdash(), call_conv == isa::CallConv::SystemV || call_conv.extends_baldrdash(),
"unsupported or unimplemented calling convetion {}", "unsupported or unimplemented calling convention {}",
call_conv call_conv
); );
@@ -695,12 +695,18 @@ fn compute_arg_locs(
ArgsOrRets::Args => get_intreg_for_arg_systemv(next_gpr), ArgsOrRets::Args => get_intreg_for_arg_systemv(next_gpr),
ArgsOrRets::Rets => get_intreg_for_retval_systemv(next_gpr), ArgsOrRets::Rets => get_intreg_for_retval_systemv(next_gpr),
}; };
debug_assert!(candidate
.map(|r| r.get_class() == RegClass::I64)
.unwrap_or(true));
(&mut next_gpr, candidate) (&mut next_gpr, candidate)
} else { } else {
let candidate = match args_or_rets { let candidate = match args_or_rets {
ArgsOrRets::Args => get_fltreg_for_arg_systemv(next_gpr), ArgsOrRets::Args => get_fltreg_for_arg_systemv(next_vreg),
ArgsOrRets::Rets => get_fltreg_for_retval_systemv(next_gpr), ArgsOrRets::Rets => get_fltreg_for_retval_systemv(next_vreg),
}; };
debug_assert!(candidate
.map(|r| r.get_class() == RegClass::V128)
.unwrap_or(true));
(&mut next_vreg, candidate) (&mut next_vreg, candidate)
}; };