-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-codegenArea: Code generationArea: Code generationI-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
For
pub struct Moo((u128, ()));
pub fn moo(a: Moo, b: Moo) -> Moo {
Moo(((a.0).0 + (b.0).0, ()))
}
pub struct Baa(u128, ());
pub fn baa(a: Baa, b: Baa) -> Baa {
Baa(a.0 + b.0, ())
}
cargo asm
gives
try::moo:
mov rcx, qword, ptr, [rdx]
add rcx, qword, ptr, [rsi]
mov rdx, qword, ptr, [rdx, +, 8]
adc rdx, qword, ptr, [rsi, +, 8]
mov rax, rdi
mov qword, ptr, [rdi, +, 8], rdx
mov qword, ptr, [rdi], rcx
ret
and
try::baa:
mov rax, rdi
add rax, rdx
adc rsi, rcx
mov rdx, rsi
ret
Metadata
Metadata
Assignees
Labels
A-codegenArea: Code generationArea: Code generationI-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.