https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104387
Bug ID: 104387
Summary: aarch64: Redundant SXTH for “bag of bits” moves
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: rsandifo at gcc dot gnu.org
Target Milestone: ---
Target: aarch64*-*-*
This PR is about another case in which we generate a redundant SXTH.
Specifically:
void f(short *x, short y)
{
x[0] = y;
x[1] = y;
}
generates:
sxth w1, w1
strh w1, [x0]
strh w1, [x0, 2]
even though the RTL makes it clear that the upper 16 bits of the
promoted “y” are unused.
This is related to PR64537, but I think it's worth keeping as a
separate PR since the fix isn't necessarily the same.