https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113822

            Bug ID: 113822
           Summary: aarch64_evpc_reencode could/should use
                    new_shrunk_vector instead of manually doing it
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: internal-improvement
          Severity: enhancement
          Priority: P3
         Component: target
          Assignee: pinskia at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

The current code does:
```
  /* Convert the perm constant if we can.  Require even, odd as the pairs.  */
  for (unsigned int i = 0; i < nelt; i += 2)
    {
      poly_int64 elt0 = d->perm[i];
      poly_int64 elt1 = d->perm[i + 1];
      poly_int64 newelt;
      if (!multiple_p (elt0, 2, &newelt) || maybe_ne (elt0 + 1, elt1))
        return false;
      newpermconst.quick_push (newelt.to_constant ());
    }
  newpermconst.finalize ();
```

But that is just:
```
vec_perm_indices newpermindices;
if (!newpermindices.new_shrunk_vector(d->perm, 2))
  return false;
...
newd.perm.new_vector (newpermindices.encoding (), d.one_vector_p ? 1 : 2,
                      newpermindices.nelts_per_input ());
```

Filing so I remember to make this change.  Note I noticed this while
implementing V2HI/V4QI support.

Reply via email to