https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99937
Bug ID: 99937
Summary: Optimization needed for ARM with single cycle
multiplier
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: mike.robins at talktalk dot net
Target Milestone: ---
Created attachment 50512
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50512&action=edit
Source file(s)
I am cross-compiling using "arm-none-eabi-gcc -mcpu=cortex-m0plus -Wall -Wextra
-fno-strict-aliasing -fwrapv -O3 -S foobar.c" for a target architecture that
performs a multiply in a single cycle, using gcc version 10.2.0 on a PC running
Fedora Linux.
Is there an option to persuade the compiler to use the multiply instruction
automatically instead of shifts and adds when multiplying by a constant?
In the example code attached, gcc uses the trick of multiplying by a big number
instead of dividing by a small one (12 in this case). For my target, the code
from "-O3" is both longer and slower then that for "-Os".