Use F64X2 as type when saving and restoring XMM registers

When adding floating-point registers as callee-saved register to
block- and function parameter lists add them as `F64X2` arguments.
This commit is contained in:
Samrat Man Singh
2020-04-11 23:16:28 +05:30
committed by iximeow
parent 63c97e365e
commit 4d34c22a1c
3 changed files with 18 additions and 19 deletions

View File

@@ -620,12 +620,8 @@ fn fastcall_prologue_epilogue(func: &mut ir::Function, isa: &dyn TargetIsa) -> C
// The calling convention described in
// https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention only requires
// preserving the low 128 bits of XMM6-XMM15.
//
// TODO: For now, add just an `F64` rather than `F64X2` because `F64X2` would require
// encoding a fstDisp8 with REX bits set, and we currently can't encode that. F64 causes a
// whole XMM register to be preserved anyway.
let csr_arg =
ir::AbiParam::special_reg(types::F64, ir::ArgumentPurpose::CalleeSaved, fp_csr);
ir::AbiParam::special_reg(types::F64X2, ir::ArgumentPurpose::CalleeSaved, fp_csr);
func.signature.params.push(csr_arg);
func.signature.returns.push(csr_arg);
}
@@ -910,7 +906,7 @@ fn insert_common_prologue(
for reg in csrs.iter(FPR) {
// Append param to entry Block
let csr_arg = pos.func.dfg.append_block_param(block, types::F64);
let csr_arg = pos.func.dfg.append_block_param(block, types::F64X2);
// Since regalloc has already run, we must assign a location.
pos.func.locations[csr_arg] = ir::ValueLoc::Reg(reg);
@@ -1035,9 +1031,12 @@ fn insert_common_epilogue(
let mut fpr_offset = 0;
for reg in csrs.iter(FPR) {
let value = pos
.ins()
.load(types::F64, ir::MemFlags::trusted(), stack_addr, fpr_offset);
let value = pos.ins().load(
types::F64X2,
ir::MemFlags::trusted(),
stack_addr,
fpr_offset,
);
fpr_offset += types::F64X2.bytes() as i32;
if let Some(ref mut cfa_state) = cfa_state.as_mut() {