https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113926
Bug ID: 113926
Summary: `(vect128 int){1, 1, 0, 0}` could be generated via
`movi vN.2s, 1`
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Due to the way the d style instructions are defined by the ISA;
```
#define vect128 __attribute__((vector_size(16) ))
vect128 int f1(void)
{
return (vect128 int){1, 1, 0, 0};
}
```
can be done just via `movi v0.2s, 1` instruction.
We can also handle .4h and .4b and even just d0.
That is:
```
vect128 long long f2(void)
{
return (vect128 long long){1, 0};
}
```
is just: `movi d0, 1`
for little-endian:
```
#define vect64 __attribute__((vector_size(8) ))
vect64 int f0(void)
{
return (vect64 int){1, 0};
}
vect128 int f2(void)
{
return (vect128 int){1, 0, 0, 0};
}
```
is also just: `movi d0, 1`.