Remove unnecessary moves in x64 gen_memcpy (#5277)

Remove some unnecessary moves in the x64 gen_memcpy implementation -- the call instruction that's generated will already constrain the args to those registers.
This commit is contained in:
Trevor Elliott
2022-11-16 10:33:00 -08:00
committed by GitHub
parent 22433ed726
commit 07bd8bf34a
2 changed files with 6 additions and 9 deletions

View File

@@ -639,8 +639,6 @@ impl ABIMachineSpec for X64ABIMachineSpec {
let arg0 = get_intreg_for_arg(&call_conv, 0, 0).unwrap();
let arg1 = get_intreg_for_arg(&call_conv, 1, 1).unwrap();
let arg2 = get_intreg_for_arg(&call_conv, 2, 2).unwrap();
insts.push(Inst::gen_move(Writable::from_reg(arg0), dst, I64));
insts.push(Inst::gen_move(Writable::from_reg(arg1), src, I64));
insts.extend(
Inst::gen_constant(ValueRegs::one(temp), size as u128, I64, |_| {
panic!("tmp should not be needed")

View File

@@ -51,8 +51,8 @@ block0(v0: i64):
; virtual_sp_offset_adjust 64
; lea 0(%rsp), %rdi
; movl $64, %edx
; load_ext_name %Memcpy+0, %rax
; call *%rax
; load_ext_name %Memcpy+0, %r11
; call *%r11
; call User(userextname0)
; addq %rsp, $64, %rsp
; virtual_sp_offset_adjust -64
@@ -130,14 +130,13 @@ block0(v0: i64, v1: i64, v2: i64):
; virtual_sp_offset_adjust 192
; lea 0(%rsp), %rdi
; movl $128, %edx
; load_ext_name %Memcpy+0, %rcx
; call *%rcx
; load_ext_name %Memcpy+0, %rax
; call *%rax
; lea 128(%rsp), %rdi
; movq %r14, %rsi
; movl $64, %edx
; load_ext_name %Memcpy+0, %rcx
; load_ext_name %Memcpy+0, %r11
; movq %r14, %rsi
; call *%rcx
; call *%r11
; movq %r12, %rdi
; call User(userextname0)
; addq %rsp, $192, %rsp