https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115984
Bug ID: 115984
Summary: Missed optimization: unnecessary register copies
Product: gcc
Version: 14.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: nick.hudson at broadcom dot com
Target Milestone: ---
This code produces assembly output with unnecessary register copies
void
write128(volatile void *addr, uint128_t val)
{
volatile uint128_t *ptr = addr;
asm volatile ("stp %[val], %H[val], %[ptr]"
: [ptr] "=Q" (*ptr)
: [val] "r" (val));
}
write128:
mov x4, x2
mov x5, x3
stp x4, x5, [x0]
ret
Obviously it could be
write128:
stp x2, x3, [x0]
ret