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

            Bug ID: 115833
           Summary: SLP of signed short multiply goes wrong
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
void v4hi_smul(signed short *t, signed short tt)
{
  t[0] *= tt;
  t[1] *= tt;
  t[2] *= tt;
  t[3] *= tt;
}


void v4hi_umul(unsigned short *t, unsigned short tt)
{
  t[0] *= tt;
  t[1] *= tt;
  t[2] *= tt;
  t[3] *= tt;
}
```

At `-O2 -fno-vect-cost-model ` on x86_64, v4hi_smul code generation is really
bad while v4hi_umul is decent.

Both functions should produce the same code but currently we don't.

I noticed this while adding V2HI support to aarch64 backend and writing up
testcases.

Reply via email to