https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123924
Bug ID: 123924
Summary: missing detection of MLS for aarch64
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: aarch64-sve
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: tnfchris at gcc dot gnu.org
Target Milestone: ---
Target: aarch64*
The following example
typedef __attribute__((__vector_size__(sizeof(int)*8))) signed int v8i;
typedef __attribute__((__vector_size__(sizeof(int)*8))) unsigned int v8u;
void f(v8i *a,v8i *b,v8u *c)
{
*c = (v8u)(*a * *b) - *c;
}
void g(v8i *a,v8i *b,v8u *c)
{
*c = *c - (v8u)(*a * *b);
}
compiled with -O2 -march=armv9-a -msve-vector-bits=256
generates:
f:
ptrue p7.b, vl32
ld1w z0.s, p7/z, [x0]
ld1w z30.s, p7/z, [x1]
ld1w z31.s, p7/z, [x2]
mul z30.s, z0.s, z30.s
sub z31.s, z30.s, z31.s
st1w z31.s, p7, [x2]
ret
g:
ptrue p7.b, vl32
ld1w z0.s, p7/z, [x0]
ld1w z30.s, p7/z, [x1]
ld1w z31.s, p7/z, [x2]
mul z30.s, z0.s, z30.s
sub z31.s, z31.s, z30.s
st1w z31.s, p7, [x2]
ret
but the first one f, could have used `msb` and the second one `g` should have
been an mls.
It looks like we get these if the fms optab is implemented.