[Bug target/98477] New: aarch64: Unnecessary GPR -> FPR moves for conditional select
ktkachov at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Dec 30 09:35:35 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98477
Bug ID: 98477
Summary: aarch64: Unnecessary GPR -> FPR moves for conditional
select
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: ktkachov at gcc dot gnu.org
Target Milestone: ---
Target: aarch64
Code like
void
foo (int a, double *b)
{
*b = a ? 10000.0 : 200.0;
}
generates:
foo:
cmp w0, 0
mov x2, 149533581377536
movk x2, 0x40c3, lsl 48
mov x0, 4641240890982006784
fmov d0, x2
fmov d1, x0
fcsel d0, d0, d1, ne
str d0, [x1]
ret
We don't need to do the FCSEL on the FPR side if we're just storing it to
memory. We can just do a GPR CSEL and avoid the FMOVs.
I've seen this pattern in the disassembly of some math library routines.
Maybe we should add a =w,w,w alternative to the CSEL patterns in the backend?
More information about the Gcc-bugs
mailing list