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

            Bug ID: 115756
           Summary: default tuning for x86_64 produces shifts for `*240`
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```

unsigned long func(unsigned long x)
{
  return x * 240;
}
```

For most modern CPUs (I think), it is faster to use imul here instead of
shifts/adds/sub. clang's default tuning uses imul even. -mtune=skylake,
-mtune=znver[123],  all produces imul. Note -mtune=lunarlake/arrowlake  does
not but maybe they are wrong. 

Split out from PR 115749 .

Reply via email to