MachInst: always rematerialize constants, rather than assign them registers

There were a few previous code paths that attempted to handle this, but this new
check handles it for all callers.

Rematerializing constants, rather than assigning and reusing a register, allows
for lower register pressure.
This commit is contained in:
Nick Fitzgerald
2021-11-10 15:45:43 -08:00
parent bbb4949128
commit b5105c025c
2 changed files with 55 additions and 27 deletions

View File

@@ -697,32 +697,34 @@ block2(v6: i128):
return v8
; check: Block 0:
; check: pushq %rbp
; nextln: movq %rsp, %rbp
; nextln: xorq %rdi, %rdi
; nextln: xorq %rsi, %rsi
; nextln: testb $$1, %dl
; nextln: jnz label1; j label2
; check: pushq %rbp
; nextln: movq %rsp, %rbp
; nextln: testb $$1, %dl
; nextln: jnz label1; j label2
; check: Block 1:
; check: movl $$1, %ecx
; nextln: xorq %rax, %rax
; nextln: addq %rcx, %rdi
; nextln: adcq %rax, %rsi
; nextln: movq %rdi, %rax
; nextln: movq %rsi, %rdx
; nextln: movq %rbp, %rsp
; nextln: popq %rbp
; nextln: ret
; check: movl $$0, %edi
; nextln: movl $$0, %esi
; nextln: movl $$1, %ecx
; nextln: movl $$0, %eax
; nextln: addq %rcx, %rdi
; nextln: adcq %rax, %rsi
; nextln: movq %rdi, %rax
; nextln: movq %rsi, %rdx
; nextln: movq %rbp, %rsp
; nextln: popq %rbp
; nextln: ret
; check: Block 2:
; check: movl $$2, %ecx
; nextln: xorq %rax, %rax
; nextln: addq %rcx, %rdi
; nextln: adcq %rax, %rsi
; nextln: movq %rdi, %rax
; nextln: movq %rsi, %rdx
; nextln: movq %rbp, %rsp
; nextln: popq %rbp
; nextln: ret
; check: movl $$0, %edi
; nextln: movl $$0, %esi
; nextln: movl $$2, %ecx
; nextln: movl $$0, %eax
; nextln: addq %rcx, %rdi
; nextln: adcq %rax, %rsi
; nextln: movq %rdi, %rax
; nextln: movq %rsi, %rdx
; nextln: movq %rbp, %rsp
; nextln: popq %rbp
; nextln: ret
}