[Bug target/115756] New: default tuning for x86_64 produces shifts for `*240`
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jul 2 18:13:49 GMT 2024
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 .
More information about the Gcc-bugs
mailing list